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 SetResearchMode(TroopUpgradeScreenMode researchMode) { this.researchMode = researchMode; base.GetElement <UXLabel>("LabelSelectTroop").Text = ((researchMode != TroopUpgradeScreenMode.Troops) ? this.lang.Get("UPGRADE_EQUIPMENT", new object[0]) : this.lang.Get("UPGRADE_UPGRADE_TROOPS", new object[0])); this.RefreshFilterTabs(); this.RefreshGrids(); }
protected override void OnScreenLoaded() { if (this.selectedBuilding == null) { base.DestroyScreen(); return; } this.researchMode = TroopUpgradeScreenMode.Troops; base.GetElement <UXLabel>("LabelSelectTroop").Text = this.lang.Get("UPGRADE_UPGRADE_TROOPS", new object[0]); this.troopGrid = base.GetElement <UXGrid>("TroopCapacityGrid"); this.troopGrid.SetTemplateItem("TroopItemTemplate"); this.equipmentGrid = base.GetElement <UXGrid>("EquipmentGrid"); this.equipmentGrid.SetTemplateItem("EquipmentItemTemplate"); this.equipmentGrid.DupeOrdersAllowed = true; this.InitButtons(); this.troopTabButton = base.GetElement <UXCheckbox>("Btn1"); this.troopTabButton.OnSelected = new UXCheckboxSelectedDelegate(this.OnTroopsTabClicked); this.troopTabLabel = base.GetElement <UXLabel>("LabelBtn1"); this.troopTabLabel.Text = this.lang.Get("RESEARCH_LAB_TROOPS_TAB", new object[0]); this.equipmentTabButton = base.GetElement <UXCheckbox>("Btn2"); this.equipmentTabButton.OnSelected = new UXCheckboxSelectedDelegate(this.OnEquipmentTabClicked); this.equipmentTabLabel = base.GetElement <UXLabel>("LabelBtn2"); this.equipmentTabLabel.Text = this.lang.Get("RESEARCH_LAB_EQUIPMENT_TAB", new object[0]); this.equipmentTabButtonDim = base.GetElement <UXButton>("Btn2Dim"); this.equipmentTabButtonDim.OnClicked = new UXButtonClickedDelegate(this.OnEquipmentTabDimClicked); this.equipmentTabLabelDim = base.GetElement <UXLabel>("LabelBtn2Dim"); this.equipmentTabLabelDim.Text = this.lang.Get("RESEARCH_LAB_EQUIPMENT_TAB", new object[0]); if (ArmoryUtils.PlayerHasArmory()) { this.equipmentTabButton.Enabled = true; this.equipmentTabButton.Visible = true; this.equipmentTabButtonDim.Enabled = false; this.equipmentTabButtonDim.Visible = false; } else { this.equipmentTabButton.Enabled = false; this.equipmentTabButton.Visible = false; this.equipmentTabButtonDim.Enabled = true; this.equipmentTabButtonDim.Visible = true; } base.GetElement <UXElement>("ContainerJewel1").Visible = false; base.GetElement <UXLabel>("LabelMessage1").Text = this.lang.Get("RESEARCH_EQUIPMENT_TAB_NEW", new object[0]); ArmoryController armoryController = Service.ArmoryController; bool visible = armoryController.AllowShowEquipmentTabBadge && armoryController.DoesUserHaveAnyUpgradableEquipment(); base.GetElement <UXElement>("ContainerJewel").Visible = visible; base.GetElement <UXLabel>("LabelMessage").Text = this.lang.Get("RESEARCH_EQUIPMENT_TAB_NEW", new object[0]); EventManager eventManager = Service.EventManager; eventManager.RegisterObserver(this, EventId.ContractCompleted); eventManager.RegisterObserver(this, EventId.InventoryUnlockUpdated); this.RefreshFilterTabs(); this.RefreshGrids(); armoryController.AllowShowEquipmentTabBadge = false; Service.DeployableShardUnlockController.AllowResearchBuildingBadging = false; eventManager.SendEvent(EventId.TroopUpgradeScreenOpened, null); }
public void RefreshGrids() { this.equipmentGrid.Clear(); this.troopGrid.Clear(); Service.Engine.ForceGarbageCollection(null); TroopUpgradeScreenMode troopUpgradeScreenMode = this.researchMode; if (troopUpgradeScreenMode != TroopUpgradeScreenMode.Troops) { if (troopUpgradeScreenMode == TroopUpgradeScreenMode.Equipment) { this.PopulateEquipmentGrid(); } } else { this.PopulateTroopGrid(); } }