@@ -9,9 +9,7 @@ class KeybindsOptions extends MusicBeatSubstate {
99 public static var instance : KeybindsOptions ;
1010
1111 public function translate (id : String , ? args : Array <Dynamic >)
12- return TU .translate (" KeybindsOptions." + id , args );
13-
14- public var categories : Array <ControlsCategory > = [];
12+ return TU .translate (id , args );
1513
1614 public var settingCam : FlxCamera ;
1715
@@ -29,130 +27,131 @@ class KeybindsOptions extends MusicBeatSubstate {
2927 ];
3028 public var camFollow : FlxObject = new FlxObject (0 , 0 , 2 , 2 );
3129
32- var isSubState : Bool = false ;
33-
34- public override function create () {
35- categories = [
36- {
37- name : translate (" category.notes" ),
38- settings : [
39- {
40- sparrowIcon : " game/notes/default" ,
41- sparrowAnim : " purple0" ,
42- name : translate (" left" ),
43- control : ' NOTE_LEFT'
44- },
45- {
46- sparrowIcon : " game/notes/default" ,
47- sparrowAnim : " blue0" ,
48- name : translate (" down" ),
49- control : ' NOTE_DOWN'
50- },
51- {
52- sparrowIcon : " game/notes/default" ,
53- sparrowAnim : " green0" ,
54- name : translate (" up" ),
55- control : ' NOTE_UP'
56- },
57- {
58- sparrowIcon : " game/notes/default" ,
59- sparrowAnim : " red0" ,
60- name : translate (" right" ),
61- control : ' NOTE_RIGHT'
62- },
63- ]
64- },
65- {
66- name : translate (" category.ui" ),
67- settings : [
68- {
69- name : translate (" left" ),
70- control : ' LEFT'
71- },
72- {
73- name : translate (" down" ),
74- control : ' DOWN'
75- },
76- {
77- name : translate (" up" ),
78- control : ' UP'
79- },
80- {
81- name : translate (" right" ),
82- control : ' RIGHT'
83- },
84- {
85- name : translate (" ui.accept" ),
86- control : ' ACCEPT'
87- },
88- {
89- name : translate (" ui.back" ),
90- control : ' BACK'
91- },
92- {
93- name : translate (" ui.reset" ),
94- control : ' RESET'
95- },
96- {
97- name : translate (" ui.pause" ),
98- control : ' PAUSE'
99- },
100- {
101- name : translate (" ui.changeMode" ),
102- control : ' CHANGE_MODE'
103- },
104- ]
105- },
30+ public var categories : Array <ControlsCategory > = [];
31+ public static var defaultCategories : Array <ControlsCategory > = [
32+ {
33+ name : " category.notes" ,
34+ settings : [
35+ {
36+ sparrowIcon : " game/notes/default" ,
37+ sparrowAnim : " purple0" ,
38+ name : " left" ,
39+ control : ' NOTE_LEFT'
40+ },
41+ {
42+ sparrowIcon : " game/notes/default" ,
43+ sparrowAnim : " blue0" ,
44+ name : " down" ,
45+ control : ' NOTE_DOWN'
46+ },
47+ {
48+ sparrowIcon : " game/notes/default" ,
49+ sparrowAnim : " green0" ,
50+ name : " up" ,
51+ control : ' NOTE_UP'
52+ },
53+ {
54+ sparrowIcon : " game/notes/default" ,
55+ sparrowAnim : " red0" ,
56+ name : " right" ,
57+ control : ' NOTE_RIGHT'
58+ },
59+ ]
60+ },
61+ {
62+ name : " category.ui" ,
63+ settings : [
64+ {
65+ name : " left" ,
66+ control : ' LEFT'
67+ },
68+ {
69+ name : " down" ,
70+ control : ' DOWN'
71+ },
72+ {
73+ name : " up" ,
74+ control : ' UP'
75+ },
76+ {
77+ name : " right" ,
78+ control : ' RIGHT'
79+ },
80+ {
81+ name : " ui.accept" ,
82+ control : ' ACCEPT'
83+ },
84+ {
85+ name : " ui.back" ,
86+ control : ' BACK'
87+ },
88+ {
89+ name : " ui.reset" ,
90+ control : ' RESET'
91+ },
92+ {
93+ name : " ui.pause" ,
94+ control : ' PAUSE'
95+ },
96+ {
97+ name : " ui.changeMode" ,
98+ control : ' CHANGE_MODE'
99+ },
100+ ]
101+ },
106102 {
107- name : translate ( " category.volume" ) ,
103+ name : " category.volume" ,
108104 settings : [
109105 {
110- name : translate ( " volume.up" ) ,
106+ name : " volume.up" ,
111107 control : ' VOLUME_UP'
112108 },
113109 {
114- name : translate ( " volume.down" ) ,
110+ name : " volume.down" ,
115111 control : ' VOLUME_DOWN'
116112 },
117113 {
118- name : translate ( " volume.mute" ) ,
114+ name : " volume.mute" ,
119115 control : ' VOLUME_MUTE'
120116 },
121117 ]
122118 },
123- {
124- name : translate (" category.engine" ),
125- settings : [
126- {
127- name : translate (" engine.switchMod" ),
128- control : ' SWITCHMOD'
129- },
130- {
131- name : translate (" engine.fpsCounter" ),
132- control : ' FPS_COUNTER'
133- },
134- ]
135- },
136- {
137- name : translate (" category.developer" ),
138- devModeOnly : true ,
139- settings : [
140- {
141- name : translate (" developer.devMenus" ),
142- control : ' DEV_ACCESS'
143- },
144- {
145- name : translate (" developer.openConsole" ),
146- control : ' DEV_CONSOLE'
147- },
148- {
149- name : translate (" developer.reloadState" ),
150- control : ' DEV_RELOAD'
151- },
152- ]
153- }
154- ];
119+ {
120+ name : " category.engine" ,
121+ settings : [
122+ {
123+ name : " engine.switchMod" ,
124+ control : ' SWITCHMOD'
125+ },
126+ {
127+ name : " engine.fpsCounter" ,
128+ control : ' FPS_COUNTER'
129+ },
130+ ]
131+ },
132+ {
133+ name : " category.developer" ,
134+ devModeOnly : true ,
135+ settings : [
136+ {
137+ name : " developer.devMenus" ,
138+ control : ' DEV_ACCESS'
139+ },
140+ {
141+ name : " developer.openConsole" ,
142+ control : ' DEV_CONSOLE'
143+ },
144+ {
145+ name : " developer.reloadState" ,
146+ control : ' DEV_RELOAD'
147+ },
148+ ]
149+ }
150+ ];
151+
152+ public var isSubState : Bool = false ;
155153
154+ public override function create () {
156155 super .create ();
157156 instance = this ;
158157
@@ -184,6 +183,8 @@ class KeybindsOptions extends MusicBeatSubstate {
184183 FlxG .camera .follow (camFollow , LOCKON , 0.125 );
185184 }
186185
186+ for (category in defaultCategories ) categories .push (category );
187+
187188 var customCategories = loadCustomCategories ();
188189 for (i in customCategories ) categories .push (i );
189190
@@ -192,7 +193,11 @@ class KeybindsOptions extends MusicBeatSubstate {
192193 if (category .devModeOnly && ! Options .devMode ) continue ;
193194
194195 k ++ ;
195- var title = new Alphabet (0 , k * 75 , category .name , " bold" );
196+ var translationPrefix : String = (category .custom != null ) ? ' ' : ' KeybindsOptions.' ;
197+
198+ var categoryToTranslate : String = translationPrefix + category .name ;
199+ var translatedCategory : String = TU .exists (categoryToTranslate ) ? translate (categoryToTranslate ) : category .name ;
200+ var title = new Alphabet (0 , k * 75 , translatedCategory , " bold" );
196201 title .screenCenter (X );
197202 add (title );
198203
@@ -203,7 +208,9 @@ class KeybindsOptions extends MusicBeatSubstate {
203208 if (e .sparrowIcon != null ) sparrowIcon = e .sparrowIcon ;
204209 if (e .sparrowAnim != null ) sparrowAnim = e .sparrowAnim ;
205210
206- var text = new KeybindSetting (100 , k * 75 , e .name , e .control , sparrowIcon , sparrowAnim , e .custom == null ? false : e .custom );
211+ var nameToTranslate : String = translationPrefix + e .name ;
212+ var translatedName : String = TU .exists (nameToTranslate ) ? translate (nameToTranslate ) : e .name ;
213+ var text = new KeybindSetting (100 , k * 75 , translatedName , e .control , sparrowIcon , sparrowAnim , e .custom == null ? false : e .custom );
207214 if (! isSubState )
208215 text .bind1 .color = text .bind2 .color = FlxColor .BLACK ;
209216 alphabets .add (text );
@@ -322,6 +329,7 @@ class KeybindsOptions extends MusicBeatSubstate {
322329
323330 var cat : ControlsCategory = {
324331 name : category .getAtt (" name" ),
332+ custom : true ,
325333 settings : []
326334 };
327335
@@ -358,4 +366,5 @@ typedef ControlsCategory = {
358366 var name : String ;
359367 var settings : Array <KeybindSettingData >;
360368 var ? devModeOnly : Bool ;
369+ var ? custom : Bool ;
361370}
0 commit comments