Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI/UX] Text is grey again in delay confirm option menu #5396

Merged
merged 1 commit into from
Feb 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/ui/abstact-option-select-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const scrollDownLabel = "↓";

export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
protected optionSelectContainer: Phaser.GameObjects.Container;
protected optionSelectTextContainer: Phaser.GameObjects.Container;
protected optionSelectBg: Phaser.GameObjects.NineSlice;
protected optionSelectText: BBCodeText;
protected optionSelectIcons: Phaser.GameObjects.Sprite[];
Expand All @@ -53,6 +54,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
protected unskippedIndices: number[] = [];

protected defaultTextStyle: TextStyle = TextStyle.WINDOW;
protected textContent: string;


constructor(mode: Mode | null) {
Expand All @@ -78,6 +80,9 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
this.optionSelectBg.setOrigin(1, 1);
this.optionSelectContainer.add(this.optionSelectBg);

this.optionSelectTextContainer = globalScene.add.container(0, 0);
this.optionSelectContainer.add(this.optionSelectTextContainer);

this.optionSelectIcons = [];

this.scale = getTextStyleOptions(TextStyle.WINDOW, globalScene.uiTheme).scale;
Expand Down Expand Up @@ -123,19 +128,18 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
);
this.optionSelectText.setOrigin(0, 0);
this.optionSelectText.setName("text-option-select");
this.optionSelectContainer.add(this.optionSelectText);
this.optionSelectTextContainer.add(this.optionSelectText);
this.optionSelectContainer.setPosition((globalScene.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.height = this.getWindowHeight();
this.optionSelectText.setPosition(this.optionSelectBg.x - this.optionSelectBg.width + 12 + 24 * this.scale, this.optionSelectBg.y - this.optionSelectBg.height + 2 + 42 * this.scale);
this.optionSelectTextContainer.setPosition(this.optionSelectBg.x - this.optionSelectBg.width + 12 + 24 * this.scale, this.optionSelectBg.y - this.optionSelectBg.height + 2 + 42 * this.scale);

// Now that the container and background widths are established, we can set up the proper text restricted to visible options
this.optionSelectText.setText(optionsWithScroll.map(o => o.item
this.textContent = optionsWithScroll.map(o => o.item
? `[shadow=${getTextColor(o.style ?? this.defaultTextStyle, true, globalScene.uiTheme)}][color=${getTextColor(o.style ?? TextStyle.WINDOW, false, globalScene.uiTheme)}] ${o.label}[/color][/shadow]`
: `[shadow=${getTextColor(o.style ?? this.defaultTextStyle, true, globalScene.uiTheme)}][color=${getTextColor(o.style ?? TextStyle.WINDOW, false, globalScene.uiTheme)}]${o.label}[/color][/shadow]`
).join("\n")

);
).join("\n");
this.optionSelectText.setText(this.textContent);

options.forEach((option: OptionSelectItem, i: number) => {
if (option.item) {
Expand Down Expand Up @@ -184,7 +188,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {

if (this.config.delay) {
this.blockInput = true;
this.optionSelectText.setAlpha(0.5);
this.optionSelectTextContainer.setAlpha(0.5);
this.cursorObj?.setAlpha(0.8);
globalScene.time.delayedCall(Utils.fixedInt(this.config.delay), () => this.unblockInput());
}
Expand Down Expand Up @@ -278,7 +282,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
}

this.blockInput = false;
this.optionSelectText.setAlpha(1);
this.optionSelectTextContainer.setAlpha(1);
this.cursorObj?.setAlpha(1);
}

Expand Down