This commit is contained in:
@@ -33,7 +33,8 @@ class Device {
|
||||
#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 {
|
||||
#if android
|
||||
@@ -56,7 +57,8 @@ class Device {
|
||||
private static function get_fullScreenSignal():Signal<Bool> {
|
||||
if (fullScreenSignal == null) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@ class Callback<T> {
|
||||
|
||||
class ModernFileReference extends FileReference {
|
||||
#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
|
||||
|
||||
override public function browse(?typeFilter:Array<FileFilter>):Bool {
|
||||
|
||||
@@ -60,7 +60,8 @@ class PixabayApi {
|
||||
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([
|
||||
"category" => category,
|
||||
"image_type" => PixabayImageType.PHOTO,
|
||||
@@ -71,6 +72,7 @@ class PixabayApi {
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,14 +208,20 @@ class Render extends SpriteView implements IRender {
|
||||
private function onMouseMove(event:MouseEvent):Void {
|
||||
var newPoint:PointExt = tableView.globalToLocal(new FlashPoint(event.stageX, event.stageY));
|
||||
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;
|
||||
}
|
||||
|
||||
private function onMouseUp(event:MouseEvent):Void {
|
||||
var newPoint:PointExt = tableView.globalToLocal(new FlashPoint(event.stageX, event.stageY));
|
||||
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_UP, onMouseUp);
|
||||
activePart = null;
|
||||
|
||||
@@ -5,7 +5,8 @@ import ru.m.puzzlez.proto.game.BoundType;
|
||||
import ru.m.puzzlez.proto.game.PartBound;
|
||||
|
||||
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 dy = toY == fromY ? 0 : (toY - fromY) / 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 {
|
||||
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
|
||||
+ (spikeOffset * 0.7) * dx
|
||||
- spikeDepth * dy
|
||||
@@ -50,7 +52,8 @@ class ClassicPartBuilder extends BasePartBuilder {
|
||||
+ spikeSideOffset * dx,
|
||||
fromX
|
||||
+ (spikeOffset + spikeWidth) * dx
|
||||
+ spikeSideOffset * dy, fromY
|
||||
+ spikeSideOffset * dy,
|
||||
fromY
|
||||
+ (spikeOffset + spikeWidth) * dy
|
||||
+ spikeSideOffset * dx));
|
||||
case _:
|
||||
|
||||
@@ -5,7 +5,8 @@ import ru.m.puzzlez.proto.game.BoundType;
|
||||
import ru.m.puzzlez.proto.game.PartBound;
|
||||
|
||||
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 dy = toY == fromY ? 0 : (toY - fromY) / 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.IN | BoundType.OUT:
|
||||
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));
|
||||
path.commands.push(LINE_TO(fromX + (spikeOffset + spikeWidth) * dx - spikeDepth * dy, fromY + spikeDepth * dx + (spikeOffset + spikeWidth) * dy));
|
||||
fromY + spikeOffset * dy)) path.commands.push(LINE_TO(fromX + spikeOffset * dx - spikeDepth * 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,23 @@ import ru.m.puzzlez.render.Background;
|
||||
|
||||
@:singleton @:template class BackgroundPopup extends PopupView<Background> {
|
||||
private static var colorsList:Array<Color> = [
|
||||
'#FFFFFF', '#001f3f', '#0074D9', '#7FDBFF', '#39CCCC', '#3D9970', '#2ECC40', '#01FF70', '#FFDC00', '#FF851B', '#FF4136', '#85144b', '#F012BE', '#B10DC9',
|
||||
'#111111', '#AAAAAA', '#DDDDDD',
|
||||
'#FFFFFF',
|
||||
'#001f3f',
|
||||
'#0074D9',
|
||||
'#7FDBFF',
|
||||
'#39CCCC',
|
||||
'#3D9970',
|
||||
'#2ECC40',
|
||||
'#01FF70',
|
||||
'#FFDC00',
|
||||
'#FF851B',
|
||||
'#FF4136',
|
||||
'#85144b',
|
||||
'#F012BE',
|
||||
'#B10DC9',
|
||||
'#111111',
|
||||
'#AAAAAA',
|
||||
'#DDDDDD',
|
||||
];
|
||||
|
||||
@:view("selected") var selectedView:SpriteView;
|
||||
|
||||
@@ -33,7 +33,8 @@ abstract Version(Array<Int>) {
|
||||
@:from public static function fromString(value:String):Version {
|
||||
var r = ~/(\d+)\.(\d+)\.(\d+)(-SNAPSHOT)?/;
|
||||
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 {
|
||||
new Version(0, 0, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user