@@ -35,6 +35,7 @@ const scrollDownLabel = "↓";
35
35
36
36
export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
37
37
protected optionSelectContainer : Phaser . GameObjects . Container ;
38
+ protected optionSelectTextContainer : Phaser . GameObjects . Container ;
38
39
protected optionSelectBg : Phaser . GameObjects . NineSlice ;
39
40
protected optionSelectText : BBCodeText ;
40
41
protected optionSelectIcons : Phaser . GameObjects . Sprite [ ] ;
@@ -53,6 +54,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
53
54
protected unskippedIndices : number [ ] = [ ] ;
54
55
55
56
protected defaultTextStyle : TextStyle = TextStyle . WINDOW ;
57
+ protected textContent : string ;
56
58
57
59
58
60
constructor ( mode : Mode | null ) {
@@ -78,6 +80,9 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
78
80
this . optionSelectBg . setOrigin ( 1 , 1 ) ;
79
81
this . optionSelectContainer . add ( this . optionSelectBg ) ;
80
82
83
+ this . optionSelectTextContainer = globalScene . add . container ( 0 , 0 ) ;
84
+ this . optionSelectContainer . add ( this . optionSelectTextContainer ) ;
85
+
81
86
this . optionSelectIcons = [ ] ;
82
87
83
88
this . scale = getTextStyleOptions ( TextStyle . WINDOW , globalScene . uiTheme ) . scale ;
@@ -123,19 +128,18 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
123
128
) ;
124
129
this . optionSelectText . setOrigin ( 0 , 0 ) ;
125
130
this . optionSelectText . setName ( "text-option-select" ) ;
126
- this . optionSelectContainer . add ( this . optionSelectText ) ;
131
+ this . optionSelectTextContainer . add ( this . optionSelectText ) ;
127
132
this . optionSelectContainer . setPosition ( ( globalScene . game . canvas . width / 6 ) - 1 - ( this . config ?. xOffset || 0 ) , - 48 + ( this . config ?. yOffset || 0 ) ) ;
128
133
this . optionSelectBg . width = Math . max ( this . optionSelectText . displayWidth + 24 , this . getWindowWidth ( ) ) ;
129
134
this . optionSelectBg . height = this . getWindowHeight ( ) ;
130
- this . optionSelectText . setPosition ( this . optionSelectBg . x - this . optionSelectBg . width + 12 + 24 * this . scale , this . optionSelectBg . y - this . optionSelectBg . height + 2 + 42 * this . scale ) ;
135
+ this . optionSelectTextContainer . setPosition ( this . optionSelectBg . x - this . optionSelectBg . width + 12 + 24 * this . scale , this . optionSelectBg . y - this . optionSelectBg . height + 2 + 42 * this . scale ) ;
131
136
132
137
// Now that the container and background widths are established, we can set up the proper text restricted to visible options
133
- this . optionSelectText . setText ( optionsWithScroll . map ( o => o . item
138
+ this . textContent = optionsWithScroll . map ( o => o . item
134
139
? `[shadow=${ getTextColor ( o . style ?? this . defaultTextStyle , true , globalScene . uiTheme ) } ][color=${ getTextColor ( o . style ?? TextStyle . WINDOW , false , globalScene . uiTheme ) } ] ${ o . label } [/color][/shadow]`
135
140
: `[shadow=${ getTextColor ( o . style ?? this . defaultTextStyle , true , globalScene . uiTheme ) } ][color=${ getTextColor ( o . style ?? TextStyle . WINDOW , false , globalScene . uiTheme ) } ]${ o . label } [/color][/shadow]`
136
- ) . join ( "\n" )
137
-
138
- ) ;
141
+ ) . join ( "\n" ) ;
142
+ this . optionSelectText . setText ( this . textContent ) ;
139
143
140
144
options . forEach ( ( option : OptionSelectItem , i : number ) => {
141
145
if ( option . item ) {
@@ -184,7 +188,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
184
188
185
189
if ( this . config . delay ) {
186
190
this . blockInput = true ;
187
- this . optionSelectText . setAlpha ( 0.5 ) ;
191
+ this . optionSelectTextContainer . setAlpha ( 0.5 ) ;
188
192
this . cursorObj ?. setAlpha ( 0.8 ) ;
189
193
globalScene . time . delayedCall ( Utils . fixedInt ( this . config . delay ) , ( ) => this . unblockInput ( ) ) ;
190
194
}
@@ -278,7 +282,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
278
282
}
279
283
280
284
this . blockInput = false ;
281
- this . optionSelectText . setAlpha ( 1 ) ;
285
+ this . optionSelectTextContainer . setAlpha ( 1 ) ;
282
286
this . cursorObj ?. setAlpha ( 1 ) ;
283
287
}
284
288
0 commit comments