fix a floating cursor not destroyed
parent
3b693d2231
commit
ae85f1b416
|
@ -166,6 +166,9 @@ export default class SettingsGamepadUiHandler extends UiHandler {
|
|||
Object.keys(this.layout).forEach((key) => this.layout[key].optionsContainer.setVisible(false));
|
||||
const activeConfig = this.scene.inputController.getActiveConfig();
|
||||
const configType = activeConfig.padType;
|
||||
this.cursorObj?.destroy();
|
||||
this.cursorObj = null;
|
||||
this.scrollCursor = null;
|
||||
const layout = this.layout[configType];
|
||||
this.keys = layout.keys;
|
||||
this.optionsContainer = layout.optionsContainer;
|
||||
|
@ -188,8 +191,8 @@ export default class SettingsGamepadUiHandler extends UiHandler {
|
|||
if (!this.inputsIcons[key]) debugger;
|
||||
this.inputsIcons[key].setFrame(icon);
|
||||
}
|
||||
this.setCursor(0, true);
|
||||
this.setScrollCursor(0, true);
|
||||
this.setCursor(0);
|
||||
this.setScrollCursor(0);
|
||||
}
|
||||
|
||||
show(args: any[]): boolean {
|
||||
|
@ -197,7 +200,6 @@ export default class SettingsGamepadUiHandler extends UiHandler {
|
|||
this.updateBindings();
|
||||
|
||||
this.settingsContainer.setVisible(true);
|
||||
this.setCursor(0);
|
||||
this.setScrollCursor(0);
|
||||
|
||||
this.getUi().moveTo(this.settingsContainer, this.getUi().length - 1);
|
||||
|
@ -258,14 +260,9 @@ export default class SettingsGamepadUiHandler extends UiHandler {
|
|||
return success;
|
||||
}
|
||||
|
||||
setCursor(cursor: integer, override?: boolean): boolean {
|
||||
setCursor(cursor: integer): boolean {
|
||||
const ret = super.setCursor(cursor);
|
||||
|
||||
if (override) {
|
||||
Object.keys(this.layout).forEach(k => this.layout[k].optionsContainer.remove(this.cursorObj));
|
||||
this.cursorObj = null;
|
||||
}
|
||||
|
||||
if (!this.cursorObj) {
|
||||
this.cursorObj = this.scene.add.nineslice(0, 0, 'summary_moves_cursor', null, (this.scene.game.canvas.width / 6) - 10, 16, 1, 1, 1, 1);
|
||||
this.cursorObj.setOrigin(0, 0);
|
||||
|
@ -313,8 +310,8 @@ export default class SettingsGamepadUiHandler extends UiHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
setScrollCursor(scrollCursor: integer, override?: boolean): boolean {
|
||||
if (scrollCursor === this.scrollCursor && !override)
|
||||
setScrollCursor(scrollCursor: integer): boolean {
|
||||
if (scrollCursor === this.scrollCursor)
|
||||
return false;
|
||||
|
||||
this.scrollCursor = scrollCursor;
|
||||
|
|
Loading…
Reference in New Issue