Esempio n. 1
0
        private UXElement CreateEmptyCardInternal(UXGrid grid, string index)
        {
            UXElement uXElement = grid.CloneTemplateItem(index);

            uXElement.Tag = new SortableEquipment(null);
            UXButton subElement = grid.GetSubElement <UXButton>(index, "BtnEquipmentActiveItemCard");

            subElement.Enabled = false;
            UXLabel subElement2 = grid.GetSubElement <UXLabel>(index, "LabelEquipmentActiveName");

            subElement2.Visible = false;
            UXLabel subElement3 = this.activeGrid.GetSubElement <UXLabel>(index, "LabelEquipmentActiveInstructions");

            subElement3.Visible = false;
            UXLabel subElement4 = grid.GetSubElement <UXLabel>(index, "LabelEquipmentActiveLevel");

            subElement4.Visible = false;
            UXSprite subElement5 = grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveItemImage");

            subElement5.Visible = false;
            UXButton subElement6 = grid.GetSubElement <UXButton>(index, "BtnEquipmentActiveCancel");

            subElement6.Visible = false;
            UXUtils.HideGridQualityCards(grid, index, "EquipmentActiveItemCardQ{0}");
            grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveImageBkg").Visible       = false;
            grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveGradientBottom").Visible = false;
            grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveImageBkgGlow").Visible   = false;
            grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveImageBkgStroke").Visible = false;
            return(uXElement);
        }
Esempio n. 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}");
        }
Esempio n. 3
0
        private void SetupCrateReward(string itemUid, TournamentRewardsVO rewardGroup, UXGrid rewardGrid, UXElement rewardItem, string rewardSuffix, CrateFlyoutItemVO crateFlyoutItemVO)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CurrentPlayer        currentPlayer        = Service.CurrentPlayer;
            UXButton             uXButton             = rewardItem as UXButton;
            UXSprite             subElement           = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteFragmentIcon" + rewardSuffix);

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

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

            if (optional == null)
            {
                Service.Logger.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)
                    {
                        string name = subElement2.Root.name;
                        ScreenParticleFXCookie cookie = new ScreenParticleFXCookie(1f, name);
                        this.particleHandler.ScheduleParticleFX(cookie);
                    }
                }
                else
                {
                    Service.Logger.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.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 flag2 = false;

            if (optional.Type == SupplyType.ShardSpecialAttack || optional.Type == SupplyType.ShardTroop)
            {
                ShardVO optional2 = staticDataController.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;
                    flag2 = true;
                }
            }
            else if (optional.Type == SupplyType.Troop || optional.Type == SupplyType.Hero || optional.Type == SupplyType.SpecialAttack)
            {
                num4 = Service.DeployableShardUnlockController.GetUpgradeQualityForDeployableUID(optional.RewardUid);
            }
            if (flag)
            {
                string[] listIcons = crateFlyoutItemVO.ListIcons;
                if (listIcons != null && listIcons.Length > 0)
                {
                    subElement.Visible    = true;
                    subElement.SpriteName = listIcons[listIcons.Length - 1];
                }
                if (num4 > 0)
                {
                    string str = string.Format("SpriteEquipmentImageBkgGridQ{0}", num4);
                    if (flag2)
                    {
                        rewardGrid.GetSubElement <UXElement>(itemUid, str + rewardSuffix).Visible = true;
                    }
                    UXUtils.SetCardQuality(this, rewardGrid, itemUid, num4, "EquipmentItemCardQ{0}" + rewardSuffix);
                }
            }
        }
Esempio n. 4
0
        private void AddFeaturedRewardItemToGrid(PlanetLootEntryVO lootEntry, int order)
        {
            StaticDataController           staticDataController           = Service.StaticDataController;
            InventoryCrateRewardController inventoryCrateRewardController = Service.InventoryCrateRewardController;
            Lang          lang     = Service.Lang;
            CrateSupplyVO optional = staticDataController.GetOptional <CrateSupplyVO>(lootEntry.SupplyDataUid);

            if (optional == null)
            {
                Service.Logger.ErrorFormat("Couldn't find CrateSupplyVO: {0} specified in PlanetLootEntryVO: {1}", new object[]
                {
                    lootEntry.SupplyDataUid,
                    lootEntry.Uid
                });
                return;
            }
            string    uid       = lootEntry.Uid;
            UXElement uXElement = this.rewardsGrid.CloneTemplateItem(uid);

            uXElement.Tag = lootEntry;
            UXLabel subElement = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardName");

            subElement.Text = inventoryCrateRewardController.GetCrateSupplyRewardName(optional);
            UXUtils.ClampUILabelWidth(subElement, 200, 0);
            UXLabel subElement2 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelGate");

            subElement2.Text = string.Empty;
            if (!string.IsNullOrEmpty(lootEntry.NotesString))
            {
                subElement2.Text = lang.Get(lootEntry.NotesString, new object[0]);
                UXUtils.ClampUILabelWidth(subElement2, 200, 0);
            }
            UXUtils.HideGridQualityCards(this.rewardsGrid, uid, "RewardItemCardQ{0}");
            this.rewardsGrid.GetSubElement <UXElement>(uid, "RewardItemDefault").Visible  = false;
            this.rewardsGrid.GetSubElement <UXElement>(uid, "pBarRewardItemFrag").Visible = false;
            this.rewardsGrid.GetSubElement <UXElement>(uid, "IconUpgrade").Visible        = false;
            UXLabel subElement3 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardTypeLootTimer");

            UXUtils.ClampUILabelWidth(subElement3, 200, 0);
            bool flag = this.DoesLootEntryHaveCountdown(lootEntry);

            subElement3.Visible = flag;
            if (flag)
            {
                this.UpdateTimeRemainingLabel(lootEntry);
            }
            UXButton subElement4 = this.rewardsGrid.GetSubElement <UXButton>(uid, "BtnRewardInfo");
            UXButton subElement5 = this.rewardsGrid.GetSubElement <UXButton>(uid, "BtnRewardItemCard");

            subElement5.InitTweenComponent();
            subElement4.Visible = false;
            if (optional.Type == SupplyType.Hero || optional.Type == SupplyType.Troop || optional.Type == SupplyType.SpecialAttack || optional.Type == SupplyType.Shard || optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack)
            {
                subElement4.Visible   = true;
                subElement4.Tag       = optional;
                subElement4.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked);
                subElement5.Tag       = optional;
                subElement5.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked);
            }
            else
            {
                subElement5.DisablePlayTween();
            }
            UXLabel subElement6 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardTypeLootTable");

            subElement6.Visible = true;
            this.rewardsGrid.GetSubElement <UXSprite>(uid, "SpriteIconFragmentLootTable").Visible = false;
            if (optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack)
            {
                this.SetupShardRewardItemElements(uid, optional);
            }
            else if (optional.Type == SupplyType.Shard)
            {
                this.SetupEquipmentShardRewardItemElements(uid, optional);
            }
            else
            {
                this.rewardsGrid.GetSubElement <UXElement>(uid, "RewardItemDefault").Visible = true;
                this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelFragProgress").Text      = string.Empty;
                UXSprite    subElement7 = this.rewardsGrid.GetSubElement <UXSprite>(uid, "SpriteRewardItemImage");
                IGeometryVO geometryVO  = null;
                if (optional.Type == SupplyType.Currency)
                {
                    subElement6.Visible = false;
                    geometryVO          = UXUtils.GetDefaultCurrencyIconVO(optional.RewardUid);
                }
                else if (optional.Type == SupplyType.Hero || optional.Type == SupplyType.Troop)
                {
                    geometryVO = staticDataController.Get <TroopTypeVO>(optional.RewardUid);
                }
                else if (optional.Type == SupplyType.SpecialAttack)
                {
                    geometryVO = staticDataController.Get <SpecialAttackTypeVO>(optional.RewardUid);
                }
                if (geometryVO != null)
                {
                    ProjectorConfig   config = ProjectorUtils.GenerateGeometryConfig(geometryVO, subElement7, false);
                    GeometryProjector item   = ProjectorUtils.GenerateProjector(config);
                    this.projectors.Add(item);
                }
            }
            this.SetupLockedRewardItemElements(uid, lootEntry);
            if (subElement6.Visible)
            {
                string typeStringID = lootEntry.TypeStringID;
                if (!string.IsNullOrEmpty(typeStringID))
                {
                    subElement6.Visible = true;
                    subElement6.Text    = lang.Get(typeStringID, new object[0]);
                }
                else
                {
                    subElement6.Visible = false;
                }
            }
            subElement6.InitTweenComponent();
            subElement3.InitTweenComponent();
            if (flag && subElement6.Visible)
            {
                subElement6.EnablePlayTween();
                subElement3.EnablePlayTween();
            }
            else
            {
                subElement6.ResetPlayTweenTarget();
                subElement3.ResetPlayTweenTarget();
                subElement6.TextColor = Color.white;
                subElement3.TextColor = Color.white;
            }
            this.rewardsGrid.AddItem(uXElement, order);
        }