[add] ansible deploy
This commit is contained in:
@@ -19,7 +19,7 @@ class PartView extends Sprite {
|
||||
}
|
||||
|
||||
private var size:Point;
|
||||
private var bitmap:Bitmap;
|
||||
public var bitmap:Bitmap;
|
||||
|
||||
public function new(id:Int, image:BitmapData, size:Point) {
|
||||
super();
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package ru.m.puzzlez.render;
|
||||
|
||||
import haxework.net.ImageLoader;
|
||||
import ru.m.puzzlez.core.ImageSource;
|
||||
import haxework.signal.Signal;
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.PNGEncoderOptions;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Point;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.net.FileReference;
|
||||
import flash.utils.ByteArray;
|
||||
import haxework.signal.Signal;
|
||||
import haxework.view.SpriteView;
|
||||
import openfl.Assets;
|
||||
import ru.m.puzzlez.core.GameEvent;
|
||||
import ru.m.puzzlez.core.GameState;
|
||||
|
||||
@@ -109,10 +110,19 @@ class Render extends SpriteView implements IRender {
|
||||
signal.emit(GameEvent.PART_PUT(activePart.id, partPosition.clone()));
|
||||
table.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
|
||||
table.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
|
||||
//save(activePart);
|
||||
activePart = null;
|
||||
activePoint = null;
|
||||
}
|
||||
|
||||
private function save(part:PartView):Void {
|
||||
var file = new FileReference();
|
||||
var bitmapData = part.bitmap.bitmapData;
|
||||
var data = new ByteArray();
|
||||
bitmapData.encode(new Rectangle(0, 0, bitmapData.width, bitmapData.height), new PNGEncoderOptions(), data);
|
||||
file.save(data, "icon.png");
|
||||
}
|
||||
|
||||
private function clean() {
|
||||
for (partView in parts) {
|
||||
table.removeChild(partView);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.puzzlez.view;
|
||||
|
||||
import haxework.view.form.ButtonView;
|
||||
import haxework.net.JsonLoader;
|
||||
import haxework.view.data.DataView;
|
||||
import haxework.view.group.VGroupView;
|
||||
@@ -33,12 +34,6 @@ typedef PixabayResponse = {
|
||||
images.data = [for (name in Assets.list(AssetType.IMAGE)) ASSET(name)];
|
||||
render.scale = 0.75;
|
||||
scale.position = render.scale - scale.ratio;
|
||||
|
||||
/*new JsonLoader<PixabayResponse>()
|
||||
.GET('https://pixabay.com/api/?key=14915210-5eae157281211e0ad28bc8def&category=nature')
|
||||
.then(function(result:PixabayResponse) {
|
||||
images.data = images.data.concat([for (item in result.hits) URL(item.largeImageURL)]);
|
||||
});*/
|
||||
}
|
||||
|
||||
private function imageViewFactory(index:Int, image:ImageSource):ImageView {
|
||||
@@ -50,6 +45,15 @@ typedef PixabayResponse = {
|
||||
return result;
|
||||
}
|
||||
|
||||
private function moreImages(view:ButtonView):Void {
|
||||
view.visible = false;
|
||||
new JsonLoader<PixabayResponse>()
|
||||
.GET('https://pixabay.com/api/?key=14915210-5eae157281211e0ad28bc8def&category=nature')
|
||||
.then(function(result:PixabayResponse) {
|
||||
images.data = images.data.concat([for (item in result.hits) URL(item.largeImageURL)]);
|
||||
});
|
||||
}
|
||||
|
||||
public function setScale(value:Float):Void {
|
||||
render.scale = value + scale.ratio;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ views:
|
||||
+onDataSelect: ~start
|
||||
geometry.margin: 5
|
||||
overflow.y: scroll
|
||||
- id: more
|
||||
$type: haxework.view.form.ButtonView
|
||||
text: More
|
||||
+onPress: ~moreImages
|
||||
- id: scale
|
||||
$type: haxework.view.list.VScrollBarView
|
||||
ratio: 0.5
|
||||
|
||||
Reference in New Issue
Block a user