private void AddNewInventoryLayer(TutorialContextChangedEvent tutorialContextChangedEvent) { try { if (tutorialContextChangedEvent.NewContext == TutorialContexts.InventoryScreen) { if (ScreenManager.TopScreen is InventoryGauntletScreen) { _inventoryScreen = ScreenManager.TopScreen as InventoryGauntletScreen; Inventory = _inventoryScreen.GetField("_dataSource") as SPInventoryVM; _mainLayer = new MainLayer(1000, "GauntletLayer"); _inventoryScreen.AddLayer(_mainLayer); _mainLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); _filterLayer = new FilterLayer(1001, "GauntletLayer"); _inventoryScreen.AddLayer(_filterLayer); _filterLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); } //Temporarily disabled clearing settings file for characters //foreach (CharacterSettings charSettings in SettingsLoader.Instance.CharacterSettings.ToList()) //{ // bool flag = false; // foreach (TroopRosterElement element in EquipBestItemViewModel._inventory.TroopRoster) // { // if (charSettings.Name == element.Character.Name.ToString()) // { // flag = true; // break; // } // } // if (!flag) // { // SettingsLoader.Instance.CharacterSettings.Remove(charSettings); // } //} } else if (tutorialContextChangedEvent.NewContext == TutorialContexts.None) { if (_inventoryScreen != null && _mainLayer != null) { _inventoryScreen.RemoveLayer(this._mainLayer); _mainLayer = null; SettingsLoader.Instance.SaveSettings(); SettingsLoader.Instance.SaveCharacterSettings(); } if (_inventoryScreen != null && _filterLayer != null) { _inventoryScreen.RemoveLayer(_filterLayer); _filterLayer = null; } } } catch (MBException e) { InformationManager.DisplayMessage(new InformationMessage(e.Message)); } }
private void _addPregCtrlClanLayer(TutorialContextChangedEvent tccEvent) { if (tccEvent.NewContext != TutorialContexts.ClanScreen) { return; } GauntletLayer screenGauntletLayer = UIHelper.GetClanScreenGauntletLayer(); if (screenGauntletLayer == null) { return; } this.m_pregContClanVM = new PregnancyControlClanVM(); if (((List <Tuple <GauntletMovie, ViewModel> >)screenGauntletLayer._moviesAndDatasources).FindIndex((Predicate <Tuple <GauntletMovie, ViewModel> >)(obj => string.Equals(obj.Item1.MovieName, this.m_sPregCtrlClanXmlName))) >= 0) { return; } screenGauntletLayer.LoadMovie("PregnancyControlClan", (ViewModel)this.m_pregContClanVM); Utillty.DebugDisplayMessage("_addPregCtrlClanLayer Add Layer Success!"); }
private void _addGauntletLayer(TutorialContextChangedEvent tccEvent) { this._addPregCtrlClanLayer(tccEvent); }
private void AddNewInventoryLayer(TutorialContextChangedEvent tutorialContextChangedEvent) { try { if (tutorialContextChangedEvent.NewContext == TutorialContexts.InventoryScreen) { if (ScreenManager.TopScreen is InventoryGauntletScreen) { EquipBestItemViewModel.InventoryScreen = ScreenManager.TopScreen as InventoryGauntletScreen; _viewModel = new EquipBestItemViewModel(); this._gauntletLayer = new GauntletLayer(1000, "GauntletLayer"); this._gauntletLayer.LoadMovie("EBIInventory", _viewModel); EquipBestItemViewModel.InventoryScreen.AddLayer(this._gauntletLayer); this._gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); _filterLayer = new FilterLayer(1001, "GauntletLayer"); _filterViewModel = new FilterViewModel(); this._gauntletFiltersLayer = new GauntletLayer(1001, "GauntletLayer"); this._gauntletFiltersLayer.LoadMovie("FiltersLayer", _filterViewModel); EquipBestItemViewModel.InventoryScreen.AddLayer(this._filterLayer); this._filterLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); } //Temporarily disabled clearing settings file for characters //foreach (CharacterSettings charSettings in SettingsLoader.Instance.CharacterSettings.ToList()) //{ // bool flag = false; // foreach (TroopRosterElement element in EquipBestItemViewModel._inventory.TroopRoster) // { // if (charSettings.Name == element.Character.Name.ToString()) // { // flag = true; // break; // } // } // if (!flag) // { // SettingsLoader.Instance.CharacterSettings.Remove(charSettings); // } //} } else { if (tutorialContextChangedEvent.NewContext == TutorialContexts.None) { if (EquipBestItemViewModel.InventoryScreen != null && this._gauntletLayer != null) { EquipBestItemViewModel.InventoryScreen.RemoveLayer(this._gauntletLayer); this._gauntletLayer = null; SettingsLoader.Instance.SaveSettings(); SettingsLoader.Instance.SaveCharacterSettings(); } if (EquipBestItemViewModel.InventoryScreen != null && this._filterLayer != null) { EquipBestItemViewModel.InventoryScreen.RemoveLayer(this._filterLayer); this._filterLayer = null; } } } } catch (Exception e) { MessageBox.Show(e.Message); } }