예제 #1
0
        private void SetupItemGrid()
        {
            this.itemGrid = base.GetElement <UXGrid>("UnlockItemsGrid");
            this.itemGrid.SetTemplateItem("UnlockItemsTemplate");
            BuildingLookupController         buildingLookupController = Service.BuildingLookupController;
            Dictionary <BuildingTypeVO, int> buildingsUnlockedBy      = buildingLookupController.GetBuildingsUnlockedBy(this.headQuarter);
            int num = 0;

            foreach (KeyValuePair <BuildingTypeVO, int> current in buildingsUnlockedBy)
            {
                BuildingTypeVO key   = current.Key;
                int            value = current.Value;
                if (key.Type == BuildingType.Turret && key.BuildingRequirement != this.headQuarter.Uid)
                {
                    if (num == 0)
                    {
                        num = value;
                    }
                }
                else
                {
                    string          uid             = key.Uid;
                    UXElement       item            = this.itemGrid.CloneTemplateItem(uid);
                    UXSprite        subElement      = this.itemGrid.GetSubElement <UXSprite>(uid, "SpriteItemImage");
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(key, subElement);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                    UXLabel subElement2 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelUnlockCount");
                    if (key.Type == BuildingType.Turret)
                    {
                        subElement2.Visible = false;
                    }
                    else
                    {
                        subElement2.Text = this.lang.Get("TROOP_MULTIPLIER", new object[]
                        {
                            value
                        });
                    }
                    this.itemGrid.AddItem(item, key.Order);
                }
            }
            UXElement item2       = this.itemGrid.CloneTemplateItem("TURRETS");
            UXSprite  subElement3 = this.itemGrid.GetSubElement <UXSprite>("TURRETS", "SpriteItemImage");

            subElement3.Visible = false;
            UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>("TURRETS", "LabelUnlockCount");

            subElement4.Visible = false;
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>("TURRETS", "LabelTurrets");

            subElement5.Visible = true;
            subElement5.Text    = this.lang.Get("HQ_UPGRADE_TURRETS_UNLOCKED", new object[]
            {
                num
            });
            this.itemGrid.AddItem(item2, 99999999);
            this.itemGrid.RepositionItems();
            this.itemGrid.Scroll((this.itemGrid.Count <= 7) ? 0.5f : 0f);
        }
예제 #2
0
        protected void AddTroopItem(IUpgradeableVO troop, int troopCount, string tooltipText)
        {
            TroopUpgradeTag troopUpgradeTag = new TroopUpgradeTag(troop as IDeployableVO, true);

            this.troopList.Add(troopUpgradeTag);
            string    uid        = troop.Uid;
            UXElement item       = this.storageItemGrid.CloneTemplateItem(uid);
            UXLabel   subElement = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelStorageCount");

            subElement.Text = LangUtils.GetMultiplierText(troopCount);
            UXSprite        subElement2 = this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteStorageItemImageTroops");
            ProjectorConfig config      = ProjectorUtils.GenerateGeometryConfig(troop as IDeployableVO, subElement2);

            Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, config, Service.CurrentPlayer.ActiveArmory));
            ProjectorUtils.GenerateProjector(config);
            UXLabel subElement3 = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelTroopLevel");

            subElement3.Text = LangUtils.GetLevelText(troop.Lvl);
            UXElement subElement4 = this.storageItemGrid.GetSubElement <UXElement>(uid, "BtnRequestTroops");

            subElement4.Visible = false;
            UXButton subElement5 = this.storageItemGrid.GetSubElement <UXButton>(uid, "StorageItemsCard");

            if (tooltipText != null)
            {
                this.troopTooltipHelper.RegisterButtonTooltip(subElement5, tooltipText);
            }
            else
            {
                subElement5.Tag       = troopUpgradeTag;
                subElement5.OnClicked = new UXButtonClickedDelegate(this.OnTroopItemClicked);
            }
            this.storageItemGrid.AddItem(item, troop.Order);
        }
        private void SetupShardRewardItemElements(string itemUID, CrateSupplyVO crateSupply)
        {
            ShardVO shardVO = Service.Get <IDataController>().Get <ShardVO>(crateSupply.RewardUid);
            int     quality = (int)shardVO.Quality;
            string  name    = string.Format("SpriteTroopImageBkgGridQ{0}", new object[]
            {
                quality
            });

            this.rewardsGrid.GetSubElement <UXElement>(itemUID, name).Visible = false;
            UXSprite subElement = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteIconFragmentLootTable");

            UXUtils.SetupFragmentIconSprite(subElement, quality);
            UXSprite      subElement2           = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItemImage");
            IDeployableVO deployableVOFromShard = Service.Get <DeployableShardUnlockController>().GetDeployableVOFromShard(shardVO);

            if (deployableVOFromShard == null)
            {
                Service.Get <StaRTSLogger>().Error("SetupShardRewardItemElements Unable to find deployable");
                return;
            }
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(deployableVOFromShard, subElement2, true);

            projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
            GeometryProjector item = ProjectorUtils.GenerateProjector(projectorConfig);

            this.projectors.Add(item);
            this.SetupDeployableShardProgress(itemUID, shardVO);
            UXUtils.SetCardQuality(this, this.rewardsGrid, itemUID, quality, "RewardItemCardQ{0}");
        }
예제 #4
0
        public static void SetRewardIcon(UXSprite sprite, IGeometryVO config, AnimationPreference animPreference = AnimationPreference.NoAnimation)
        {
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(config, sprite);

            projectorConfig.AnimPreference = animPreference;
            ProjectorUtils.GenerateProjector(projectorConfig);
        }
예제 #5
0
        private void InitCrateProjector(UXSprite sprite, CrateVO crateVO)
        {
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(crateVO, sprite);

            projectorConfig.AnimState = AnimState.Closed;
            ProjectorUtils.GenerateProjector(projectorConfig);
        }
예제 #6
0
        private void ProcessSkin(GeometryTag cookie)
        {
            if (!(cookie.geometry is TroopTypeVO))
            {
                return;
            }
            TroopTypeVO     troop         = cookie.geometry as TroopTypeVO;
            ProjectorConfig projector     = cookie.projector;
            TeamType        team          = TeamType.Attacker;
            CurrentBattle   currentBattle = Service.BattleController.GetCurrentBattle();

            if (currentBattle != null && !string.IsNullOrEmpty(currentBattle.MissionId))
            {
                CampaignMissionVO campaignMissionVO = Service.StaticDataController.Get <CampaignMissionVO>(currentBattle.MissionId);
                if (campaignMissionVO != null && campaignMissionVO.IsRaidDefense())
                {
                    team = TeamType.Defender;
                }
            }
            SkinTypeVO applicableSkin = this.GetApplicableSkin(troop, cookie.armory, cookie.battle, team);

            if (applicableSkin != null)
            {
                ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(applicableSkin, projector.FrameSprite, projector.closeup);
                projector.MakeEquivalentTo(config);
            }
        }
예제 #7
0
        protected override void OnScreenLoaded()
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();

            Service.Get <UXController>().HUD.Visible = false;
            this.InitButtons();
            this.SetUIText();
            this.LoadFx();
            UXSprite       element        = base.GetElement <UXSprite>("SpriteInstructions");
            BuildingTypeVO buildingTypeVO = null;

            if (this.isSpecialAttack)
            {
                if (buildingLookupController.HasStarshipCommand())
                {
                    FleetCommandNode head = buildingLookupController.FleetCommandNodeList.Head;
                    buildingTypeVO = head.BuildingComp.BuildingType;
                }
            }
            else
            {
                buildingTypeVO = buildingLookupController.GetHighestAvailableBuildingVOForTroop((TroopTypeVO)this.subjectVO);
            }
            if (buildingTypeVO != null)
            {
                ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(buildingTypeVO, element, false);
                projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                ProjectorUtils.GenerateProjector(projectorConfig);
            }
            else
            {
                element.Visible = false;
            }
            this.fadingOutSubject = false;
        }
예제 #8
0
 public static void SetupGeometryForIcon(UXSprite itemIconSprite, ProjectorConfig config)
 {
     itemIconSprite.SpriteName = "bkgClear";
     config.AnimPreference     = AnimationPreference.NoAnimation;
     ProjectorUtils.GenerateProjector(config);
     itemIconSprite.GetUIWidget.enabled = false;
 }
예제 #9
0
        private bool AddTroopItem(KeyValuePair <string, InventoryEntry> unit, TroopTypeVO troop)
        {
            string   itemUid  = "troop_" + troop.Uid;
            UXButton uXButton = this.troopDonateGrid.CloneItem(itemUid, this.troopTemplateItem) as UXButton;

            uXButton.Tag       = unit;
            uXButton.OnClicked = new UXButtonClickedDelegate(this.OnTroopToDonateClicked);
            UXLabel subElement = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelDonateTroops");

            subElement.Text = string.Format("x{0}", unit.Value.Amount);
            UXLabel subElement2 = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelTroopLevel");

            subElement2.Text = LangUtils.GetLevelText(troop.Lvl);
            UXElement subElement3 = this.troopDonateGrid.GetSubElement <UXElement>(itemUid, "WidgetTroopsCardBgDefault");
            UXElement subElement4 = this.troopDonateGrid.GetSubElement <UXElement>(itemUid, "WidgetTroopsCardBgQ10");

            if (string.IsNullOrEmpty(troop.UpgradeShardUid))
            {
                subElement3.Visible = true;
                subElement4.Visible = false;
            }
            else
            {
                subElement3.Visible = false;
                subElement4.Visible = true;
            }
            UXSprite        subElement5     = this.troopDonateGrid.GetSubElement <UXSprite>(itemUid, "SpriteDonateTroopsItem");
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement5);

            projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
            ProjectorUtils.GenerateProjector(projectorConfig);
            this.troopDonateGrid.AddItem(uXButton, troop.Order);
            return(troop.Size <= this.totalCapacity - this.alreadyDonatedSize);
        }
예제 #10
0
        protected override void InitImages()
        {
            IGeometryVO     imageGeometryConfig = this.GetImageGeometryConfig();
            ProjectorConfig config = ProjectorUtils.GenerateBuildingConfig(imageGeometryConfig as BuildingTypeVO, base.GetElement <UXSprite>("BldgImageBottomFrame"));

            this.projector = ProjectorUtils.GenerateProjector(config);
            base.GetElement <UXSprite>("SpriteSquadSymbol").Visible = false;
        }
예제 #11
0
        private void SetupProjectorWithUpdatedConfig(IGeometryVO geometryVO)
        {
            UXSprite frameSprite = this.projector.Config.FrameSprite;

            this.projector.Destroy();
            ProjectorConfig config = ProjectorUtils.GenerateBuildingConfig(geometryVO as BuildingTypeVO, frameSprite);

            this.projector = ProjectorUtils.GenerateProjector(config);
        }
        private void ShowFx(object asset, object cookie)
        {
            this.rig = (GameObject)asset;
            this.rig = UnityEngine.Object.Instantiate <GameObject>(this.rig);
            this.rig.transform.position = new Vector3(0f, 300f, 0f);
            IGeometryVO geometryVO = ProjectorUtils.DetermineVOForEquipment(this.subjectVO);

            Service.Get <AssetManager>().Load(ref this.subjectHandle, geometryVO.IconAssetName, new AssetSuccessDelegate(this.ArrangeRig), null, null);
        }
예제 #13
0
        protected virtual void InitImages()
        {
            IGeometryVO     imageGeometryConfig = this.GetImageGeometryConfig();
            UXSprite        element             = base.GetElement <UXSprite>((!this.useStorageGroup) ? "BldgImageFrame" : "BldgImageFrameStorage");
            ProjectorConfig projectorConfig     = ProjectorUtils.GenerateBuildingConfig(imageGeometryConfig as BuildingTypeVO, element);

            projectorConfig.AnimPreference = AnimationPreference.AnimationAlways;
            this.projector = ProjectorUtils.GenerateProjector(projectorConfig);
            base.GetElement <UXSprite>("SpriteSquadSymbol").Visible = false;
        }
예제 #14
0
 public static void SetupAnimatedCharacter(UXSprite charSprite, string imageName, ref GeometryProjector geom)
 {
     if (charSprite != null && !string.IsNullOrEmpty(imageName))
     {
         StaticDataController staticDataController = Service.StaticDataController;
         TroopTypeVO          vo = staticDataController.Get <TroopTypeVO>(imageName);
         if (geom == null)
         {
             ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(vo, charSprite);
             projectorConfig.AnimPreference = AnimationPreference.AnimationAlways;
             geom = ProjectorUtils.GenerateProjector(projectorConfig);
         }
     }
 }
예제 #15
0
 public void SetIconAsset(IUpgradeableVO iconAsset)
 {
     if (this.iconSprite != null)
     {
         bool flag = iconAsset != null;
         this.iconSprite.Visible = flag;
         this.DestroyIconGeometry();
         if (flag)
         {
             ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconAsset, this.iconSprite);
             Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(iconAsset, projectorConfig, Service.CurrentPlayer.ActiveArmory));
             projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
             projectorConfig.Sharpness      = 4f;
             this.iconGeometry = ProjectorUtils.GenerateProjector(projectorConfig);
         }
     }
 }
        protected override void OnScreenLoaded()
        {
            Service.Get <UXController>().HUD.Visible = false;
            this.InitButtons();
            this.SetUIText();
            this.LoadFx();
            UXSprite   element = base.GetElement <UXSprite>("SpriteInstructions");
            ArmoryNode head    = Service.Get <BuildingLookupController>().ArmoryNodeList.Head;

            if (head != null)
            {
                BuildingTypeVO  buildingType    = head.BuildingComp.BuildingType;
                ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(buildingType, element, false);
                projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                ProjectorUtils.GenerateProjector(projectorConfig);
            }
            this.fadingOutSubject = false;
        }
예제 #17
0
        public static void SetCrateIcon(UXSprite sprite, CrateVO crateVO, AnimState animState)
        {
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(crateVO, sprite);

            if (GameConstants.CRATE_SHOW_VFX && !string.IsNullOrEmpty(crateVO.VfxAssetName) && animState == AnimState.Idle)
            {
                projectorConfig.AttachmentAssets = new string[]
                {
                    crateVO.VfxAssetName
                };
                projectorConfig.AnimPreference = AnimationPreference.AnimationAlways;
            }
            else
            {
                projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
            }
            projectorConfig.AnimState = animState;
            ProjectorUtils.GenerateProjector(projectorConfig);
        }
예제 #18
0
        private void SetupEquipmentShardRewardItemElements(string itemUID, CrateSupplyVO crateSupply)
        {
            EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(crateSupply.RewardUid);
            int         quality = (int)currentEquipmentDataByID.Quality;
            string      name    = string.Format("SpriteTroopImageBkgGridQ{0}", quality);

            this.rewardsGrid.GetSubElement <UXElement>(itemUID, name).Visible = true;
            UXSprite subElement = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteIconFragmentLootTable");

            UXUtils.SetupFragmentIconSprite(subElement, quality);
            this.SetupEquipmentShardProgress(itemUID, currentEquipmentDataByID);
            UXSprite        subElement2     = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItemImage");
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateEquipmentConfig(currentEquipmentDataByID, subElement2, true);

            projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
            GeometryProjector item = ProjectorUtils.GenerateProjector(projectorConfig);

            this.projectors.Add(item);
            UXUtils.SetCardQuality(this, this.rewardsGrid, itemUID, quality, "RewardItemCardQ{0}");
        }
예제 #19
0
        private UXElement CreateDeployableUXElement(UXGrid grid, string uid, string assetName, int amount, IDeployableVO troop, BattleEntry battle)
        {
            UXElement       result          = grid.CloneTemplateItem(uid);
            UXSprite        subElement      = grid.GetSubElement <UXSprite>(uid, this.TroopCardIconName);
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement);

            Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battle));
            projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
            ProjectorUtils.GenerateProjector(projectorConfig);
            UXLabel subElement2 = grid.GetSubElement <UXLabel>(uid, this.TroopCardAmountName);

            subElement2.Text = LangUtils.GetMultiplierText(amount);
            UXLabel subElement3 = grid.GetSubElement <UXLabel>(uid, this.TroopCardLevelName);

            subElement3.Text = LangUtils.GetLevelText(troop.Lvl);
            FactionDecal.UpdateDeployableDecal(uid, grid, troop, this.TroopHeroDecalName);
            string text = null;

            if (troop is TroopTypeVO)
            {
                TroopTypeVO troop2 = troop as TroopTypeVO;
                Service.SkinController.GetApplicableSkin(troop2, battle.AttackerEquipment, out text);
            }
            int qualityInt;

            if (!string.IsNullOrEmpty(text))
            {
                StaticDataController staticDataController = Service.StaticDataController;
                EquipmentVO          equipmentVO          = staticDataController.Get <EquipmentVO>(text);
                qualityInt = (int)equipmentVO.Quality;
            }
            else
            {
                qualityInt = Service.DeployableShardUnlockController.GetUpgradeQualityForDeployable(troop);
            }
            UXUtils.SetCardQuality(this, this.troopGrid, uid, qualityInt, this.TroopCardQualityName, this.TroopCardDefaultName);
            UXButton subElement4 = grid.GetSubElement <UXButton>(uid, this.TroopCardName);

            this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battle);
            return(result);
        }
예제 #20
0
        protected void AddTroopItem(IUpgradeableVO troop, int troopCount)
        {
            TroopUpgradeTag item = new TroopUpgradeTag(troop as IDeployableVO, true);

            this.troopList.Add(item);
            string    uid        = troop.Uid;
            UXElement item2      = this.storageItemGrid.CloneTemplateItem(uid);
            UXLabel   subElement = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelDonateTroops");

            subElement.Text = LangUtils.GetMultiplierText(troopCount);
            UXSprite        subElement2     = this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteDonateTroopsItem");
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop as IDeployableVO, subElement2);

            projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
            ProjectorUtils.GenerateProjector(projectorConfig);
            UXLabel subElement3 = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelTroopLevel");

            subElement3.Text = LangUtils.GetLevelText(troop.Lvl);
            this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteCardEmpty").Visible = false;
            this.storageItemGrid.AddItem(item2, troop.Order);
        }
예제 #21
0
        private void CreateUnlockCards <T>(List <T> deployableList) where T : IDeployableVO
        {
            this.troopListForInfoScreen = new List <TroopUpgradeTag>();
            int i     = 0;
            int count = deployableList.Count;

            while (i < count)
            {
                IDeployableVO deployableVO = deployableList[i];
                if (deployableVO is TroopTypeVO)
                {
                    int level = Service.CurrentPlayer.UnlockedLevels.Troops.GetLevel(deployableVO.UpgradeGroup);
                    deployableVO = Service.TroopUpgradeCatalog.GetByLevel(deployableVO.UpgradeGroup, level);
                }
                else
                {
                    int level2 = Service.CurrentPlayer.UnlockedLevels.Starships.GetLevel(deployableVO.UpgradeGroup);
                    deployableVO = Service.StarshipUpgradeCatalog.GetByLevel(deployableVO.UpgradeGroup, level2);
                }
                if (deployableVO.PlayerFacing)
                {
                    TroopUpgradeTag troopUpgradeTag = new TroopUpgradeTag(deployableVO, true);
                    this.troopListForInfoScreen.Add(troopUpgradeTag);
                    UXElement item       = this.unlockGrid.CloneTemplateItem(deployableVO.Uid);
                    UXButton  subElement = this.unlockGrid.GetSubElement <UXButton>(deployableVO.Uid, "BuildingUnlockCard");
                    subElement.OnClicked = new UXButtonClickedDelegate(this.OnUnlockCardClicked);
                    subElement.Tag       = troopUpgradeTag;
                    UXSprite        subElement2     = this.unlockGrid.GetSubElement <UXSprite>(deployableVO.Uid, "SpriteItemImageTroops");
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(deployableVO, subElement2);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                    UXLabel subElement3 = this.unlockGrid.GetSubElement <UXLabel>(deployableVO.Uid, "LabelUnlockCount");
                    subElement3.Text = LangUtils.GetMultiplierText(1);
                    this.unlockGrid.AddItem(item, deployableVO.Order);
                }
                i++;
            }
        }
예제 #22
0
        private void CreateBuildingTrayItem(BuildingTypeVO vo, int count)
        {
            UXElement  uXElement  = this.stashedBuildingsGrid.CloneTemplateItem(vo.Uid);
            UXCheckbox subElement = this.stashedBuildingsGrid.GetSubElement <UXCheckbox>(vo.Uid, "CheckboxStash");

            subElement.Tag        = vo.Uid;
            subElement.OnSelected = new UXCheckboxSelectedDelegate(this.OnStashedBuildingClicked);
            subElement.Selected   = false;
            uXElement.Tag         = vo;
            UXLabel subElement2 = this.stashedBuildingsGrid.GetSubElement <UXLabel>(vo.Uid, "LabelQuantityStash");

            subElement2.Tag  = vo.Uid;
            subElement2.Text = count.ToString();
            UXLabel subElement3 = this.stashedBuildingsGrid.GetSubElement <UXLabel>(vo.Uid, "LabelBldgLevelStash");

            subElement3.Text = LangUtils.GetLevelText(vo.Lvl);
            UXSprite        subElement4     = this.stashedBuildingsGrid.GetSubElement <UXSprite>(vo.Uid, "SpriteBldgStash");
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(vo, subElement4);

            projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
            ProjectorUtils.GenerateProjector(projectorConfig);
            this.stashedBuildingsGrid.AddItem(uXElement, vo.Lvl + vo.StashOrder);
        }
예제 #23
0
        private void AddExpendedItem(UXGrid expendedGrid, string entryItemUid, string troopUid, IUpgradeableVO troop, int count, int unitQuality, BattleEntry battleEntry)
        {
            if (expendedGrid.Count == 8)
            {
                return;
            }
            if (count <= 0)
            {
                return;
            }
            UXElement uXElement = expendedGrid.CloneTemplateItem(troopUid);

            uXElement.Root.name = UXUtils.FormatAppendedName(uXElement.Root.name, entryItemUid);
            UXLabel subElement = expendedGrid.GetSubElement <UXLabel>(troopUid, UXUtils.FormatAppendedName("LabelTroopsExpended", entryItemUid));

            subElement.Text = ((count <= 0) ? string.Empty : this.lang.Get("TROOP_MULTIPLIER", new object[]
            {
                count
            }));
            UXLabel subElement2 = expendedGrid.GetSubElement <UXLabel>(troopUid, UXUtils.FormatAppendedName("LabelTroopLevel", entryItemUid));

            subElement2.Text = LangUtils.GetLevelText(troop.Lvl);
            UXSprite        subElement3     = expendedGrid.GetSubElement <UXSprite>(troopUid, UXUtils.FormatAppendedName("SpriteTroopsImage", entryItemUid));
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement3);

            Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battleEntry));
            UXUtils.SetupGeometryForIcon(subElement3, projectorConfig);
            string defaultCardName = UXUtils.FormatAppendedName("TroopsExpendBgDefault", entryItemUid);
            string cardName        = UXUtils.FormatAppendedName("TroopsExpendBgQ{0}", entryItemUid);

            UXUtils.SetCardQuality(this, expendedGrid, troopUid, unitQuality, cardName, defaultCardName);
            FactionDecal.UpdateDeployableDecal(troopUid, entryItemUid, expendedGrid, (IDeployableVO)troop);
            UXButton subElement4 = expendedGrid.GetSubElement <UXButton>(troopUid, UXUtils.FormatAppendedName("TroopsExpendedCard", entryItemUid));

            this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battleEntry);
            expendedGrid.AddItem(uXElement, troop.Order);
        }
예제 #24
0
        private bool AddTroopItem(KeyValuePair <string, InventoryEntry> unit, TroopTypeVO troop)
        {
            string   itemUid  = "troop_" + troop.Uid;
            UXButton uXButton = this.troopDonateGrid.CloneItem(itemUid, this.troopTemplateItem) as UXButton;

            uXButton.Tag       = unit;
            uXButton.OnClicked = new UXButtonClickedDelegate(this.OnTroopToDonateClicked);
            UXLabel subElement = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelDonateTroops");

            subElement.Text = string.Format("x{0}", new object[]
            {
                unit.get_Value().Amount
            });
            UXLabel subElement2 = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelTroopLevel");

            subElement2.Text = LangUtils.GetLevelText(troop.Lvl);
            UXSprite        subElement3     = this.troopDonateGrid.GetSubElement <UXSprite>(itemUid, "SpriteDonateTroopsItem");
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement3);

            projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
            ProjectorUtils.GenerateProjector(projectorConfig);
            this.troopDonateGrid.AddItem(uXButton, troop.Order);
            return(troop.Size <= this.totalCapacity - this.alreadyDonatedSize);
        }
예제 #25
0
        private UXElement CreateDeployableUXElement(UXGrid grid, string uid, string assetName, int amount, IDeployableVO troop, BattleEntry battle)
        {
            UXElement       result          = grid.CloneTemplateItem(uid);
            UXSprite        subElement      = grid.GetSubElement <UXSprite>(uid, this.TroopCardIconName);
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement);

            Service.Get <EventManager>().SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battle));
            projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
            ProjectorUtils.GenerateProjector(projectorConfig);
            UXLabel subElement2 = grid.GetSubElement <UXLabel>(uid, this.TroopCardAmountName);

            subElement2.Text = LangUtils.GetMultiplierText(amount);
            UXLabel subElement3 = grid.GetSubElement <UXLabel>(uid, this.TroopCardLevelName);

            subElement3.Text = LangUtils.GetLevelText(troop.Lvl);
            FactionDecal.UpdateDeployableDecal(uid, grid, troop, this.TroopHeroDecalName);
            int upgradeQualityForDeployable = Service.Get <DeployableShardUnlockController>().GetUpgradeQualityForDeployable(troop);

            UXUtils.SetCardQuality(this, this.troopGrid, uid, upgradeQualityForDeployable, this.TroopCardQualityName, this.TroopCardDefaultName);
            UXButton subElement4 = grid.GetSubElement <UXButton>(uid, this.TroopCardName);

            this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battle);
            return(result);
        }
예제 #26
0
        private UXElement CreateCommonEquipmentCard(UXGrid grid, EquipmentVO equipment, string labelName, string labelLevel, string icon, string cardName, bool shouldAnimate, bool closeup)
        {
            CurrentPlayer currentPlayer = Service.CurrentPlayer;
            string        uid           = equipment.Uid;
            UXElement     uXElement     = grid.CloneTemplateItem(uid);

            uXElement.Tag = new SortableEquipment(equipment);
            UXLabel subElement = grid.GetSubElement <UXLabel>(uid, labelName);

            subElement.Text = LangUtils.GetEquipmentDisplayName(equipment);
            UXLabel subElement2 = grid.GetSubElement <UXLabel>(uid, labelLevel);

            if (ArmoryUtils.IsEquipmentOwned(currentPlayer, equipment))
            {
                subElement2.Text = LangUtils.GetLevelText(equipment.Lvl);
            }
            else
            {
                subElement2.Visible = false;
            }
            UXSprite        subElement3     = grid.GetSubElement <UXSprite>(uid, icon);
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateEquipmentConfig(equipment, subElement3, closeup);

            if (shouldAnimate)
            {
                projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
            }
            ProjectorUtils.GenerateProjector(projectorConfig);
            UXElement uXElement2 = UXUtils.SetCardQuality(this, grid, uid, (int)equipment.Quality, cardName);

            if (uXElement2 != null)
            {
                uXElement2.SkipBoundsCalculations(true);
            }
            return(uXElement);
        }
예제 #27
0
        private void UpdateRewardUI(CrateFlyoutItemVO crateFlyoutItemVO)
        {
            IDataController dataController = Service.Get <IDataController>();
            InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>();
            string        crateSupplyUid = crateFlyoutItemVO.CrateSupplyUid;
            CrateSupplyVO optional       = dataController.GetOptional <CrateSupplyVO>(crateSupplyUid);

            if (optional != null)
            {
                base.GetElement <UXElement>("RewardItemDefault").Visible = false;
                for (int i = 1; i <= 3; i++)
                {
                    base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[]
                    {
                        i
                    })).Visible = false;
                }
                if (optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack)
                {
                    ShardVO optional2 = Service.Get <IDataController>().GetOptional <ShardVO>(optional.RewardUid);
                    int     quality   = (int)optional2.Quality;
                    base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[]
                    {
                        quality
                    })).Visible = true;
                    base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[]
                    {
                        quality
                    })).Visible = false;
                }
                else if (optional.Type == SupplyType.Shard)
                {
                    EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(optional.RewardUid);
                    int         quality2 = (int)currentEquipmentDataByID.Quality;
                    base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[]
                    {
                        quality2
                    })).Visible = true;
                    base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[]
                    {
                        quality2
                    })).Visible = true;
                }
                else if (optional.Type == SupplyType.Troop || optional.Type == SupplyType.Hero || optional.Type == SupplyType.SpecialAttack)
                {
                    int upgradeQualityForDeployableUID = Service.Get <DeployableShardUnlockController>().GetUpgradeQualityForDeployableUID(optional.RewardUid);
                    if (upgradeQualityForDeployableUID > 0)
                    {
                        base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[]
                        {
                            upgradeQualityForDeployableUID
                        })).Visible = true;
                        base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[]
                        {
                            upgradeQualityForDeployableUID
                        })).Visible = false;
                    }
                }
                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.Get <StaRTSLogger>().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 && !ArmoryUtils.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);
                return;
            }
            Service.Get <StaRTSLogger>().ErrorFormat("CrateInfoModalScreen: Could not find crate supply {0} for crate flyout {1}", new object[]
            {
                crateSupplyUid,
                crateFlyoutItemVO.Uid
            });
        }
예제 #28
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());
        }
예제 #29
0
        private void SetupGrid()
        {
            if (this.itemGrid != null)
            {
                return;
            }
            this.itemGrid = base.GetElement <UXGrid>("SwapTypeGrid");
            this.itemGrid.SetTemplateItem("SwapTypeTemplate");
            CurrentPlayer          currentPlayer          = Service.CurrentPlayer;
            FactionType            faction                = currentPlayer.Faction;
            StaticDataController   staticDataController   = Service.StaticDataController;
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;
            UnlockController       unlockController       = Service.UnlockController;

            foreach (BuildingTypeVO current in staticDataController.GetAll <BuildingTypeVO>())
            {
                if (current.Type == BuildingType.Turret && current.Faction == faction && current.StoreTab != StoreTab.NotInStore)
                {
                    BuildingTypeVO byLevel        = buildingUpgradeCatalog.GetByLevel(current.UpgradeGroup, this.buildingInfo.Lvl);
                    BuildingTypeVO buildingTypeVO = null;
                    bool           flag           = unlockController.IsUnlocked(current, 1, out buildingTypeVO);
                    if (flag || !byLevel.HideIfLocked)
                    {
                        StoreItemTag storeItemTag = new StoreItemTag();
                        storeItemTag.BuildingInfo = byLevel;
                        string    uid       = byLevel.Uid;
                        UXElement uXElement = this.itemGrid.CloneTemplateItem(uid);
                        uXElement.Tag            = storeItemTag;
                        storeItemTag.MainElement = this.itemGrid.GetSubElement <UXElement>(uid, "ItemInfoTurret");
                        UXLabel subElement = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelItemInfoTurret");
                        subElement.Text                  = LangUtils.GetBuildingDescription(byLevel);
                        storeItemTag.InfoGroup           = this.itemGrid.GetSubElement <UXButton>(uid, "InfoTextTurret");
                        storeItemTag.InfoGroup.Visible   = false;
                        storeItemTag.InfoGroup.OnClicked = new UXButtonClickedDelegate(this.OnSwapInfoLabelButtonClicked);
                        storeItemTag.InfoGroup.Tag       = storeItemTag;
                        UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(uid, "BtnItemInfoTurret");
                        subElement2.OnClicked = new UXButtonClickedDelegate(this.OnSwapInfoButtonClicked);
                        subElement2.Tag       = storeItemTag;
                        UXSprite        subElement3     = this.itemGrid.GetSubElement <UXSprite>(uid, "SpriteItemImageTurret");
                        ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(byLevel, subElement3);
                        projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
                        ProjectorUtils.GenerateProjector(projectorConfig);
                        UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelItemRequirement");
                        subElement4.Visible = !flag;
                        UXElement subElement5 = this.itemGrid.GetSubElement <UXElement>(uid, "CountAndBuildTime");
                        subElement5.Visible = flag;
                        if (flag)
                        {
                            int swapCredits    = byLevel.SwapCredits;
                            int swapMaterials  = byLevel.SwapMaterials;
                            int swapContraband = byLevel.SwapContraband;
                            UXUtils.SetupCostElements(this, "CostTurretSwap", uid, swapCredits, swapMaterials, swapContraband, 0, !flag, null, 150);
                            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelBuildTime");
                            subElement6.Text = GameUtils.GetTimeLabelFromSeconds(byLevel.SwapTime);
                            UXLabel subElement7 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelSwapItemCount");
                            subElement7.Text = string.Empty;
                        }
                        else if (buildingTypeVO != null)
                        {
                            subElement4.Text = this.lang.Get("BUILDING_REQUIREMENT", new object[]
                            {
                                buildingTypeVO.Lvl,
                                LangUtils.GetBuildingDisplayName(buildingTypeVO)
                            });
                            UXUtils.SetupCostElements(this, "CostTurretSwap", uid, 0, 0, 0, 0, !flag, this.lang.Get("s_Locked", new object[0]), 150);
                        }
                        UXCheckbox subElement8 = this.itemGrid.GetSubElement <UXCheckbox>(uid, "TurretItemCard");
                        subElement8.Enabled    = flag;
                        subElement8.OnSelected = new UXCheckboxSelectedDelegate(this.OnSwapItemCheckboxSelected);
                        subElement8.Selected   = (byLevel.Uid == this.buildingInfo.Uid);
                        subElement8.Tag        = storeItemTag;
                        if (subElement8.Selected)
                        {
                            this.OnSwapItemCheckboxSelected(subElement8, true);
                        }
                        this.itemGrid.AddItem(uXElement, byLevel.Order);
                    }
                }
            }
            this.itemGrid.RepositionItems();
        }
예제 #30
0
        private void SetupCrateReward(string itemUid, TournamentRewardsVO rewardGroup, UXGrid rewardGrid, UXElement rewardItem, string rewardSuffix, CrateFlyoutItemVO crateFlyoutItemVO)
        {
            IDataController dataController = Service.Get <IDataController>();
            CurrentPlayer   currentPlayer  = Service.Get <CurrentPlayer>();
            UXButton        uXButton       = rewardItem as UXButton;
            UXSprite        subElement     = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteFragmentIcon" + rewardSuffix);

            UXUtils.HideAllQualityCards(rewardGrid, itemUid, "EquipmentItemCardQ{0}" + rewardSuffix);
            UXElement subElement2 = rewardGrid.GetSubElement <UXElement>(itemUid, "ParticlesTopPrize" + rewardSuffix);

            subElement2.Visible = false;
            uXButton.Enabled    = false;
            subElement.Visible  = false;
            CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(crateFlyoutItemVO.CrateSupplyUid);

            if (optional == null)
            {
                Service.Get <StaRTSLogger>().ErrorFormat("Could not find crate supply {0} for faction {1}", new object[]
                {
                    crateFlyoutItemVO.CrateSupplyUid,
                    currentPlayer.Faction
                });
                return;
            }
            bool     flag        = crateFlyoutItemVO.TournamentTierDisplay3D && optional.Type != SupplyType.Currency && optional.Type != SupplyType.Invalid;
            int      num         = currentPlayer.Map.FindHighestHqLevel();
            UXSprite subElement3 = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteReward2D" + rewardSuffix);

            subElement3.Visible = false;
            if (flag)
            {
                IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(optional, num);
                if (iconVOFromCrateSupply != null)
                {
                    UXSprite        subElement4     = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteEquipmentItemImage" + rewardSuffix);
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, subElement4, true);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                    if (rewardGroup.TournamentTier == this.tiers[0].Uid)
                    {
                        this.particleElements.Add(subElement2.Root.name);
                    }
                }
                else
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("Could not generate geometry for crate supply {0}", new object[]
                    {
                        optional.Uid
                    });
                }
                uXButton.Tag       = optional;
                uXButton.OnClicked = new UXButtonClickedDelegate(this.OnGuaranteedRewardClicked);
                uXButton.Enabled   = true;
            }
            else
            {
                subElement3.Visible = true;
                int num2 = crateFlyoutItemVO.ListIcons.Length - 1;
                subElement3.SpriteName = crateFlyoutItemVO.ListIcons[num2];
                rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentGradient" + rewardSuffix).Visible       = false;
                rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentGradientBottom" + rewardSuffix).Visible = false;
                rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentImageBkg" + rewardSuffix).Visible       = false;
                rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteFrameHover" + rewardSuffix).Visible = false;
            }
            UXLabel subElement5    = rewardGrid.GetSubElement <UXLabel>(itemUid, "LabelPrizeCount" + rewardSuffix);
            int     rewardAmount   = Service.Get <InventoryCrateRewardController>().GetRewardAmount(optional, num);
            int     num3           = rewardGroup.CrateRewardIds.Length;
            string  text           = this.lang.ThousandsSeparated(rewardAmount * num3);
            string  quantityString = crateFlyoutItemVO.QuantityString;

            if (!string.IsNullOrEmpty(quantityString))
            {
                subElement5.Text = this.lang.Get(quantityString, new object[]
                {
                    text
                });
            }
            else if (rewardAmount > 0)
            {
                subElement5.Text = this.lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[]
                {
                    text
                });
            }
            else
            {
                subElement5.Visible = false;
            }
            int  num4    = -1;
            bool visible = false;

            if (optional.Type == SupplyType.ShardSpecialAttack || optional.Type == SupplyType.ShardTroop)
            {
                ShardVO optional2 = dataController.GetOptional <ShardVO>(optional.RewardUid);
                if (optional2 != null)
                {
                    num4 = (int)optional2.Quality;
                }
            }
            else if (optional.Type == SupplyType.Shard)
            {
                EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(optional.RewardUid);
                if (currentEquipmentDataByID != null)
                {
                    num4    = (int)currentEquipmentDataByID.Quality;
                    visible = true;
                }
            }
            else if (optional.Type == SupplyType.Troop || optional.Type == SupplyType.Hero || optional.Type == SupplyType.SpecialAttack)
            {
                num4 = Service.Get <DeployableShardUnlockController>().GetUpgradeQualityForDeployableUID(optional.RewardUid);
            }
            if (num4 > 0 & flag)
            {
                subElement.Visible    = true;
                subElement.SpriteName = string.Format("icoDataFragQ{0}", new object[]
                {
                    num4
                });
                string text2 = string.Format("SpriteEquipmentImageBkgGridQ{0}", new object[]
                {
                    num4
                });
                rewardGrid.GetSubElement <UXElement>(itemUid, text2 + rewardSuffix).Visible = visible;
                UXUtils.SetCardQuality(this, rewardGrid, itemUid, num4, "EquipmentItemCardQ{0}" + rewardSuffix);
            }
        }