private static void Postfix(OptionsGauntletScreen __instance) { __instance.RemoveLayer(__instance.Layers.FirstOrDefault()); SpriteData spriteData = UIResourceManager.SpriteData; TwoDimensionEngineResourceContext resourceContext = UIResourceManager.ResourceContext; ResourceDepot uiresourceDepot = UIResourceManager.UIResourceDepot; var _spriteCategory = spriteData.SpriteCategories["ui_options"]; _spriteCategory.Load(resourceContext, uiresourceDepot); OptionsWithModsViewModel _dataSource = new OptionsWithModsViewModel(true, false, (requestedHotKeyToChange) => { Set(__instance, "_currentGameKey", requestedHotKeyToChange); ((KeybindingPopup)Get(__instance, "_keybindingPopup")).OnToggle(true); }, null); GauntletLayer _gauntletLayer = new GauntletLayer(4000, "GauntletLayer"); GauntletMovie _gauntletMovie = _gauntletLayer.LoadMovie("Options", _dataSource); _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory")); _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); _gauntletLayer.IsFocusLayer = true; KeybindingPopup _keybindingPopup = new KeybindingPopup(new Action <Key>((key) => { GameKeyOptionVM _currentGameKey = Get(__instance, "_currentGameKey") as GameKeyOptionVM; KeybindingPopup _keybindingPopupinner = Get(__instance, "_keybindingPopup") as KeybindingPopup; if (_dataSource.GameKeyOptionGroups.Groups.First((GameKeyGroupVM g) => g.GameKeys.Contains(_currentGameKey)).GameKeys.Any((GameKeyOptionVM k) => k.CurrentKey.InputKey == key.InputKey)) { InformationManager.AddQuickInformation(new TextObject("{=n4UUrd1p}Already in use", null), 0, null, ""); return; } if (_gauntletLayer.Input.IsHotKeyReleased("Exit")) { _keybindingPopupinner.OnToggle(false); return; } GameKeyOptionVM currentGameKey = _currentGameKey; if (currentGameKey != null) { currentGameKey.Set(key.InputKey); } _currentGameKey = null; _keybindingPopupinner.OnToggle(false); }), __instance); __instance.AddLayer(_gauntletLayer); ScreenManager.TrySetFocus(_gauntletLayer); Set(__instance, "_spriteCategory", _spriteCategory); Set(__instance, "_dataSource", _dataSource); Set(__instance, "_gauntletLayer", _gauntletLayer); Set(__instance, "_gauntletMovie", _gauntletMovie); Set(__instance, "_keybindingPopup", _keybindingPopup); }
private void SetHotKey(Key key) { var currentGameKey = _currentGameKey; if (currentGameKey != null) { currentGameKey.Set(key.InputKey); } _currentGameKey = null !; _keybindingPopup.OnToggle(false); }
private void SetHotKey(Key key) { //if (_dataSource.Groups.First<GameKeyGroupVM>((g => g.GameKeys.Contains(this._currentGameKey))).GameKeys.Any<GameKeyOptionVM>(keyVM => keyVM.CurrentKey.InputKey == key.InputKey)) // InformationManager.AddQuickInformation(new TextObject("{=n4UUrd1p}Already in use")); /*else*/ if (_gauntletLayer.Input.IsHotKeyReleased("Exit")) { _currentGameKey = null; _keybindingPopup.OnToggle(false); } else { _currentGameKey?.Set(key.InputKey); _currentGameKey = null; _keybindingPopup.OnToggle(false); } }
private void SetHotKey(Key key) { if (_dataSource.GameKeyOptionGroups.Groups.First(g => g.GameKeys.Contains(_currentGameKey)).GameKeys.Any(k => k.CurrentKey.InputKey == key.InputKey)) { InformationManager.AddQuickInformation(new TextObject("{=n4UUrd1p}Already in use", null), 0, null, ""); return; } if (_gauntletLayer.Input.IsHotKeyReleased("Exit")) { _keybindingPopup.OnToggle(false); return; } var currentGameKey = _currentGameKey; if (currentGameKey != null) { currentGameKey.Set(key.InputKey); } _currentGameKey = null !; _keybindingPopup.OnToggle(false); }
private void OnKeybindRequest(GameKeyOptionVM requestedHotKeyToChange) { _currentGameKey = requestedHotKeyToChange; _keybindingPopup.OnToggle(true); }
private void SetGameKey(GameKeyOptionVM option, InputKey newKey) { option.CurrentKey.ChangeKey(newKey); option.OptionValueText = Module.CurrentModule.GlobalTextManager.FindText("str_game_key_text", option.CurrentKey.ToString().ToLower()).ToString(); _setAllKeysOfId(_categoryId, option.CurrentGameKey.Id, newKey); }
private void OnKeyBindRequest(GameKeyOptionVM requestedHotKeyToChange) { _currentGameKey = requestedHotKeyToChange; _enableKeyBindingPopupNextTick = true; }