Rename retire to resign.
This commit is contained in:
parent
38a175b239
commit
1cf6839fa9
@ -32,7 +32,7 @@ const OpCode = {
|
||||
SessionList :0x0020,
|
||||
//SessionJoin :0x0021,
|
||||
SessionView :0x0022,
|
||||
SessionRetire :0x002E,
|
||||
SessionResign :0x002E,
|
||||
SessionLeave :0x002F,
|
||||
|
||||
GameState :0x0030,
|
||||
|
@ -637,7 +637,7 @@ GAME.Const = {
|
||||
State: {
|
||||
Ongoing: 0,
|
||||
Complete: 1,
|
||||
Retire: 2,
|
||||
Resign: 2,
|
||||
},
|
||||
|
||||
Direction: [
|
||||
|
@ -577,9 +577,9 @@ const INTERFACE = {
|
||||
}
|
||||
}
|
||||
|
||||
if(GAME_DATA.state.code == GAME.Const.State.Retire) {
|
||||
if(GAME_DATA.state.code == GAME.Const.State.Resign) {
|
||||
ctx.fillStyle = INTERFACE.Color.HintCheck;
|
||||
message = "Retire";
|
||||
message = "Resign";
|
||||
} else if(GAME_DATA.state.check != 0) {
|
||||
ctx.fillStyle = INTERFACE.Color.HintCheck;
|
||||
if(GAME_DATA.state.checkmate) {
|
||||
@ -731,8 +731,8 @@ const INTERFACE = {
|
||||
|
||||
handles: [dawn, dusk],
|
||||
board_state: [ ],
|
||||
retire:false,
|
||||
retire_warn:false,
|
||||
resign:false,
|
||||
resign_warn:false,
|
||||
|
||||
history: history,
|
||||
|
||||
@ -887,33 +887,33 @@ const INTERFACE = {
|
||||
INTERFACE.draw();
|
||||
},
|
||||
|
||||
retire() {
|
||||
resign() {
|
||||
if(INTERFACE_DATA.mode == INTERFACE.Mode.Player) {
|
||||
let button_retire = document.getElementById("button-retire");
|
||||
let button_resign = document.getElementById("button-resign");
|
||||
|
||||
if(INTERFACE_DATA.retire_warn) {
|
||||
INTERFACE.retire_reset();
|
||||
if(INTERFACE_DATA.resign_warn) {
|
||||
INTERFACE.resign_reset();
|
||||
MESSAGE_COMPOSE([
|
||||
PACK.u16(OpCode.SessionRetire),
|
||||
PACK.u16(OpCode.SessionResign),
|
||||
INTERFACE_DATA.token,
|
||||
]);
|
||||
} else {
|
||||
INTERFACE_DATA.retire_warn = true;
|
||||
button_retire.innerText = "Confirm?";
|
||||
button_retire.setAttribute("class", "warn");
|
||||
setTimeout(INTERFACE.retire_reset, 3_000);
|
||||
INTERFACE_DATA.resign_warn = true;
|
||||
button_resign.innerText = "Confirm?";
|
||||
button_resign.setAttribute("class", "warn");
|
||||
setTimeout(INTERFACE.resign_reset, 3_000);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
retire_reset() {
|
||||
if(INTERFACE_DATA.retire_warn) {
|
||||
INTERFACE_DATA.retire_warn = false;
|
||||
resign_reset() {
|
||||
if(INTERFACE_DATA.resign_warn) {
|
||||
INTERFACE_DATA.resign_warn = false;
|
||||
|
||||
// Reset retire button
|
||||
let button_retire = document.getElementById("button-retire");
|
||||
button_retire.innerText = "Surrender";
|
||||
button_retire.removeAttribute("class");
|
||||
// Reset resign button
|
||||
let button_resign = document.getElementById("button-resign");
|
||||
button_resign.innerText = "Resign";
|
||||
button_resign.removeAttribute("class");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -503,9 +503,9 @@ const SCENES = {
|
||||
load(data) {
|
||||
let buttons_bottom = [ ];
|
||||
if(data.mode != INTERFACE.Mode.Review) {
|
||||
let button_retire = UI.button("Surrender", () => { INTERFACE.retire(); });
|
||||
button_retire.setAttribute("id", "button-retire");
|
||||
buttons_bottom.push(button_retire);
|
||||
let button_resign = UI.button("Resign", () => { INTERFACE.resign(); });
|
||||
button_resign.setAttribute("id", "button-resign");
|
||||
buttons_bottom.push(button_resign);
|
||||
}
|
||||
buttons_bottom.push(UI.button("Back", () => { LOAD(SCENES.Browse) }));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user