feat(app): add table shuffle and spread actions
This commit is contained in:
@@ -18,6 +18,7 @@ class PuzzlezTheme extends Theme {
|
||||
"restore" => "window-restore-solid.svg",
|
||||
"compress" => "compress-solid.svg",
|
||||
"expand" => "expand-solid.svg",
|
||||
"spread" => "clone.svg",
|
||||
];
|
||||
|
||||
public function new() {
|
||||
|
||||
@@ -7,7 +7,9 @@ import hw.view.popup.ConfirmView;
|
||||
import promhx.Promise;
|
||||
import ru.m.puzzlez.image.Game;
|
||||
import ru.m.puzzlez.image.IGame;
|
||||
import ru.m.puzzlez.proto.event.GameAction;
|
||||
import ru.m.puzzlez.proto.event.GameEvent;
|
||||
import ru.m.puzzlez.proto.event.gameaction.Action;
|
||||
import ru.m.puzzlez.proto.game.GameState;
|
||||
import ru.m.puzzlez.proto.game.GameStatus;
|
||||
import ru.m.puzzlez.render.IRender;
|
||||
@@ -91,6 +93,16 @@ import ru.m.puzzlez.view.popup.PreviewPopup;
|
||||
});
|
||||
}
|
||||
|
||||
private function shuffle():Void {
|
||||
// TODO: playerId?
|
||||
game.action(new GameAction().setAction(Action.TABLE_SHUFFLE).setPlayerId("local"));
|
||||
}
|
||||
|
||||
private function spread():Void {
|
||||
// TODO: playerId?
|
||||
game.action(new GameAction().setAction(Action.TABLE_SPREAD).setPlayerId("local"));
|
||||
}
|
||||
|
||||
private function back():Void {
|
||||
(game.state.status == GameStatus.COMPLETE ? Promise.promise(true) : ConfirmView.confirm("Exit?")).then(result -> {
|
||||
if (result) {
|
||||
|
||||
@@ -25,6 +25,12 @@ views:
|
||||
- $type: hw.view.form.ButtonView
|
||||
style: icon.restore
|
||||
+onPress: ~render.manager.reset()
|
||||
- $type: hw.view.form.ButtonView
|
||||
style: icon.spread
|
||||
+onPress: ~shuffle()
|
||||
- $type: hw.view.form.ButtonView
|
||||
style: icon.spread
|
||||
+onPress: ~spread()
|
||||
- $type: hw.view.form.ButtonView
|
||||
style: icon.setting
|
||||
geometry.margin.top: 30
|
||||
|
||||
Reference in New Issue
Block a user