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(); }
protected override void OnFinalize() { base.OnFinalize(); _spriteCategoryOptions?.Unload(); // TODO: There was a report that the encyclopedia UI is bugged //_spriteCategoryEncyclopedia?.Unload(); if (_gauntletLayer != null) { RemoveLayer(_gauntletLayer); } _gauntletLayer?.ReleaseMovie(_gauntletMovie); _gauntletLayer = null !; _gauntletMovie = null !; _dataSource?.ModOptions?.ExecuteSelect(null); _dataSource = null !; Utilities.SetForceVsync(false); _keybindingPopup = null !; }
protected override void OnInitialize() { base.OnInitialize(); var spriteData = UIResourceManager.SpriteData; var resourceContext = UIResourceManager.ResourceContext; var uiresourceDepot = UIResourceManager.UIResourceDepot; _spriteCategoryOptions = spriteData.SpriteCategories["ui_options"]; _spriteCategoryOptions.Load(resourceContext, uiresourceDepot); _spriteCategoryEncyclopedia = spriteData.SpriteCategories["ui_encyclopedia"]; _spriteCategoryEncyclopedia.Load(resourceContext, uiresourceDepot); _dataSource = new OptionsModOptionsViewModel(new OptionsVM(true, false, OnKeybindRequest), new ModOptionsVM()); _gauntletLayer = new GauntletLayer(4000, "GauntletLayer"); _gauntletMovie = _gauntletLayer.LoadMovie("OptionsWithModOptionsView_v3", _dataSource); _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory")); _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); _gauntletLayer.IsFocusLayer = true; _keybindingPopup = new KeybindingPopup(SetHotKey, this); AddLayer(_gauntletLayer); ScreenManager.TrySetFocus(_gauntletLayer); Utilities.SetForceVsync(true); }
protected override void OnInitialize() { base.OnInitialize(); _spriteCategory = UIResourceManager.SpriteData.SpriteCategories["ui_options"]; _spriteCategory.Load(UIResourceManager.ResourceContext, UIResourceManager.UIResourceDepot); _optionsVm = new OptionsVM(true, false, OnKeyBindRequest); _dataSource = new CustomOptionsViewModel(_optionsVm) { ModOptions = new CustomOptionCategoryViewModel(_optionsVm, "ModOptions".Localized(), OptionsStore.GetRegisteredForGui() .SelectMany(store => GenerateOptionDataViewModels(store.GetKnownOptions()))) }; _gauntletLayer = new GauntletLayer(4000); _gauntletMovie = _gauntletLayer.LoadMovie("CustomOptions", _dataSource); _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory")); _gauntletLayer.InputRestrictions.SetInputRestrictions(); _gauntletLayer.IsFocusLayer = true; _keyBindingPopup = new KeybindingPopup(SetHotKey, this); AddLayer(_gauntletLayer); ScreenManager.TrySetFocus(_gauntletLayer); }
public override void OnMissionScreenInitialize() { base.OnMissionScreenInitialize(); Mission.GetMissionBehaviour <MissionOptionsComponent>().OnOptionsAdded += OnShowOptions; _keybindingPopup = new KeybindingPopup(SetHotKey, MissionScreen); }
public override void OnMissionScreenInitialize() { base.OnMissionScreenInitialize(); _keybindingPopup = new KeybindingPopup(SetHotKey, MissionScreen); }