@@ -31,7 +31,6 @@ internal void OnLoadSettings() {
31
31
32
32
public void InitializeSettings ( ) {
33
33
UpdateAuxiliaryVariable ( ) ;
34
- Hotkeys = new ( ) { MainSwitchHotkey , CountDownHotkey , LoadRangeHotkey , PixelGridWidthHotkey } ;
35
34
}
36
35
37
36
private bool enabled = true ;
@@ -438,8 +437,7 @@ public ButtonBinding KeyPixelGridWidth {
438
437
439
438
private Hotkey PixelGridWidthHotkey { get ; set ; } = new Hotkey ( keyPixelGridWidth . Keys , keyPixelGridWidth . Buttons , true , false ) ;
440
439
441
- private static List < Hotkey > Hotkeys ;
442
-
440
+ // should not use a List<Hotkey> var, coz changing KeyPixelGridWidth will cause the hotkey get newed
443
441
public bool SettingsHotkeysPressed ( ) {
444
442
if ( Engine . Scene is not Level level ) {
445
443
return false ;
@@ -454,9 +452,10 @@ public bool SettingsHotkeysPressed() {
454
452
if ( InOuiModOption || ( level . Tracker . Entities . TryGetValue ( typeof ( ButtonConfigUI ) , out var list3 ) && list3 . Count > 0 ) ) {
455
453
updateButton = false ;
456
454
}
457
- foreach ( Hotkey hotkey in Hotkeys ) {
458
- hotkey . Update ( updateKey , updateButton ) ;
459
- }
455
+ MainSwitchHotkey . Update ( updateKey , updateButton ) ;
456
+ CountDownHotkey . Update ( updateKey , updateButton ) ;
457
+ LoadRangeHotkey . Update ( updateKey , updateButton ) ;
458
+ PixelGridWidthHotkey . Update ( updateKey , updateButton ) ;
460
459
bool changed = false ;
461
460
if ( MainSwitchHotkey . Pressed ) {
462
461
changed = true ;
0 commit comments