Пример #1
0
        private void Redraw()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CurrentPlayer        currentPlayer        = Service.CurrentPlayer;

            UXUtils.HideQualityCards(this, "TroopImage", "TroopImageQ{0}");
            int quality = (int)this.selectedEquipment.Quality;

            base.GetElement <UXElement>(string.Format("TroopImageQ{0}", quality)).Visible = true;
            base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", quality)).Visible = true;
            base.GetElement <UXElement>("TroopImage").Visible = false;
            int quality2 = (int)this.selectedEquipment.Quality;

            base.GetElement <UXLabel>(string.Format("LabelQualityQ{0}", quality2)).Text = LangUtils.GetShardQuality(this.selectedEquipment.Quality);
            UXSprite        element         = base.GetElement <UXSprite>(string.Format("SpriteTroopSelectedItemImageQ{0}", quality2));
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateEquipmentConfig(this.selectedEquipment, element, true);

            projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
            this.equipmentImage            = ProjectorUtils.GenerateProjector(projectorConfig);
            this.SetProgressBarElements(currentPlayer, quality2);
            base.SetupFragmentSprite(quality2);
            base.GetElement <UXLabel>("LabelTroopInfo").Text = this.lang.Get(this.selectedEquipment.EquipmentDescription, new object[0]);
            base.GetElement <UXLabel>(string.Format("LabelQuantityOwnQ{0}", quality2)).Visible = false;
            this.PopulateAvailablePlanetsPanel(staticDataController);
            this.SetUpUpgradeElements(false);
            base.GetElement <UXElement>("MovementSpeed").Visible      = false;
            base.GetElement <UXElement>("Range").Visible              = false;
            base.GetElement <UXElement>("UnitCapacity").Visible       = false;
            base.GetElement <UXElement>("TrainingTime").Visible       = false;
            base.GetElement <UXElement>("TrainingCost").Visible       = false;
            base.GetElement <UXElement>("InfoRow3alt").Visible        = false;
            base.GetElement <UXButton>("BtnFinish").Visible           = false;
            base.GetElement <UXButton>("ButtonPrimaryAction").Visible = false;
            this.DisplayBarsForEquipmentBuffs(staticDataController);
            if (this.forResearchLab)
            {
                this.SetUpResearchLabScreenInfo(staticDataController, currentPlayer);
            }
            else if (this.forArmoryScreen)
            {
                this.SetUpArmoryScreenInfo(currentPlayer);
            }
            else
            {
                base.GetElement <UXButton>("BtnNormal").Visible       = false;
                base.GetElement <UXLabel>("LabelRequirement").Visible = false;
                UXLabel element2 = base.GetElement <UXLabel>("DialogBldgUpgradeTitle");
                this.SetTitleText(element2, "BUILDING_INFO", this.selectedEquipment.EquipmentName, this.selectedEquipment.Lvl);
            }
            for (int i = 0; i < 4; i++)
            {
                this.SetupLeftTableItem(i, null, null);
            }
            string affectedUnit = this.GetAffectedUnit();

            if (affectedUnit != null)
            {
                this.SetupLeftTableItem(0, "EQUIPMENT_INFO_AFFECTED_UNIT", affectedUnit);
            }
            this.SetupLeftTableItem(1, "EQUIPMENT_INFO_CAPACITY", this.selectedEquipment.Size.ToString());
        }
Пример #2
0
        private void UpdateRewardUI(CrateFlyoutItemVO crateFlyoutItemVO)
        {
            StaticDataController           staticDataController           = Service.StaticDataController;
            InventoryCrateRewardController inventoryCrateRewardController = Service.InventoryCrateRewardController;
            string        crateSupplyUid = crateFlyoutItemVO.CrateSupplyUid;
            CrateSupplyVO optional       = staticDataController.GetOptional <CrateSupplyVO>(crateSupplyUid);

            if (optional != null)
            {
                UXUtils.HideQualityCards(this, "RewardItemDefault", "RewardItemCardQ{0}");
                if (optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack)
                {
                    ShardVO optional2 = Service.StaticDataController.GetOptional <ShardVO>(optional.RewardUid);
                    int     quality   = (int)optional2.Quality;
                    base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", quality)).Visible = true;
                }
                else if (optional.Type == SupplyType.Shard)
                {
                    EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(optional.RewardUid);
                    int         quality2 = (int)currentEquipmentDataByID.Quality;
                    base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", quality2)).Visible          = true;
                    base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", quality2)).Visible = true;
                }
                else if (optional.Type == SupplyType.Troop || optional.Type == SupplyType.Hero || optional.Type == SupplyType.SpecialAttack)
                {
                    int upgradeQualityForDeployableUID = Service.DeployableShardUnlockController.GetUpgradeQualityForDeployableUID(optional.RewardUid);
                    if (upgradeQualityForDeployableUID > 0)
                    {
                        base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", upgradeQualityForDeployableUID)).Visible = true;
                    }
                }
                else
                {
                    base.GetElement <UXElement>("RewardItemDefault").Visible = true;
                }
                IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(optional, this.hqLevel);
                if (iconVOFromCrateSupply != null)
                {
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, this.spriteRewardImage, true);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                }
                else
                {
                    Service.Logger.ErrorFormat("CrateInfoModalScreen: Could not generate geometry for crate supply {0}", new object[]
                    {
                        optional.Uid
                    });
                }
                this.labelRewardChance.Text = this.lang.Get(crateFlyoutItemVO.DetailChanceString, new object[0]);
                this.labelRewardName.Text   = this.lang.Get(crateFlyoutItemVO.DetailDescString, new object[0]);
                string[] listIcons = crateFlyoutItemVO.ListIcons;
                if (listIcons != null && listIcons.Length > 0)
                {
                    this.spriteRewardIcon.SpriteName = listIcons[listIcons.Length - 1];
                }
                else
                {
                    this.spriteRewardIcon.Visible = false;
                }
                string detailTypeStringId = crateFlyoutItemVO.DetailTypeStringId;
                if (!string.IsNullOrEmpty(detailTypeStringId))
                {
                    this.labelRewardType.Visible = true;
                    string text = this.lang.Get(detailTypeStringId, new object[0]);
                    this.labelRewardType.Text = text;
                }
                else
                {
                    this.labelRewardType.Visible = false;
                }
                int    rewardAmount   = inventoryCrateRewardController.GetRewardAmount(optional, this.hqLevel);
                string text2          = this.lang.ThousandsSeparated(rewardAmount);
                string quantityString = crateFlyoutItemVO.QuantityString;
                if (!string.IsNullOrEmpty(quantityString))
                {
                    this.labelRewardAmt.Text = this.lang.Get(quantityString, new object[]
                    {
                        text2
                    });
                }
                else if (rewardAmount > 1)
                {
                    this.labelRewardAmt.Text = this.lang.Get("lcfly_quant", new object[]
                    {
                        text2
                    });
                }
                else
                {
                    this.labelRewardAmt.Visible = false;
                }
                UXSprite element  = base.GetElement <UXSprite>("SpriteLockIcon");
                UXSprite element2 = base.GetElement <UXSprite>("SpriteRewardDim");
                UXLabel  element3 = base.GetElement <UXLabel>("LabelEquipmentRequirement");
                element.Visible  = false;
                element2.Visible = false;
                element3.Visible = false;
                bool flag = crateFlyoutItemVO.ReqArmory && !this.playerHasArmory;
                if (flag)
                {
                    element2.Visible = true;
                    element.Visible  = true;
                    element3.Visible = true;
                    element3.Text    = this.lang.Get("EQUIPMENT_ARMORY_REQUIRED", new object[0]);
                }
                this.UpdateRowHighlight(crateFlyoutItemVO.Uid, true);
            }
            else
            {
                Service.Logger.ErrorFormat("CrateInfoModalScreen: Could not find crate supply {0} for crate flyout {1}", new object[]
                {
                    crateSupplyUid,
                    crateFlyoutItemVO.Uid
                });
            }
        }