private void OnEscapeMenuToggled(bool isOpened) { if (isOpened) { if (!GameNetwork.IsMultiplayer) { MBCommon.PauseGameEngine(); } } else { MBCommon.UnPauseGameEngine(); } if (isOpened) { _dataSource = new OptionsModOptionsViewModel(new OptionsVM(GameNetwork.IsMultiplayer, OnCloseOptions, OnKeybindRequest), new ModOptionsVM()); _gauntletLayer = new GauntletLayer(ViewOrderPriorty, "GauntletLayer"); _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory")); _movie = _gauntletLayer.LoadMovie("OptionsWithModOptionsView_v3", _dataSource); MissionScreen.AddLayer(_gauntletLayer); _gauntletLayer.IsFocusLayer = true; ScreenManager.TrySetFocus(_gauntletLayer); return; } _gauntletLayer.InputRestrictions.ResetInputRestrictions(); _gauntletLayer.IsFocusLayer = false; ScreenManager.TryLoseFocus(_gauntletLayer); MissionScreen.RemoveLayer(_gauntletLayer); _keybindingPopup?.OnToggle(false); _gauntletLayer = null !; _dataSource?.OnFinalize(); _dataSource = null !; _gauntletLayer = null !; }
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); }