style: format haxe sources
release / release (push) Successful in 3m31s

This commit is contained in:
2026-10-08 23:31:16 +03:00
parent 86fac8e96c
commit 5964d3477b
11 changed files with 57 additions and 19 deletions
+4 -2
View File
@@ -33,7 +33,8 @@ class Device {
#end #end
} }
private static var MOBILES(default, never):Array<String> = ["Android", "webOS", "iPhone", "iPad", "iPod", "BlackBerry", "Windows Phone",]; private static var MOBILES(default,
never):Array<String> = ["Android", "webOS", "iPhone", "iPad", "iPod", "BlackBerry", "Windows Phone",];
public static function isMobile():Bool { public static function isMobile():Bool {
#if android #if android
@@ -56,7 +57,8 @@ class Device {
private static function get_fullScreenSignal():Signal<Bool> { private static function get_fullScreenSignal():Signal<Bool> {
if (fullScreenSignal == null) { if (fullScreenSignal == null) {
fullScreenSignal = new Signal(); fullScreenSignal = new Signal();
Lib.current.stage.addEventListener(FullScreenEvent.FULL_SCREEN, (event:FullScreenEvent) -> fullScreenSignal.emit(event.fullScreen)); Lib.current.stage.addEventListener(FullScreenEvent.FULL_SCREEN,
(event:FullScreenEvent) -> fullScreenSignal.emit(event.fullScreen));
} }
return fullScreenSignal; return fullScreenSignal;
} }
+2 -1
View File
@@ -24,7 +24,8 @@ class Callback<T> {
class ModernFileReference extends FileReference { class ModernFileReference extends FileReference {
#if android #if android
private static var fileUtilBrowse = lime.system.JNI.createStaticMethod("ru.m.android.FileUtil", "browse", "(Lorg/haxe/lime/HaxeObject;)V"); private static var fileUtilBrowse = lime.system.JNI.createStaticMethod("ru.m.android.FileUtil", "browse",
"(Lorg/haxe/lime/HaxeObject;)V");
#end #end
override public function browse(?typeFilter:Array<FileFilter>):Bool { override public function browse(?typeFilter:Array<FileFilter>):Bool {
+4 -2
View File
@@ -60,7 +60,8 @@ class PixabayApi {
return '${baseUrl}?${query}'; return '${baseUrl}?${query}';
} }
public function getPage(page:Int, perPage:Int, category:PixabayCategory = PixabayCategory.NATURE):Promise<PixabayResponse> { public function getPage(page:Int, perPage:Int,
category:PixabayCategory = PixabayCategory.NATURE):Promise<PixabayResponse> {
return new JsonLoader<PixabayResponse>().GET(buildRequest([ return new JsonLoader<PixabayResponse>().GET(buildRequest([
"category" => category, "category" => category,
"image_type" => PixabayImageType.PHOTO, "image_type" => PixabayImageType.PHOTO,
@@ -71,6 +72,7 @@ class PixabayApi {
} }
public function get(id:Int):Promise<PixabayImage> { public function get(id:Int):Promise<PixabayImage> {
return new JsonLoader<PixabayResponse>().GET(buildRequest(["id" => id])).then((response:PixabayResponse) -> response.hits[0]); return new JsonLoader<PixabayResponse>().GET(buildRequest(["id" => id]))
.then((response:PixabayResponse) -> response.hits[0]);
} }
} }
+8 -2
View File
@@ -208,14 +208,20 @@ class Render extends SpriteView implements IRender {
private function onMouseMove(event:MouseEvent):Void { private function onMouseMove(event:MouseEvent):Void {
var newPoint:PointExt = tableView.globalToLocal(new FlashPoint(event.stageX, event.stageY)); var newPoint:PointExt = tableView.globalToLocal(new FlashPoint(event.stageX, event.stageY));
var partPosition = cast(activePart.position, PointExt).add(newPoint).subtract(activePoint); var partPosition = cast(activePart.position, PointExt).add(newPoint).subtract(activePoint);
actions.emit(new GameAction().setAction(Action.MOVE).setPlayerId(playerId).setPartId(activePart.id).setPosition(partPosition)); actions.emit(new GameAction().setAction(Action.MOVE)
.setPlayerId(playerId)
.setPartId(activePart.id)
.setPosition(partPosition));
activePoint = newPoint; activePoint = newPoint;
} }
private function onMouseUp(event:MouseEvent):Void { private function onMouseUp(event:MouseEvent):Void {
var newPoint:PointExt = tableView.globalToLocal(new FlashPoint(event.stageX, event.stageY)); var newPoint:PointExt = tableView.globalToLocal(new FlashPoint(event.stageX, event.stageY));
var partPosition = cast(activePart.position, PointExt).add(newPoint).subtract(activePoint); var partPosition = cast(activePart.position, PointExt).add(newPoint).subtract(activePoint);
actions.emit(new GameAction().setAction(Action.PUT).setPlayerId(playerId).setPartId(activePart.id).setPosition(partPosition)); actions.emit(new GameAction().setAction(Action.PUT)
.setPlayerId(playerId)
.setPartId(activePart.id)
.setPosition(partPosition));
tableView.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); tableView.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
tableView.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp); tableView.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
activePart = null; activePart = null;
@@ -5,7 +5,8 @@ import ru.m.puzzlez.proto.game.BoundType;
import ru.m.puzzlez.proto.game.PartBound; import ru.m.puzzlez.proto.game.PartBound;
class ClassicPartBuilder extends BasePartBuilder { class ClassicPartBuilder extends BasePartBuilder {
override private function createBound(path:DrawPath, fromX:Float, fromY:Float, toX:Float, toY:Float, bound:PartBound):Void { override private function createBound(path:DrawPath, fromX:Float, fromY:Float, toX:Float, toY:Float,
bound:PartBound):Void {
var dx = toX == fromX ? 0 : (toX - fromX) / Math.abs(toX - fromX); var dx = toX == fromX ? 0 : (toX - fromX) / Math.abs(toX - fromX);
var dy = toY == fromY ? 0 : (toY - fromY) / Math.abs(toY - fromY); var dy = toY == fromY ? 0 : (toY - fromY) / Math.abs(toY - fromY);
var boundLength = Math.max(Math.abs(toX - fromX), Math.abs(toY - fromY)); var boundLength = Math.max(Math.abs(toX - fromX), Math.abs(toY - fromY));
@@ -23,7 +24,8 @@ class ClassicPartBuilder extends BasePartBuilder {
} }
switch bound.spike { switch bound.spike {
case BoundType.IN | BoundType.OUT: case BoundType.IN | BoundType.OUT:
path.commands.push(LINE_TO(fromX + spikeOffset * dx + spikeSideOffset * dy, fromY + spikeOffset * dy + spikeSideOffset * dx)); path.commands.push(LINE_TO(fromX + spikeOffset * dx + spikeSideOffset * dy,
fromY + spikeOffset * dy + spikeSideOffset * dx));
path.commands.push(CURVE_TO(fromX path.commands.push(CURVE_TO(fromX
+ (spikeOffset * 0.7) * dx + (spikeOffset * 0.7) * dx
- spikeDepth * dy - spikeDepth * dy
@@ -50,7 +52,8 @@ class ClassicPartBuilder extends BasePartBuilder {
+ spikeSideOffset * dx, + spikeSideOffset * dx,
fromX fromX
+ (spikeOffset + spikeWidth) * dx + (spikeOffset + spikeWidth) * dx
+ spikeSideOffset * dy, fromY + spikeSideOffset * dy,
fromY
+ (spikeOffset + spikeWidth) * dy + (spikeOffset + spikeWidth) * dy
+ spikeSideOffset * dx)); + spikeSideOffset * dx));
case _: case _:
@@ -5,7 +5,8 @@ import ru.m.puzzlez.proto.game.BoundType;
import ru.m.puzzlez.proto.game.PartBound; import ru.m.puzzlez.proto.game.PartBound;
class SquarePartBuilder extends BasePartBuilder { class SquarePartBuilder extends BasePartBuilder {
override private function createBound(path:DrawPath, fromX:Float, fromY:Float, toX:Float, toY:Float, bound:PartBound):Void { override private function createBound(path:DrawPath, fromX:Float, fromY:Float, toX:Float, toY:Float,
bound:PartBound):Void {
var dx = toX == fromX ? 0 : (toX - fromX) / Math.abs(toX - fromX); var dx = toX == fromX ? 0 : (toX - fromX) / Math.abs(toX - fromX);
var dy = toY == fromY ? 0 : (toY - fromY) / Math.abs(toY - fromY); var dy = toY == fromY ? 0 : (toY - fromY) / Math.abs(toY - fromY);
var boundLength = Math.max(Math.abs(toX - fromX), Math.abs(toY - fromY)); var boundLength = Math.max(Math.abs(toX - fromX), Math.abs(toY - fromY));
@@ -20,8 +21,10 @@ class SquarePartBuilder extends BasePartBuilder {
case BoundType.NONE: case BoundType.NONE:
case BoundType.IN | BoundType.OUT: case BoundType.IN | BoundType.OUT:
path.commands.push(LINE_TO(fromX + spikeOffset * dx, path.commands.push(LINE_TO(fromX + spikeOffset * dx,
fromY + spikeOffset * dy)) path.commands.push(LINE_TO(fromX + spikeOffset * dx - spikeDepth * dy, fromY + spikeDepth * dx + spikeOffset * dy)); fromY + spikeOffset * dy)) path.commands.push(LINE_TO(fromX + spikeOffset * dx - spikeDepth * dy,
path.commands.push(LINE_TO(fromX + (spikeOffset + spikeWidth) * dx - spikeDepth * dy, fromY + spikeDepth * dx + (spikeOffset + spikeWidth) * dy)); fromY + spikeDepth * dx + spikeOffset * dy));
path.commands.push(LINE_TO(fromX + (spikeOffset + spikeWidth) * dx - spikeDepth * dy,
fromY + spikeDepth * dx + (spikeOffset + spikeWidth) * dy));
path.commands.push(LINE_TO(fromX + (spikeOffset + spikeWidth) * dx, fromY + (spikeOffset + spikeWidth) * dy)); path.commands.push(LINE_TO(fromX + (spikeOffset + spikeWidth) * dx, fromY + (spikeOffset + spikeWidth) * dy));
} }
} }
@@ -16,8 +16,23 @@ import ru.m.puzzlez.render.Background;
@:singleton @:template class BackgroundPopup extends PopupView<Background> { @:singleton @:template class BackgroundPopup extends PopupView<Background> {
private static var colorsList:Array<Color> = [ private static var colorsList:Array<Color> = [
'#FFFFFF', '#001f3f', '#0074D9', '#7FDBFF', '#39CCCC', '#3D9970', '#2ECC40', '#01FF70', '#FFDC00', '#FF851B', '#FF4136', '#85144b', '#F012BE', '#B10DC9', '#FFFFFF',
'#111111', '#AAAAAA', '#DDDDDD', '#001f3f',
'#0074D9',
'#7FDBFF',
'#39CCCC',
'#3D9970',
'#2ECC40',
'#01FF70',
'#FFDC00',
'#FF851B',
'#FF4136',
'#85144b',
'#F012BE',
'#B10DC9',
'#111111',
'#AAAAAA',
'#DDDDDD',
]; ];
@:view("selected") var selectedView:SpriteView; @:view("selected") var selectedView:SpriteView;
+2 -1
View File
@@ -33,7 +33,8 @@ abstract Version(Array<Int>) {
@:from public static function fromString(value:String):Version { @:from public static function fromString(value:String):Version {
var r = ~/(\d+)\.(\d+)\.(\d+)(-SNAPSHOT)?/; var r = ~/(\d+)\.(\d+)\.(\d+)(-SNAPSHOT)?/;
return if (r.match(value)) { return if (r.match(value)) {
new Version(Std.parseInt(r.matched(1)), Std.parseInt(r.matched(2)), Std.parseInt(r.matched(3)), r.matched(4) != null); new Version(Std.parseInt(r.matched(1)), Std.parseInt(r.matched(2)), Std.parseInt(r.matched(3)),
r.matched(4) != null);
} else { } else {
new Version(0, 0, 0); new Version(0, 0, 0);
} }
@@ -22,6 +22,9 @@ class EventUtil {
} }
public static function change(part:Part):GameEvent { public static function change(part:Part):GameEvent {
return new GameEvent().setChange(new GameChange().setPartId(part.id).setLocation(part.location).setPosition(part.position).setPlayerId(part.playerId)); return new GameEvent().setChange(new GameChange().setPartId(part.id)
.setLocation(part.location)
.setPosition(part.position)
.setPlayerId(part.playerId));
} }
} }
+2 -1
View File
@@ -94,7 +94,8 @@ class Game implements IGame {
case Action.PUT: case Action.PUT:
part.playerId = null; part.playerId = null;
var target = new PointExt(state.preset.imageRect.x, var target = new PointExt(state.preset.imageRect.x,
state.preset.imageRect.y).add(new PointExt(part.point.x * part.rect.width, part.point.y * part.rect.height)); state.preset.imageRect.y).add(new PointExt(part.point.x * part.rect.width,
part.point.y * part.rect.height));
var d = distance(target, event.action.position); var d = distance(target, event.action.position);
if (d < 70) { if (d < 70) {
part.location = PartLocation.IMAGE; part.location = PartLocation.IMAGE;
@@ -41,7 +41,8 @@ abstract RectangleExt(Rectangle) from Rectangle to Rectangle {
public function intersect(rect:Rectangle):Bool { public function intersect(rect:Rectangle):Bool {
var thisRect:RectangleExt = this; var thisRect:RectangleExt = this;
var otherRect:RectangleExt = rect; var otherRect:RectangleExt = rect;
return !(thisRect.left > otherRect.right || otherRect.left > thisRect.right || thisRect.top > otherRect.bottom || otherRect.top > thisRect.bottom); return !(thisRect.left > otherRect.right || otherRect.left > thisRect.right || thisRect.top > otherRect.bottom
|| otherRect.top > thisRect.bottom);
} }
public function clone():Rectangle { public function clone():Rectangle {