Minor UI changes
This commit is contained in:
parent
e62bb6e225
commit
05f114c8a4
|
@ -1128,7 +1128,6 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
case Mode.BIOME_SELECT:
|
case Mode.BIOME_SELECT:
|
||||||
case Mode.STARTER_SELECT:
|
case Mode.STARTER_SELECT:
|
||||||
case Mode.CONFIRM:
|
case Mode.CONFIRM:
|
||||||
case Mode.GAME_MODE_SELECT:
|
|
||||||
this.ui.setOverlayMode(Mode.MENU);
|
this.ui.setOverlayMode(Mode.MENU);
|
||||||
inputSuccess = true;
|
inputSuccess = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -676,7 +676,7 @@ export class GameData {
|
||||||
}, () => {
|
}, () => {
|
||||||
this.scene.ui.revertMode();
|
this.scene.ui.revertMode();
|
||||||
this.scene.ui.showText(null, 0);
|
this.scene.ui.showText(null, 0);
|
||||||
}, false, 98);
|
}, false, -98);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})((e.target as any).files[0]);
|
})((e.target as any).files[0]);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { addWindow } from "./window";
|
||||||
|
|
||||||
export interface OptionSelectConfig {
|
export interface OptionSelectConfig {
|
||||||
xOffset?: number;
|
xOffset?: number;
|
||||||
|
yOffset?: number;
|
||||||
options: OptionSelectItem[];
|
options: OptionSelectItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
||||||
this.optionSelectText = addTextObject(this.scene, 0, 0, options.map(o => o.label).join('\n'), TextStyle.WINDOW, { maxLines: options.length });
|
this.optionSelectText = addTextObject(this.scene, 0, 0, options.map(o => o.label).join('\n'), TextStyle.WINDOW, { maxLines: options.length });
|
||||||
this.optionSelectText.setLineSpacing(12);
|
this.optionSelectText.setLineSpacing(12);
|
||||||
this.optionSelectContainer.add(this.optionSelectText);
|
this.optionSelectContainer.add(this.optionSelectText);
|
||||||
this.optionSelectContainer.x = (this.scene.game.canvas.width / 6) - 1 - (this.config?.xOffset || 0);
|
this.optionSelectContainer.setPosition((this.scene.game.canvas.width / 6) - 1 - (this.config?.xOffset || 0), -48 + (this.config?.yOffset || 0));
|
||||||
|
|
||||||
this.optionSelectBg.width = Math.max(this.optionSelectText.displayWidth + 24, this.getWindowWidth());
|
this.optionSelectBg.width = Math.max(this.optionSelectText.displayWidth + 24, this.getWindowWidth());
|
||||||
this.optionSelectBg.height = this.getWindowHeight();
|
this.optionSelectBg.height = this.getWindowHeight();
|
||||||
|
|
|
@ -31,11 +31,12 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
||||||
|
|
||||||
super.show([ config ]);
|
super.show([ config ]);
|
||||||
|
|
||||||
this.switchCheck = args.length >= 3 && args[2] as boolean;
|
this.switchCheck = args.length >= 3 && args[2] !== null && args[2] as boolean;
|
||||||
|
|
||||||
const xOffset = (args.length >= 4 ? -args[3] as number : 0);
|
const xOffset = (args.length >= 4 && args[3] !== null ? args[3] as number : 0);
|
||||||
|
const yOffset = (args.length >= 5 && args[4] !== null ? args[4] as number : 0);
|
||||||
|
|
||||||
this.optionSelectContainer.x = (this.scene.game.canvas.width / 6) - 1 + xOffset;
|
this.optionSelectContainer.setPosition((this.scene.game.canvas.width / 6) - 1 + xOffset, -48 + yOffset);
|
||||||
|
|
||||||
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);
|
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
import BattleScene from "../battle-scene";
|
|
||||||
import { GameMode, gameModeNames } from "../game-mode";
|
|
||||||
import { Unlockables } from "../system/unlockables";
|
|
||||||
import AbstractOptionSelectUiHandler, { OptionSelectConfig, OptionSelectItem } from "./abstact-option-select-ui-handler";
|
|
||||||
import { Mode } from "./ui";
|
|
||||||
|
|
||||||
export default class GameModeSelectUiHandler extends AbstractOptionSelectUiHandler {
|
|
||||||
|
|
||||||
constructor(scene: BattleScene) {
|
|
||||||
super(scene, Mode.GAME_MODE_SELECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
getWindowWidth(): integer {
|
|
||||||
return 104;
|
|
||||||
}
|
|
||||||
|
|
||||||
show(args: any[]): boolean {
|
|
||||||
if (args.length === 2 && args[0] instanceof Function && args[1] instanceof Function) {
|
|
||||||
const options: OptionSelectItem[] = [
|
|
||||||
{
|
|
||||||
label: gameModeNames[GameMode.CLASSIC],
|
|
||||||
handler: () => args[0](GameMode.CLASSIC)
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
if (this.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]) {
|
|
||||||
options.push({
|
|
||||||
label: gameModeNames[GameMode.ENDLESS],
|
|
||||||
handler: () => args[0](GameMode.ENDLESS)
|
|
||||||
});
|
|
||||||
if (this.scene.gameData.unlocks[Unlockables.SPLICED_ENDLESS_MODE]) {
|
|
||||||
options.push({
|
|
||||||
label: gameModeNames[GameMode.SPLICED_ENDLESS],
|
|
||||||
handler: () => args[0](GameMode.SPLICED_ENDLESS)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options.push({
|
|
||||||
label: 'Cancel',
|
|
||||||
handler: args[1]
|
|
||||||
})
|
|
||||||
|
|
||||||
const config: OptionSelectConfig = {
|
|
||||||
options: options
|
|
||||||
};
|
|
||||||
|
|
||||||
super.show([ config ]);
|
|
||||||
|
|
||||||
this.optionSelectContainer.setVisible(true);
|
|
||||||
this.setCursor(0);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -198,7 +198,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
||||||
ui.setOverlayMode(Mode.CONFIRM, doLogout, () => {
|
ui.setOverlayMode(Mode.CONFIRM, doLogout, () => {
|
||||||
ui.revertMode();
|
ui.revertMode();
|
||||||
ui.showText(null, 0);
|
ui.showText(null, 0);
|
||||||
}, false, 98);
|
}, false, -98);
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
doLogout();
|
doLogout();
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { Mode } from "./ui";
|
||||||
import MessageUiHandler from "./message-ui-handler";
|
import MessageUiHandler from "./message-ui-handler";
|
||||||
import { Gender, getGenderColor, getGenderSymbol } from "../data/gender";
|
import { Gender, getGenderColor, getGenderSymbol } from "../data/gender";
|
||||||
import { allAbilities } from "../data/ability";
|
import { allAbilities } from "../data/ability";
|
||||||
import { GameMode } from "../game-mode";
|
import { GameMode, gameModeNames } from "../game-mode";
|
||||||
import { Unlockables } from "../system/unlockables";
|
import { Unlockables } from "../system/unlockables";
|
||||||
import { GrowthRate, getGrowthRateColor } from "../data/exp";
|
import { GrowthRate, getGrowthRateColor } from "../data/exp";
|
||||||
import { DexAttr, DexEntry } from "../system/game-data";
|
import { DexAttr, DexEntry } from "../system/game-data";
|
||||||
|
@ -463,7 +463,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
ui.setMode(Mode.STARTER_SELECT);
|
ui.setMode(Mode.STARTER_SELECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
yOffset: 47
|
||||||
});
|
});
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
@ -925,10 +926,30 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
};
|
};
|
||||||
if (this.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]) {
|
if (this.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]) {
|
||||||
ui.setMode(Mode.STARTER_SELECT);
|
ui.setMode(Mode.STARTER_SELECT);
|
||||||
ui.showText('Select a game mode.', null, () => ui.setModeWithoutClear(Mode.GAME_MODE_SELECT, startRun, cancel));
|
const options = [
|
||||||
|
{
|
||||||
|
label: gameModeNames[GameMode.CLASSIC],
|
||||||
|
handler: () => startRun(GameMode.CLASSIC)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: gameModeNames[GameMode.ENDLESS],
|
||||||
|
handler: () => startRun(GameMode.ENDLESS)
|
||||||
|
}
|
||||||
|
];
|
||||||
|
if (this.scene.gameData.unlocks[Unlockables.SPLICED_ENDLESS_MODE]) {
|
||||||
|
options.push({
|
||||||
|
label: gameModeNames[GameMode.SPLICED_ENDLESS],
|
||||||
|
handler: () => startRun(GameMode.SPLICED_ENDLESS)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
options.push({
|
||||||
|
label: 'Cancel',
|
||||||
|
handler: () => cancel()
|
||||||
|
});
|
||||||
|
ui.showText('Select a game mode.', null, () => ui.setModeWithoutClear(Mode.OPTION_SELECT, { options: options, yOffset: 19 }));
|
||||||
} else
|
} else
|
||||||
startRun(GameMode.CLASSIC);
|
startRun(GameMode.CLASSIC);
|
||||||
}, cancel);
|
}, cancel, null, null, 19);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -100,7 +100,7 @@ function getTextStyleOptions(style: TextStyle, extraStyleOptions?: Phaser.Types.
|
||||||
|
|
||||||
if (extraStyleOptions) {
|
if (extraStyleOptions) {
|
||||||
if (extraStyleOptions.fontSize) {
|
if (extraStyleOptions.fontSize) {
|
||||||
const sizeRatio = parseInt(extraStyleOptions.fontSize.toString().slice(0, -2)) / parseInt(styleOptions.fontSize.slice(0, -2));
|
const sizeRatio = parseInt(extraStyleOptions.fontSize.toString().slice(0, -2)) / parseInt(styleOptions.fontSize.toString().slice(0, -2));
|
||||||
shadowSize *= sizeRatio;
|
shadowSize *= sizeRatio;
|
||||||
}
|
}
|
||||||
styleOptions = Object.assign(styleOptions, extraStyleOptions);
|
styleOptions = Object.assign(styleOptions, extraStyleOptions);
|
||||||
|
|
|
@ -13,7 +13,6 @@ import StarterSelectUiHandler from './starter-select-ui-handler';
|
||||||
import EvolutionSceneHandler from './evolution-scene-handler';
|
import EvolutionSceneHandler from './evolution-scene-handler';
|
||||||
import BiomeSelectUiHandler from './biome-select-ui-handler';
|
import BiomeSelectUiHandler from './biome-select-ui-handler';
|
||||||
import TargetSelectUiHandler from './target-select-ui-handler';
|
import TargetSelectUiHandler from './target-select-ui-handler';
|
||||||
import GameModeSelectUiHandler from './game-mode-select-ui-handler';
|
|
||||||
import SettingsUiHandler from './settings-ui-handler';
|
import SettingsUiHandler from './settings-ui-handler';
|
||||||
import { TextStyle, addTextObject } from './text';
|
import { TextStyle, addTextObject } from './text';
|
||||||
import AchvBar from './achv-bar';
|
import AchvBar from './achv-bar';
|
||||||
|
@ -46,7 +45,6 @@ export enum Mode {
|
||||||
EGG_HATCH_SCENE,
|
EGG_HATCH_SCENE,
|
||||||
CONFIRM,
|
CONFIRM,
|
||||||
OPTION_SELECT,
|
OPTION_SELECT,
|
||||||
GAME_MODE_SELECT,
|
|
||||||
MENU,
|
MENU,
|
||||||
SETTINGS,
|
SETTINGS,
|
||||||
ACHIEVEMENTS,
|
ACHIEVEMENTS,
|
||||||
|
@ -72,7 +70,6 @@ const transitionModes = [
|
||||||
const noTransitionModes = [
|
const noTransitionModes = [
|
||||||
Mode.CONFIRM,
|
Mode.CONFIRM,
|
||||||
Mode.OPTION_SELECT,
|
Mode.OPTION_SELECT,
|
||||||
Mode.GAME_MODE_SELECT,
|
|
||||||
Mode.MENU,
|
Mode.MENU,
|
||||||
Mode.SETTINGS,
|
Mode.SETTINGS,
|
||||||
Mode.ACHIEVEMENTS,
|
Mode.ACHIEVEMENTS,
|
||||||
|
@ -117,7 +114,6 @@ export default class UI extends Phaser.GameObjects.Container {
|
||||||
new EggHatchSceneHandler(scene),
|
new EggHatchSceneHandler(scene),
|
||||||
new ConfirmUiHandler(scene),
|
new ConfirmUiHandler(scene),
|
||||||
new OptionSelectUiHandler(scene),
|
new OptionSelectUiHandler(scene),
|
||||||
new GameModeSelectUiHandler(scene),
|
|
||||||
new MenuUiHandler(scene),
|
new MenuUiHandler(scene),
|
||||||
new SettingsUiHandler(scene),
|
new SettingsUiHandler(scene),
|
||||||
new AchvsUiHandler(scene),
|
new AchvsUiHandler(scene),
|
||||||
|
|
Loading…
Reference in New Issue