private void SetFilterToEquipment() { Dictionary <int, string> dictionary = new Dictionary <int, string>(); IEnumerator enumerator = Enum.GetValues(typeof(EquipmentTab)).GetEnumerator(); try { while (enumerator.MoveNext()) { EquipmentTab key = (EquipmentTab)enumerator.Current; string text = key.ToString(); StringBuilder stringBuilder = new StringBuilder("EQUIPMENT_TAB_"); stringBuilder.Append(text.ToUpper()); dictionary.Add((int)key, this.lang.Get(stringBuilder.ToString(), new object[0])); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } this.filterHelper = new EquipmentTabHelper(); this.filterHelper.CreateTabs(this, new Action(this.RefreshGrids), dictionary, 0); }
private void RefreshFilterTabs() { if (this.filterHelper != null) { this.filterHelper.Destroy(); this.filterHelper = null; } this.troopTabLabel.TextColor = UXUtils.COLOR_NAV_TAB_DISABLED; this.equipmentTabLabel.TextColor = UXUtils.COLOR_NAV_TAB_DISABLED; TroopUpgradeScreenMode troopUpgradeScreenMode = this.researchMode; if (troopUpgradeScreenMode != TroopUpgradeScreenMode.Troops) { if (troopUpgradeScreenMode == TroopUpgradeScreenMode.Equipment) { this.equipmentTabLabel.TextColor = UXUtils.COLOR_NAV_TAB_ENABLED; this.SetFilterToEquipment(); } } else { this.troopTabLabel.TextColor = UXUtils.COLOR_NAV_TAB_ENABLED; this.SetFilterToTroops(); } }
private void SetFilterToTroops() { Dictionary <TroopTab, string> dictionary = new Dictionary <TroopTab, string>(); dictionary.Add(TroopTab.All, this.lang.Get("TROOP_TAB_ALL", new object[0])); if (this.eligibleTroopTypes.Contains(TroopType.Hero)) { dictionary.Add(TroopTab.Hero, this.lang.Get("TROOP_TAB_HEROES", new object[0])); } if (this.eligibleTroopTypes.Contains(TroopType.Infantry)) { dictionary.Add(TroopTab.Infantry, this.lang.Get("TROOP_TAB_INFANTRY", new object[0])); } if (this.eligibleTroopTypes.Contains(TroopType.Vehicle)) { dictionary.Add(TroopTab.Vehicle, this.lang.Get("TROOP_TAB_VEHICLES", new object[0])); } if (this.hasStarships) { dictionary.Add(TroopTab.Starship, this.lang.Get("TROOP_TAB_STARSHIPS", new object[0])); } if (this.eligibleTroopTypes.Contains(TroopType.Mercenary)) { dictionary.Add(TroopTab.Mercenary, this.lang.Get("TROOP_TAB_MERCENARIES", new object[0])); } this.filterHelper = new TroopTabHelper(); Dictionary <int, string> dictionary2 = new Dictionary <int, string>(); foreach (KeyValuePair <TroopTab, string> current in dictionary) { dictionary2[(int)current.Key] = current.Value; } this.filterHelper.CreateTabs(this, new Action(this.RefreshGrids), dictionary2, 0); }
public override void OnDestroyElement() { Service.EventManager.UnregisterObserver(this, EventId.ContractCompleted); Service.EventManager.UnregisterObserver(this, EventId.InventoryUnlockUpdated); this.DisableTimers(); if (this.troopGrid != null) { this.troopGrid.Clear(); this.troopGrid = null; } if (this.equipmentGrid != null) { this.equipmentGrid.Clear(); this.equipmentGrid = null; } if (this.filterHelper != null) { this.filterHelper.Destroy(); this.filterHelper = null; } this.eligibleDeployables.Clear(); this.eligibleDeployables = null; this.eligibleTroopTypes.Clear(); this.eligibleTroopTypes = null; this.activeContract = null; base.OnDestroyElement(); }