Skip to content

Commit efc195f

Browse files
committed
wow this bug is so obvious
1 parent b177f6c commit efc195f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Module/TASHelperSettings.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ internal void OnLoadSettings() {
3131

3232
public void InitializeSettings() {
3333
UpdateAuxiliaryVariable();
34-
Hotkeys = new() { MainSwitchHotkey, CountDownHotkey, LoadRangeHotkey, PixelGridWidthHotkey };
3534
}
3635

3736
private bool enabled = true;
@@ -438,8 +437,7 @@ public ButtonBinding KeyPixelGridWidth {
438437

439438
private Hotkey PixelGridWidthHotkey { get; set; } = new Hotkey(keyPixelGridWidth.Keys, keyPixelGridWidth.Buttons, true, false);
440439

441-
private static List<Hotkey> Hotkeys;
442-
440+
// should not use a List<Hotkey> var, coz changing KeyPixelGridWidth will cause the hotkey get newed
443441
public bool SettingsHotkeysPressed() {
444442
if (Engine.Scene is not Level level) {
445443
return false;
@@ -454,9 +452,10 @@ public bool SettingsHotkeysPressed() {
454452
if (InOuiModOption || (level.Tracker.Entities.TryGetValue(typeof(ButtonConfigUI), out var list3) && list3.Count > 0)) {
455453
updateButton = false;
456454
}
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);
460459
bool changed = false;
461460
if (MainSwitchHotkey.Pressed) {
462461
changed = true;

0 commit comments

Comments
 (0)