Add undo button to practice.
This commit is contained in:
parent
ed3ea30f80
commit
8439ce87ac
@ -526,7 +526,7 @@ GAME.Game = class {
|
||||
}
|
||||
|
||||
if(pieces_blocking == 1 && stride > 0) {
|
||||
// Apply blocking to last .
|
||||
// Apply blocking to last piece tile.
|
||||
for(let idist = 1; idist < dist; idist++) {
|
||||
if(this.board.tiles[tiles[tiles.length - idist].tile].piece !== null) {
|
||||
tiles[tiles.length - idist].block = dir_mask;
|
||||
|
@ -1005,6 +1005,15 @@ const INTERFACE = {
|
||||
INTERFACE.replay_jump(INTERFACE_DATA.history.length, false);
|
||||
},
|
||||
|
||||
undo() {
|
||||
INTERFACE_DATA.auto_mode = null;
|
||||
if(INTERFACE_DATA.history.length > 0) {
|
||||
GAME.init();
|
||||
INTERFACE_DATA.history.pop();
|
||||
INTERFACE.replay_jump(INTERFACE_DATA.history.length, false);
|
||||
}
|
||||
},
|
||||
|
||||
message(code, data) {
|
||||
if(data === null) { return; }
|
||||
|
||||
|
@ -47,6 +47,7 @@ LANGUAGE.Terms = {
|
||||
back: new LANGUAGE.Term( "Back", "戻る" ),
|
||||
resign: new LANGUAGE.Term( "Resign", "投了" ),
|
||||
confirm: new LANGUAGE.Term( "Confirm", "確認" ),
|
||||
undo: new LANGUAGE.Term( "Undo", "待った" ),
|
||||
reset: new LANGUAGE.Term( "Reset", "リセット" ),
|
||||
auto: new LANGUAGE.Term( "Auto", "自動" ),
|
||||
|
||||
|
@ -642,6 +642,7 @@ const SCENES = {
|
||||
}
|
||||
load(data) {
|
||||
let buttons_bottom = [ ];
|
||||
buttons_bottom.push(UI.button(LANG("undo"), () => { INTERFACE.undo(); }));
|
||||
buttons_bottom.push(UI.button(LANG("reset"), () => { INTERFACE.reset(); }));
|
||||
buttons_bottom.push(UI.button(LANG("back"), () => { LOAD(SCENES.Browse); }));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user