Fixed tactical mode button
This commit is contained in:
parent
ade6b8068d
commit
7a7649e8a9
1
TODO.md
1
TODO.md
|
@ -8,7 +8,6 @@ Phaser 3 migration
|
||||||
* Fit the game in window size
|
* Fit the game in window size
|
||||||
* Fix top-right messages positions
|
* Fix top-right messages positions
|
||||||
* Fix valuebar requiring to be in root display list
|
* Fix valuebar requiring to be in root display list
|
||||||
* Fix tactical mode button not working
|
|
||||||
* Restore unit tests about boundaries (in UITools)
|
* Restore unit tests about boundaries (in UITools)
|
||||||
|
|
||||||
Menu/settings/saves
|
Menu/settings/saves
|
||||||
|
|
|
@ -129,7 +129,7 @@ module TK.SpaceTac.UI {
|
||||||
this.audio.startMusic("mechanolith", 0.2);
|
this.audio.startMusic("mechanolith", 0.2);
|
||||||
|
|
||||||
// Key mapping
|
// Key mapping
|
||||||
this.inputs.bind("t", "Show tactical view", () => this.toggle_tactical_mode.manipulate("keyboard")(3000));
|
this.inputs.bind("t", "Show tactical view", () => this.ship_list.info_button.toggle());
|
||||||
this.inputs.bind("Enter", "Validate action", () => this.validationPressed());
|
this.inputs.bind("Enter", "Validate action", () => this.validationPressed());
|
||||||
this.inputs.bind(" ", "Validate action", () => this.validationPressed());
|
this.inputs.bind(" ", "Validate action", () => this.validationPressed());
|
||||||
this.inputs.bind("Escape", "Cancel action", () => this.action_bar.actionEnded());
|
this.inputs.bind("Escape", "Cancel action", () => this.action_bar.actionEnded());
|
||||||
|
|
|
@ -43,7 +43,7 @@ module TK.SpaceTac.UI {
|
||||||
this.hovered = null;
|
this.hovered = null;
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
this.info_button = builder.button("battle-shiplist-info-button", 0, 0, () => null, "Tactical display", on => tactical_mode.manipulate("shiplist")(on));
|
this.info_button = builder.button("battle-shiplist-info-button", 0, 0, undefined, "Tactical display", on => tactical_mode.manipulate("shiplist")(on));
|
||||||
|
|
||||||
this.setShipsFromBattle(battle);
|
this.setShipsFromBattle(battle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,11 @@ module TK.SpaceTac.UI.Specs {
|
||||||
|
|
||||||
button2.toggle(true, UIButtonUnicity.EXCLUSIVE_MIN);
|
button2.toggle(true, UIButtonUnicity.EXCLUSIVE_MIN);
|
||||||
verify("toggle off unicity min", false, true, false, 0, 0, 0);
|
verify("toggle off unicity min", false, true, false, 0, 0, 0);
|
||||||
|
|
||||||
|
button1.toggle();
|
||||||
|
verify("toggle auto on", true, true, false, 1, 0, 0);
|
||||||
|
button1.toggle();
|
||||||
|
verify("toggle auto off", false, true, false, 1, 0, 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,11 @@ module TK.SpaceTac.UI {
|
||||||
*
|
*
|
||||||
* Returns the final state of this button
|
* Returns the final state of this button
|
||||||
*/
|
*/
|
||||||
toggle(on: boolean, unicity?: UIButtonUnicity): boolean {
|
toggle(on?: boolean, unicity?: UIButtonUnicity): boolean {
|
||||||
|
if (typeof on == "undefined") {
|
||||||
|
on = !this.state_on;
|
||||||
|
}
|
||||||
|
|
||||||
if (on && unicity && this.parentContainer) {
|
if (on && unicity && this.parentContainer) {
|
||||||
this.parentContainer.list.forEach(child => {
|
this.parentContainer.list.forEach(child => {
|
||||||
if (child instanceof UIButton && child != this) {
|
if (child instanceof UIButton && child != this) {
|
||||||
|
|
Loading…
Reference in a new issue