public override void OnMissionScreenFinalize() { base.OnMissionScreenFinalize(); _keybindingPopup.OnToggle(false); _keybindingPopup = null; }
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); }
public override void OnMissionScreenFinalize() { Mission.GetMissionBehaviour <MissionOptionsComponent>().OnOptionsAdded -= OnShowOptions; base.OnMissionScreenFinalize(); _dataSource?.OnFinalize(); _dataSource = null !; _movie?.Release(); // TODO _movie = null !; _keybindingPopup?.OnToggle(false); _keybindingPopup = null !; _gauntletLayer = null !; _spriteCategoryOptions?.Unload(); // TODO: There was a report that the encyclopedia UI is bugged //_spriteCategoryEncyclopedia?.Unload(); }
private void OnKeybindRequest(GameKeyOptionVM requestedHotKeyToChange) { _currentGameKey = requestedHotKeyToChange; _keybindingPopup.OnToggle(true); }