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 void Deactivate() { _gauntletLayer.InputRestrictions.ResetInputRestrictions(); MissionScreen.RemoveLayer(_gauntletLayer); _gauntletLayer = null; _dataSource.OnFinalize(); _dataSource = null; }
public override void OnMissionScreenFinalize() { base.OnMissionScreenFinalize(); MissionScreen.RemoveLayer(_layer); _dataSource.OnFinalize(); _layer = null; Mission.Current.Boundaries.CollectionChanged -= BoundariesOnCollectionChanged; Game.Current.EventManager.UnregisterEvent <MissionPlayerToggledOrderViewEvent>(OnOrderViewToggled); }
public override void OnMissionScreenFinalize() { base.OnMissionScreenFinalize(); if (null != _showControlHintLayer) { MissionScreen.RemoveLayer(_showControlHintLayer); } _showControlHintLayer = null; textHandler = null; }
protected void OnCloseMenu() { IsActivated = false; _dataSource.OnFinalize(); _dataSource = null; GauntletLayer.InputRestrictions.ResetInputRestrictions(); MissionScreen.RemoveLayer(GauntletLayer); _movie = null; GauntletLayer = null; UnpauseGame(); }