@@ -30,7 +30,7 @@ namespace user_interface_base {
30
30
this . navigator = null
31
31
}
32
32
33
- protected moveCursor ( dir : CursorDir ) {
33
+ public moveCursor ( dir : CursorDir ) {
34
34
try {
35
35
this . moveTo ( this . cursor . move ( dir ) )
36
36
} catch ( e ) {
@@ -54,47 +54,51 @@ namespace user_interface_base {
54
54
)
55
55
}
56
56
57
- /* override */ startup ( ) {
58
- super . startup ( )
59
- control . onEvent (
60
- ControllerButtonEvent . Pressed ,
61
- controller . right . id ,
62
- ( ) => this . moveCursor ( CursorDir . Right )
63
- )
64
- control . onEvent (
65
- ControllerButtonEvent . Pressed ,
66
- controller . up . id ,
67
- ( ) => this . moveCursor ( CursorDir . Up )
68
- )
69
- control . onEvent (
70
- ControllerButtonEvent . Pressed ,
71
- controller . down . id ,
72
- ( ) => this . moveCursor ( CursorDir . Down )
73
- )
74
- control . onEvent (
75
- ControllerButtonEvent . Pressed ,
76
- controller . left . id ,
77
- ( ) => this . moveCursor ( CursorDir . Left )
78
- )
79
-
80
- // click
81
- const click = ( ) => this . cursor . click ( )
82
- control . onEvent (
83
- ControllerButtonEvent . Pressed ,
84
- controller . A . id ,
85
- click
86
- )
87
- control . onEvent (
88
- ControllerButtonEvent . Pressed ,
89
- controller . A . id + keymap . PLAYER_OFFSET ,
90
- click
91
- )
92
- control . onEvent (
93
- ControllerButtonEvent . Pressed ,
94
- controller . B . id ,
95
- ( ) => this . back ( )
96
- )
97
57
58
+ /* override */ startup ( controlSetupFn ?: ( ) => { } ) {
59
+ super . startup ( )
60
+ if ( controlSetupFn != null ) {
61
+ controlSetupFn ( ) ;
62
+ } else {
63
+ control . onEvent (
64
+ ControllerButtonEvent . Pressed ,
65
+ controller . right . id ,
66
+ ( ) => this . moveCursor ( CursorDir . Right )
67
+ )
68
+ control . onEvent (
69
+ ControllerButtonEvent . Pressed ,
70
+ controller . up . id ,
71
+ ( ) => this . moveCursor ( CursorDir . Up )
72
+ )
73
+ control . onEvent (
74
+ ControllerButtonEvent . Pressed ,
75
+ controller . down . id ,
76
+ ( ) => this . moveCursor ( CursorDir . Down )
77
+ )
78
+ control . onEvent (
79
+ ControllerButtonEvent . Pressed ,
80
+ controller . left . id ,
81
+ ( ) => this . moveCursor ( CursorDir . Left )
82
+ )
83
+
84
+ // click
85
+ const click = ( ) => this . cursor . click ( )
86
+ control . onEvent (
87
+ ControllerButtonEvent . Pressed ,
88
+ controller . A . id ,
89
+ click
90
+ )
91
+ control . onEvent (
92
+ ControllerButtonEvent . Pressed ,
93
+ controller . A . id + keymap . PLAYER_OFFSET ,
94
+ click
95
+ )
96
+ control . onEvent (
97
+ ControllerButtonEvent . Pressed ,
98
+ controller . B . id ,
99
+ ( ) => this . back ( )
100
+ )
101
+ }
98
102
this . cursor = new Cursor ( )
99
103
this . picker = new Picker ( this . cursor )
100
104
if ( this . navigator == null )
@@ -170,52 +174,55 @@ namespace user_interface_base {
170
174
this . goBack1PageFn = goBack1PageFn
171
175
}
172
176
173
- /* override */ startup ( ) {
174
- control . onEvent (
175
- ControllerButtonEvent . Pressed ,
176
- controller . right . id ,
177
- ( ) => this . moveCursor ( CursorDir . Right )
178
- )
179
- control . onEvent (
180
- ControllerButtonEvent . Pressed ,
181
- controller . up . id ,
182
- ( ) => this . moveCursor ( CursorDir . Up )
183
- )
184
- control . onEvent (
185
- ControllerButtonEvent . Pressed ,
186
- controller . down . id ,
187
- ( ) => this . moveCursor ( CursorDir . Down )
188
- )
189
- control . onEvent (
190
- ControllerButtonEvent . Pressed ,
191
- controller . left . id ,
192
- ( ) => this . moveCursor ( CursorDir . Left )
193
- )
194
-
195
- // click
196
- const click = ( ) => this . cursor . click ( )
197
- control . onEvent (
198
- ControllerButtonEvent . Pressed ,
199
- controller . A . id ,
200
- click
201
- )
202
- control . onEvent (
203
- ControllerButtonEvent . Pressed ,
204
- controller . A . id + keymap . PLAYER_OFFSET ,
205
- click
206
- )
207
- control . onEvent (
208
- ControllerButtonEvent . Pressed ,
209
- controller . B . id ,
210
- ( ) => this . back ( )
211
- )
177
+ /* override */ startup ( controlSetupFn ?: ( ) => { } ) {
178
+ if ( controlSetupFn != null ) {
179
+ controlSetupFn ( ) ;
180
+ } else {
181
+ control . onEvent (
182
+ ControllerButtonEvent . Pressed ,
183
+ controller . right . id ,
184
+ ( ) => this . moveCursor ( CursorDir . Right )
185
+ )
186
+ control . onEvent (
187
+ ControllerButtonEvent . Pressed ,
188
+ controller . up . id ,
189
+ ( ) => this . moveCursor ( CursorDir . Up )
190
+ )
191
+ control . onEvent (
192
+ ControllerButtonEvent . Pressed ,
193
+ controller . down . id ,
194
+ ( ) => this . moveCursor ( CursorDir . Down )
195
+ )
196
+ control . onEvent (
197
+ ControllerButtonEvent . Pressed ,
198
+ controller . left . id ,
199
+ ( ) => this . moveCursor ( CursorDir . Left )
200
+ )
212
201
213
- control . onEvent (
214
- ControllerButtonEvent . Pressed ,
215
- controller . B . id ,
216
- ( ) => this . goBack1PageFn ( )
217
- )
202
+ // click
203
+ const click = ( ) => this . cursor . click ( )
204
+ control . onEvent (
205
+ ControllerButtonEvent . Pressed ,
206
+ controller . A . id ,
207
+ click
208
+ )
209
+ control . onEvent (
210
+ ControllerButtonEvent . Pressed ,
211
+ controller . A . id + keymap . PLAYER_OFFSET ,
212
+ click
213
+ )
214
+ control . onEvent (
215
+ ControllerButtonEvent . Pressed ,
216
+ controller . B . id ,
217
+ ( ) => this . back ( )
218
+ )
218
219
220
+ control . onEvent (
221
+ ControllerButtonEvent . Pressed ,
222
+ controller . B . id ,
223
+ ( ) => this . goBack1PageFn ( )
224
+ )
225
+ }
219
226
this . cursor = new Cursor ( )
220
227
this . picker = new Picker ( this . cursor )
221
228
0 commit comments