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}");
        }
Пример #2
0
        private void SetupGridItemQuality(string itemUID, int quality)
        {
            UXElement subElement = this.itemGrid.GetSubElement <UXElement>(itemUID, "Default");

            if (quality == 0)
            {
                UXUtils.HideGridQualityCards(this.itemGrid, itemUID, "QualityCardQ{0}");
                subElement.Visible = true;
                return;
            }
            subElement.Visible = false;
            UXUtils.SetCardQuality(this, this.itemGrid, itemUID, quality, "QualityCardQ{0}");
        }
Пример #3
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}");
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
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);
        }
        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);
            }
        }
Пример #9
0
        private UXElement FetchEquipmentCardGridItem(CurrentPlayer player, EquipmentVO equipmentVO, EquipmentUpgradeCatalog catalog)
        {
            UXElement    result    = this.equipmentGrid.CloneTemplateItem(equipmentVO.Uid);
            string       uid       = equipmentVO.Uid;
            EquipmentVO  nextLevel = catalog.GetNextLevel(equipmentVO);
            ShardQuality quality   = equipmentVO.Quality;

            UXUtils.SetCardQuality(this, this.equipmentGrid, uid, (int)quality, "EquipmentItemCardQ{0}");
            UXLabel subElement = this.equipmentGrid.GetSubElement <UXLabel>(uid, "LabelEquipmentName");

            subElement.Text = this.lang.Get(equipmentVO.EquipmentName, new object[0]);
            UXLabel subElement2 = this.equipmentGrid.GetSubElement <UXLabel>(uid, "LabelEquipmentLevel");

            subElement2.Text = LangUtils.GetLevelText(equipmentVO.Lvl);
            UXButton subElement3 = this.equipmentGrid.GetSubElement <UXButton>(uid, "BtnEquipmentItemCard");

            subElement3.Tag       = equipmentVO;
            subElement3.OnClicked = new UXButtonClickedDelegate(this.OnEquipmentButtonClicked);
            this.troopGrid.GetSubElement <UXSlider>(uid, "pBarUpgradeTimeEquipment").Visible     = false;
            this.troopGrid.GetSubElement <UXLabel>(uid, "LabelpBarUpgradeTimeEquipment").Visible = false;
            UXSprite subElement4 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpriteFragmentEquip");

            UXUtils.SetupFragmentIconSprite(subElement4, (int)quality);
            UXSprite        subElement5 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpriteEquipmentItemImage");
            ProjectorConfig config      = ProjectorUtils.GenerateEquipmentConfig(equipmentVO, subElement5, true);

            ProjectorUtils.GenerateProjector(config);
            UXLabel  subElement6 = this.equipmentGrid.GetSubElement <UXLabel>(uid, "LabelEquipmentNumber");
            UXSlider subElement7 = this.equipmentGrid.GetSubElement <UXSlider>(uid, "pBarFrag");
            UXSprite subElement8 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpritepBarFrag");

            subElement8.Color = UXUtils.COLOR_SHARD_INPROGRESS;
            UXLabel   subElement9  = this.equipmentGrid.GetSubElement <UXLabel>(uid, "LabelEquipmentRequirement");
            UXSprite  subElement10 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpriteDim");
            UXSprite  subElement11 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpriteIconLockedEquip");
            UXElement subElement12 = this.equipmentGrid.GetSubElement <UXElement>(uid, "IconUpgrade");

            if (!player.UnlockedLevels.Equipment.Has(equipmentVO))
            {
                subElement9.Text     = LangUtils.GetShardLockedEquipmentString(equipmentVO);
                subElement10.Visible = true;
                subElement11.Visible = true;
                subElement2.Visible  = false;
                int shards = player.GetShards(equipmentVO.EquipmentID);
                subElement6.Text = this.lang.Get("OBJECTIVE_PROGRESS", new object[]
                {
                    shards,
                    equipmentVO.UpgradeShards
                });
                subElement7.Value    = this.CalculateProgress(shards, equipmentVO);
                subElement12.Visible = false;
            }
            else if (nextLevel == null)
            {
                subElement6.Visible  = false;
                subElement10.Visible = true;
                subElement11.Visible = false;
                subElement6.Visible  = false;
                subElement9.Text     = this.lang.Get("MAX_LEVEL", new object[0]);
                subElement7.Visible  = false;
                subElement12.Visible = false;
            }
            else
            {
                int shards2 = player.GetShards(equipmentVO.EquipmentID);
                subElement6.Text = this.lang.Get("OBJECTIVE_PROGRESS", new object[]
                {
                    shards2,
                    nextLevel.UpgradeShards
                });
                subElement7.Value    = this.CalculateProgress(shards2, nextLevel);
                subElement12.Visible = (shards2 >= nextLevel.UpgradeShards);
                if (subElement12.Visible)
                {
                    subElement8.Color = UXUtils.COLOR_SHARD_COMPLETE;
                }
                if (ArmoryUtils.IsBuildingRequirementMet(nextLevel))
                {
                    subElement9.Visible  = false;
                    subElement10.Visible = false;
                    subElement11.Visible = false;
                }
                else
                {
                    BuildingTypeVO buildingInfo = this.dataController.Get <BuildingTypeVO>(nextLevel.BuildingRequirement);
                    subElement9.Text = this.lang.Get("BUILDING_REQUIREMENT", new object[]
                    {
                        nextLevel.Lvl,
                        LangUtils.GetBuildingDisplayName(buildingInfo)
                    });
                    subElement10.Visible = true;
                    subElement11.Visible = true;
                }
            }
            return(result);
        }