Esempio n. 1
0
        private CrateSupplyVO GrantSingleSupplyCrateReward(string crateSupplyId, int hqLevel)
        {
            IDataController dataController = Service.Get <IDataController>();
            CrateSupplyVO   crateSupplyVO  = dataController.Get <CrateSupplyVO>(crateSupplyId);

            switch (crateSupplyVO.Type)
            {
            case SupplyType.Currency:
            case SupplyType.Shard:
            {
                RewardVO vo = this.GenerateRewardFromSupply(crateSupplyVO, hqLevel);
                Service.Get <RewardManager>().TryAndGrantReward(vo, null, null, false);
                break;
            }

            case SupplyType.Troop:
            case SupplyType.Hero:
            case SupplyType.SpecialAttack:
            {
                RewardVO vo2 = this.GenerateRewardFromSupply(crateSupplyVO, hqLevel);
                GameUtils.AddRewardToInventory(vo2);
                break;
            }

            case SupplyType.ShardTroop:
            case SupplyType.ShardSpecialAttack:
                Service.Get <DeployableShardUnlockController>().GrantUnlockShards(crateSupplyVO.RewardUid, this.GetRewardAmount(crateSupplyVO, hqLevel));
                break;

            case SupplyType.Invalid:
                Service.Get <StaRTSLogger>().Error("Supply Type Invalid: " + crateSupplyVO.Uid);
                break;
            }
            return(crateSupplyVO);
        }
Esempio n. 2
0
        public void GrantSingleSupplyCrateReward(CrateSupplyVO crateSupplyData, int hqLevel)
        {
            switch (crateSupplyData.Type)
            {
            case SupplyType.Currency:
            case SupplyType.Shard:
            {
                RewardVO vo = this.GenerateRewardFromSupply(crateSupplyData, hqLevel);
                Service.RewardManager.TryAndGrantReward(vo, null, null, false);
                break;
            }

            case SupplyType.Troop:
            case SupplyType.Hero:
            case SupplyType.SpecialAttack:
            {
                RewardVO vo2 = this.GenerateRewardFromSupply(crateSupplyData, hqLevel);
                GameUtils.AddRewardToInventory(vo2);
                break;
            }

            case SupplyType.ShardTroop:
            case SupplyType.ShardSpecialAttack:
                Service.DeployableShardUnlockController.GrantUnlockShards(crateSupplyData.RewardUid, this.GetRewardAmount(crateSupplyData, hqLevel));
                break;

            case SupplyType.Invalid:
                Service.Logger.Error("Supply Type Invalid: " + crateSupplyData.Uid);
                break;
            }
        }
        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}");
        }
Esempio n. 4
0
        private void PurchasePoolIdShard(int slotIndex, int quantity, Action <object> callback, object cookie, CostVO cost)
        {
            Dictionary <string, int> dictionary = this.CurrentShopData.Purchases[slotIndex];
            string shardSlotId = GameUtils.GetShardSlotId(slotIndex);

            CostUtils.DeductCost(Service.CurrentPlayer, cost);
            CrateSupplyVO crateSupplyVO = this.CurrentShopData.ShardOffers[shardSlotId];

            Service.InventoryCrateRewardController.GrantShopSupply(crateSupplyVO, quantity);
            string uid = crateSupplyVO.Uid;

            if (dictionary.ContainsKey(uid))
            {
                dictionary[uid] += quantity;
            }
            else
            {
                dictionary.Add(uid, quantity);
            }
            BuyShardRequest request         = new BuyShardRequest(shardSlotId, quantity);
            BuyShardCommand buyShardCommand = new BuyShardCommand(request);

            buyShardCommand.Context = new KeyValuePair <object, object>(callback, cookie);
            buyShardCommand.AddSuccessCallback(new AbstractCommand <BuyShardRequest, GetShardOfferingResponse> .OnSuccessCallback(this.OnBuyShardSuccess));
            Service.ServerAPI.Sync(buyShardCommand);
        }
Esempio n. 5
0
        public RewardVO GenerateRewardFromSupply(CrateSupplyVO supplyData, int hqLevel)
        {
            RewardVO rewardVO = new RewardVO();

            rewardVO.Uid = (string.IsNullOrEmpty(supplyData.ScalingUid) ? supplyData.RewardUid : supplyData.ScalingUid);
            switch (supplyData.Type)
            {
            case SupplyType.Currency:
                rewardVO.CurrencyRewards = this.GetUnitRewardUid(supplyData, hqLevel);
                break;

            case SupplyType.Shard:
                rewardVO.ShardRewards = this.GetUnitRewardUid(supplyData, hqLevel);
                break;

            case SupplyType.Troop:
                rewardVO.TroopRewards = this.GetUnitRewardUid(supplyData, hqLevel);
                break;

            case SupplyType.Hero:
                rewardVO.HeroRewards = this.GetUnitRewardUid(supplyData, hqLevel);
                break;

            case SupplyType.SpecialAttack:
                rewardVO.SpecialAttackRewards = this.GetUnitRewardUid(supplyData, hqLevel);
                break;
            }
            return(rewardVO);
        }
Esempio n. 6
0
 private string[] GetUnitRewardUid(CrateSupplyVO supplyData, int hqLevel)
 {
     return(new string[]
     {
         supplyData.RewardUid + ":" + this.GetRewardAmount(supplyData, hqLevel)
     });
 }
Esempio n. 7
0
        private string GetRewardListSpriteName(SupplyCrateTag tag)
        {
            CrateSupplyVO crateSupply = tag.CrateSupply;
            string        result      = null;

            switch (crateSupply.Type)
            {
            case SupplyType.Currency:
                result = GameUtils.GetCurrencyIconName(crateSupply.RewardUid);
                break;

            case SupplyType.Shard:
            case SupplyType.ShardTroop:
            case SupplyType.ShardSpecialAttack:
            {
                ShardQuality shardQuailty = tag.ShardQuailty;
                result = string.Format("icoDataFragQ{0}", (int)shardQuailty);
                break;
            }

            case SupplyType.Troop:
            case SupplyType.Hero:
            case SupplyType.SpecialAttack:
                result = "icoTroopSample";
                break;

            default:
                Service.Logger.Error("Unsupported supply type in GetRewardListSpriteName " + crateSupply.Type.ToString());
                break;
            }
            return(result);
        }
Esempio n. 8
0
        private void SetupShardPBars(CrateSupplyVO crateSupply)
        {
            float value = this.InterpRewardItemAmount(0f);

            this.HandlePBarValueChange(value, false);
            this.SetupBottomPBarValue();
        }
Esempio n. 9
0
        private CrateSupplyVO GrantSingleSupplyCrateReward(string crateSupplyId, int hqLevel)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CrateSupplyVO        crateSupplyVO        = staticDataController.Get <CrateSupplyVO>(crateSupplyId);

            this.GrantSingleSupplyCrateReward(crateSupplyVO, hqLevel);
            return(crateSupplyVO);
        }
Esempio n. 10
0
        public override ISerializable FromObject(object obj)
        {
            StaticDataController        staticDataController = Service.StaticDataController;
            Dictionary <string, object> dictionary           = obj as Dictionary <string, object>;

            this.ShopData = new ShardShopData();
            if (dictionary.ContainsKey("activeSeriesId"))
            {
                string text = dictionary["activeSeriesId"] as string;
                if (string.IsNullOrEmpty(text))
                {
                    Service.Logger.Error("Shard Shop Active Series not found!");
                    return(this);
                }
                this.ShopData.ActiveSeries = staticDataController.Get <ShardShopSeriesVO>(text);
            }
            if (dictionary.ContainsKey("shardOffers"))
            {
                Dictionary <string, object> dictionary2 = dictionary["shardOffers"] as Dictionary <string, object>;
                foreach (string current in dictionary2.Keys)
                {
                    CrateSupplyVO value = staticDataController.Get <CrateSupplyVO>(dictionary2[current] as string);
                    this.ShopData.ShardOffers.Add(current, value);
                }
            }
            if (dictionary.ContainsKey("shardShopData"))
            {
                Dictionary <string, object> dictionary3 = dictionary["shardShopData"] as Dictionary <string, object>;
                if (dictionary3.ContainsKey("seriesId"))
                {
                    this.ShopData.CurrentSeriesPeriod = (dictionary3["seriesId"] as string);
                }
                if (dictionary3.ContainsKey("offerExpiration"))
                {
                    this.ShopData.Expiration = Convert.ToUInt32(dictionary3["offerExpiration"]);
                }
                if (dictionary3.ContainsKey("offsetMinutes"))
                {
                    this.ShopData.OffsetMinutes = Convert.ToSingle(dictionary3["offsetMinutes"]);
                }
                for (int i = 0; i < 5; i++)
                {
                    string shardSlotId = GameUtils.GetShardSlotId(i);
                    if (dictionary3.ContainsKey(shardSlotId))
                    {
                        Dictionary <string, object> dictionary4 = dictionary3[shardSlotId] as Dictionary <string, object>;
                        if (dictionary4 != null)
                        {
                            foreach (string current2 in dictionary4.Keys)
                            {
                                this.ShopData.Purchases[i].Add(current2, Convert.ToInt32(dictionary4[current2]));
                            }
                        }
                    }
                }
            }
            return(this);
        }
Esempio n. 11
0
        private bool GetUnlockShardUIInfoForCurrentItem(out int currentShardAmount, out int increasedShardAmount, out int shardsNeededForLevel, out bool showLevel, out ShardVO unlockShardToDisplay)
        {
            currentShardAmount   = 0;
            increasedShardAmount = 0;
            shardsNeededForLevel = 0;
            unlockShardToDisplay = null;
            showLevel            = false;
            CrateSupplyVO crateSupply = this.currentCrateItem.CrateSupply;
            SupplyType    type        = crateSupply.Type;

            if (type != SupplyType.ShardSpecialAttack && type != SupplyType.ShardTroop)
            {
                return(false);
            }
            ShardVO unlockShard = this.currentCrateItem.UnlockShard;

            if (unlockShard == null)
            {
                return(false);
            }
            unlockShardToDisplay = unlockShard;
            CurrentPlayer currentPlayer = Service.CurrentPlayer;
            DeployableShardUnlockController deployableShardUnlockController = Service.DeployableShardUnlockController;
            string uid           = unlockShard.Uid;
            string targetGroupId = unlockShard.TargetGroupId;
            string targetType    = unlockShard.TargetType;
            int    num           = 0;

            if (targetType == "hero" || targetType == "troop")
            {
                if (this.troopUpgradeOrignal.ContainsKey(targetGroupId))
                {
                    num = this.troopUpgradeOrignal[targetGroupId];
                }
            }
            else if (targetType == "specialAttack" && this.specialAttackUpgradeOrignal.ContainsKey(targetGroupId))
            {
                num = this.specialAttackUpgradeOrignal[targetGroupId];
            }
            int hqLevel      = currentPlayer.Map.FindHighestHqLevel();
            int num2         = (!this.shardsOriginal.ContainsKey(uid)) ? 0 : this.shardsOriginal[uid];
            int rewardAmount = Service.InventoryCrateRewardController.GetRewardAmount(crateSupply, hqLevel);

            currentShardAmount   = num2;
            increasedShardAmount = num2 + rewardAmount;
            showLevel            = (num > 0);
            if (type == SupplyType.ShardSpecialAttack)
            {
                shardsNeededForLevel = deployableShardUnlockController.GetNumShardsForDeployableToReachLevelInGroup <SpecialAttackTypeVO>(num, num + 1, targetGroupId);
            }
            else if (type == SupplyType.ShardTroop)
            {
                shardsNeededForLevel = deployableShardUnlockController.GetNumShardsForDeployableToReachLevelInGroup <TroopTypeVO>(num, num + 1, targetGroupId);
            }
            return(true);
        }
Esempio n. 12
0
        private void OnGuaranteedRewardClicked(UXButton btn)
        {
            CrateSupplyVO crateSupplyVO = (CrateSupplyVO)btn.Tag;

            if (crateSupplyVO != null)
            {
                GameUtils.HandleCrateSupplyRewardClicked(crateSupplyVO);
                this.HideHeaderFooter();
                Service.UXController.HUD.SetSquadScreenVisibility(false);
            }
        }
Esempio n. 13
0
 public void CleanUp()
 {
     this.RenderTexture = null;
     this.Config        = null;
     if (this.Projector != null)
     {
         this.Projector.Destroy();
     }
     this.Projector   = null;
     this.CrateSupply = null;
 }
        private void OnGuaranteedRewardClicked(UXButton btn)
        {
            CrateSupplyVO crateSupplyVO = (CrateSupplyVO)btn.Tag;

            if (crateSupplyVO != null)
            {
                TimedEventPrizeUtils.HandleCrateSupplyRewardClicked(crateSupplyVO);
                this.HideHeaderFooter();
                this.HideAllParticleElements();
                Service.Get <UXController>().HUD.SetSquadScreenVisibility(false);
            }
        }
Esempio n. 15
0
        private bool GetEquipmentShardUIInfoForCurrentItem(out int currentShardAmount, out int increasedShardAmount, out int shardsNeededForLevel, out bool showLevel, out EquipmentVO equipmentVoToDisplay)
        {
            currentShardAmount   = 0;
            increasedShardAmount = 0;
            shardsNeededForLevel = 0;
            equipmentVoToDisplay = null;
            showLevel            = false;
            CrateSupplyVO crateSupply = this.currentCrateItem.CrateSupply;

            if (crateSupply.Type != SupplyType.Shard)
            {
                return(false);
            }
            EquipmentVO equipment = this.currentCrateItem.Equipment;

            if (equipment == null)
            {
                return(false);
            }
            EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.EquipmentUpgradeCatalog;
            string equipmentID = equipment.EquipmentID;
            int    num         = (!this.shardsOriginal.ContainsKey(equipmentID)) ? 0 : this.shardsOriginal[equipmentID];

            currentShardAmount = num;
            RewardVO reward         = Service.InventoryCrateRewardController.GenerateRewardFromSupply(crateSupply, this.hq);
            int      shardsRewarded = RewardUtils.GetShardsRewarded(reward);
            int      num2           = num + shardsRewarded;

            increasedShardAmount = num2;
            EquipmentVO equipmentVO = equipment;

            showLevel = true;
            if (this.equipmentOriginal.ContainsKey(equipmentID))
            {
                int num3  = this.equipmentOriginal[equipmentID];
                int level = Mathf.Min(num3 + 1, equipmentUpgradeCatalog.GetMaxLevel(equipmentID).Lvl);
                equipmentVoToDisplay = equipmentUpgradeCatalog.GetByLevel(equipment, num3);
                equipmentVO          = equipmentUpgradeCatalog.GetByLevel(equipmentVoToDisplay, level);
            }
            else
            {
                equipmentVoToDisplay = equipmentUpgradeCatalog.GetMinLevel(equipmentVO.EquipmentID);
                equipmentVO          = equipmentVoToDisplay;
                showLevel            = false;
            }
            shardsNeededForLevel = equipmentVO.UpgradeShards;
            return(true);
        }
Esempio n. 16
0
        private void AdjustOfferQuantities()
        {
            int count = this.CurrentShopData.ShardOffers.Count;

            for (int i = 0; i < count; i++)
            {
                ShardShopPoolVO pool                      = this.CurrentShopData.ActiveSeries.GetPool(i);
                string          shardSlotId               = GameUtils.GetShardSlotId(i);
                CrateSupplyVO   crateSupplyVO             = this.CurrentShopData.ShardOffers[shardSlotId];
                int             shardCountToReachMaxLevel = GameUtils.GetShardCountToReachMaxLevel(crateSupplyVO.RewardUid, crateSupplyVO.Type);
                int             spentShardCount           = GameUtils.GetSpentShardCount(crateSupplyVO.RewardUid, crateSupplyVO.Type);
                int             upgradeShardsOwned        = GameUtils.GetUpgradeShardsOwned(crateSupplyVO, Service.CurrentPlayer);
                int             val = shardCountToReachMaxLevel - (spentShardCount + upgradeShardsOwned);
                this.adjustedOfferQuantity[i] = Math.Min(val, pool.GetTotalQuantity());
            }
        }
Esempio n. 17
0
        private bool IsCurrentItemRewardAShard()
        {
            if (this.currentCrateItem == null || this.currentCrateItem.CrateSupply == null)
            {
                string text = (this.crateVO != null) ? this.crateVO.Uid : "unknown";
                Service.Logger.ErrorFormat("Reward data for crate {0} not found or has been cleaned up while using it", new object[]
                {
                    text
                });
                return(false);
            }
            CrateSupplyVO crateSupply = this.currentCrateItem.CrateSupply;
            SupplyType    type        = crateSupply.Type;

            return(type == SupplyType.Shard || type == SupplyType.ShardSpecialAttack || type == SupplyType.ShardTroop);
        }
Esempio n. 18
0
        public static void HandleCrateSupplyRewardClicked(CrateSupplyVO crateSupply)
        {
            IDataController dataController = Service.Get <IDataController>();
            DeployableShardUnlockController deployableShardUnlockController = Service.Get <DeployableShardUnlockController>();
            IDeployableVO deployableVO = null;
            EquipmentVO   equipmentVO  = null;

            switch (crateSupply.Type)
            {
            case SupplyType.Shard:
                equipmentVO = ArmoryUtils.GetCurrentEquipmentDataByID(crateSupply.RewardUid);
                break;

            case SupplyType.Troop:
            case SupplyType.Hero:
                deployableVO = dataController.Get <TroopTypeVO>(crateSupply.RewardUid);
                break;

            case SupplyType.SpecialAttack:
                deployableVO = dataController.Get <SpecialAttackTypeVO>(crateSupply.RewardUid);
                break;

            case SupplyType.ShardTroop:
            case SupplyType.ShardSpecialAttack:
            {
                ShardVO shard = dataController.Get <ShardVO>(crateSupply.RewardUid);
                deployableVO = deployableShardUnlockController.GetDeployableVOFromShard(shard);
                break;
            }
            }
            Entity availableTroopResearchLab = Service.Get <BuildingLookupController>().GetAvailableTroopResearchLab();

            if (deployableVO != null)
            {
                Service.Get <EventManager>().SendEvent(EventId.LootTableUnitInfoTapped, deployableVO.Uid);
                TroopUpgradeTag      troopUpgradeTag     = new TroopUpgradeTag(deployableVO, true);
                bool                 showUpgradeControls = !string.IsNullOrEmpty(troopUpgradeTag.Troop.UpgradeShardUid);
                DeployableInfoScreen screen = new DeployableInfoScreen(troopUpgradeTag, null, showUpgradeControls, availableTroopResearchLab);
                Service.Get <ScreenController>().AddScreen(screen);
                return;
            }
            if (equipmentVO != null)
            {
                EquipmentInfoScreen screen2 = new EquipmentInfoScreen(equipmentVO, null, availableTroopResearchLab, true);
                Service.Get <ScreenController>().AddScreen(screen2);
            }
        }
Esempio n. 19
0
        private void SetupCrateRewardItem(SupplyCrateTag crateTag)
        {
            CrateSupplyVO crateSupply = crateTag.CrateSupply;

            this.HideAllRewards();
            switch (crateSupply.Type)
            {
            case SupplyType.Currency:
                this.ActivateCurrencyRewardItem(crateSupply.RewardUid);
                break;

            case SupplyType.Shard:
            case SupplyType.ShardTroop:
            case SupplyType.ShardSpecialAttack:
                if (this.shardReward != null)
                {
                    this.shardReward.SetActive(true);
                    if (this.isSkippingReward)
                    {
                        this.shardRewardAnimator.SetTrigger("ShowDiscSpinEnd");
                    }
                    this.SetupRenderTargetMesh(this.shardReward, crateTag);
                    this.SetupShardQualityDisplay(this.shardReward, crateTag);
                }
                if (this.shardBackVfx != null)
                {
                    this.shardBackVfx.SetActive(true);
                }
                break;

            case SupplyType.Troop:
            case SupplyType.Hero:
            case SupplyType.SpecialAttack:
                if (this.unitReward != null)
                {
                    this.unitReward.SetActive(true);
                    this.SetupRenderTargetMesh(this.unitReward, crateTag);
                }
                if (this.unitBackVfx != null)
                {
                    this.unitBackVfx.SetActive(true);
                }
                break;
            }
        }
Esempio n. 20
0
        public void GrantShopSupply(CrateSupplyVO supplyData, int quantity)
        {
            RewardVO rewardVO = new RewardVO();

            rewardVO.Uid = supplyData.RewardUid;
            string[] array = new string[]
            {
                supplyData.RewardUid + ":" + quantity
            };
            switch (supplyData.Type)
            {
            case SupplyType.Currency:
                rewardVO.CurrencyRewards = array;
                Service.RewardManager.TryAndGrantReward(rewardVO, null, null, false);
                break;

            case SupplyType.Shard:
                rewardVO.ShardRewards = array;
                Service.RewardManager.TryAndGrantReward(rewardVO, null, null, false);
                break;

            case SupplyType.Troop:
                rewardVO.TroopRewards = array;
                GameUtils.AddRewardToInventory(rewardVO);
                break;

            case SupplyType.Hero:
                rewardVO.HeroRewards = array;
                GameUtils.AddRewardToInventory(rewardVO);
                break;

            case SupplyType.SpecialAttack:
                rewardVO.SpecialAttackRewards = array;
                GameUtils.AddRewardToInventory(rewardVO);
                break;

            case SupplyType.ShardTroop:
                Service.DeployableShardUnlockController.GrantUnlockShards(rewardVO.Uid, quantity);
                break;

            case SupplyType.ShardSpecialAttack:
                Service.DeployableShardUnlockController.GrantUnlockShards(rewardVO.Uid, quantity);
                break;
            }
        }
Esempio n. 21
0
        public int GetRewardAmount(CrateSupplyVO supplyData, int hqLevel)
        {
            if (supplyData == null)
            {
                Service.Get <StaRTSLogger>().ErrorFormat("Crate reward given to GetRewardAmount is null", new object[0]);
                return(0);
            }
            CrateSupplyScaleVO crateSupplyScaleVO = null;

            if (!string.IsNullOrEmpty(supplyData.ScalingUid))
            {
                crateSupplyScaleVO = Service.Get <IDataController>().GetOptional <CrateSupplyScaleVO>(supplyData.ScalingUid);
            }
            int result = 0;

            switch (supplyData.Type)
            {
            case SupplyType.Currency:
            case SupplyType.Shard:
            case SupplyType.ShardTroop:
            case SupplyType.ShardSpecialAttack:
                if (crateSupplyScaleVO == null)
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("Crate reward {0} requires HQ scaling data, but none found", new object[]
                    {
                        supplyData.Uid,
                        supplyData.ScalingUid
                    });
                }
                else
                {
                    result = crateSupplyScaleVO.GetHQScaling(hqLevel);
                }
                break;

            case SupplyType.Troop:
            case SupplyType.Hero:
            case SupplyType.SpecialAttack:
                result = supplyData.Amount;
                break;
            }
            return(result);
        }
Esempio n. 22
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}");
        }
Esempio n. 23
0
        private void InitRewardGrid()
        {
            this.gridRewardItems.SetTemplateItem("TemplateListItem");
            List <SupplyCrateTag> rewardList = this.parent.GetRewardList();
            int count        = rewardList.Count;
            int crateHQLevel = this.parent.GetCrateHQLevel();

            for (int i = 0; i < count; i++)
            {
                SupplyCrateTag supplyCrateTag = rewardList[i];
                CrateSupplyVO  crateSupply    = supplyCrateTag.CrateSupply;
                string         itemUid        = crateSupply.Uid + i.ToString();
                UXElement      uXElement      = this.gridRewardItems.CloneTemplateItem(itemUid);
                this.gridRewardItems.AddItem(uXElement, i);
                UXSprite subElement = this.gridRewardItems.GetSubElement <UXSprite>(itemUid, "SpriteTypeListItem");
                subElement.SpriteName = this.GetRewardListSpriteName(supplyCrateTag);
                UXLabel subElement2 = this.gridRewardItems.GetSubElement <UXLabel>(itemUid, "LabelTypeListItem");
                subElement2.Text = GameUtils.GetRewardSupplyName(supplyCrateTag.CrateSupply, crateHQLevel);
                uXElement.InitAnimator();
            }
            this.gridRewardItems.RepositionItems();
        }
Esempio n. 24
0
        public static void TrySetupItemQualityView(CrateSupplyVO supplyData, UXElement unitElement, UXElement basicElement, UXElement advancedElement, UXElement eliteElement, UXElement defaultElement)
        {
            if (supplyData == null)
            {
                return;
            }
            unitElement.Visible     = false;
            basicElement.Visible    = false;
            advancedElement.Visible = false;
            eliteElement.Visible    = false;
            bool         flag         = false;
            ShardQuality shardQuality = ShardQuality.Basic;

            if (supplyData.Type == SupplyType.ShardTroop || supplyData.Type == SupplyType.ShardSpecialAttack)
            {
                ShardVO optional = Service.StaticDataController.GetOptional <ShardVO>(supplyData.RewardUid);
                shardQuality = optional.Quality;
                flag         = true;
            }
            else if (supplyData.Type == SupplyType.Shard)
            {
                EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(supplyData.RewardUid);
                shardQuality = currentEquipmentDataByID.Quality;
                flag         = true;
            }
            if (flag)
            {
                unitElement.Visible     = (shardQuality == ShardQuality.Unit);
                basicElement.Visible    = (shardQuality == ShardQuality.Basic);
                advancedElement.Visible = (shardQuality == ShardQuality.Advanced);
                eliteElement.Visible    = (shardQuality == ShardQuality.Elite);
            }
            if (defaultElement != null)
            {
                defaultElement.Visible = !flag;
            }
        }
Esempio n. 25
0
        public string GetCrateSupplyRewardName(CrateSupplyVO supplyData)
        {
            string text = string.Empty;

            if (supplyData == null)
            {
                return(text);
            }
            Lang            lang           = Service.Get <Lang>();
            IDataController dataController = Service.Get <IDataController>();
            string          rewardUid      = supplyData.RewardUid;
            SupplyType      type           = supplyData.Type;

            switch (type)
            {
            case SupplyType.Currency:
                text = lang.Get(supplyData.RewardUid.ToUpper(), new object[0]);
                break;

            case SupplyType.Shard:
            {
                EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(rewardUid);
                if (currentEquipmentDataByID != null)
                {
                    text = lang.Get(currentEquipmentDataByID.EquipmentName, new object[0]);
                }
                break;
            }

            case SupplyType.Troop:
            case SupplyType.Hero:
            {
                TroopTypeVO optional = dataController.GetOptional <TroopTypeVO>(rewardUid);
                if (optional != null)
                {
                    text = LangUtils.GetTroopDisplayName(optional);
                }
                break;
            }

            case SupplyType.SpecialAttack:
            {
                SpecialAttackTypeVO optional2 = dataController.GetOptional <SpecialAttackTypeVO>(rewardUid);
                if (optional2 != null)
                {
                    text = LangUtils.GetStarshipDisplayName(optional2);
                }
                break;
            }

            case SupplyType.ShardTroop:
            {
                ShardVO optional3 = dataController.GetOptional <ShardVO>(rewardUid);
                if (optional3 != null)
                {
                    text = LangUtils.GetTroopDisplayNameFromTroopID(optional3.TargetGroupId);
                }
                break;
            }

            case SupplyType.ShardSpecialAttack:
            {
                ShardVO optional4 = dataController.GetOptional <ShardVO>(rewardUid);
                if (optional4 != null)
                {
                    text = LangUtils.GetStarshipDisplayNameFromAttackID(optional4.TargetGroupId);
                }
                break;
            }
            }
            if (string.IsNullOrEmpty(text))
            {
                Service.Get <StaRTSLogger>().ErrorFormat("CrateSupplyVO Uid:{0}, Cannot find reward for RewardUid:{1}, Type:{2}", new object[]
                {
                    supplyData.Uid,
                    rewardUid,
                    type
                });
            }
            return(text);
        }
        private void AddFeaturedRewardItemToGrid(PlanetLootEntryVO lootEntry, int order)
        {
            IDataController dataController = Service.Get <IDataController>();
            InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>();
            Lang          lang     = Service.Get <Lang>();
            CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(lootEntry.SupplyDataUid);

            if (optional == null)
            {
                Service.Get <StaRTSLogger>().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);
            }
            for (int i = 1; i <= 3; i++)
            {
                string name = string.Format("RewardItemCardQ{0}", new object[]
                {
                    i
                });
                this.rewardsGrid.GetSubElement <UXElement>(uid, name).Visible = false;
            }
            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 = dataController.Get <TroopTypeVO>(optional.RewardUid);
                }
                else if (optional.Type == SupplyType.SpecialAttack)
                {
                    geometryVO = dataController.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);
        }
Esempio n. 27
0
        public InventoryCrateAnimation(List <CrateSupplyVO> supplyTableDataList, CrateData crateData, Dictionary <string, int> shardsOriginal, Dictionary <string, int> equipmentOriginal, Dictionary <string, int> troopUpgradeOriginalCopy, Dictionary <string, int> specialAttackUpgradeOriginalCopy)
        {
            List <string> assetNames = new List <string>();
            List <object> cookies    = new List <object>();

            this.assetHandles        = new List <AssetHandle>();
            this.supplyCrateDataList = new List <SupplyCrateTag>();
            this.hq     = crateData.HQLevel;
            this.screen = new InventoryCrateCollectionScreen(this, crateData);
            StaticDataController staticDataController = Service.StaticDataController;

            this.crateVO                     = staticDataController.Get <CrateVO>(crateData.CrateId);
            this.shardsOriginal              = shardsOriginal;
            this.equipmentOriginal           = equipmentOriginal;
            this.troopUpgradeOrignal         = troopUpgradeOriginalCopy;
            this.specialAttackUpgradeOrignal = specialAttackUpgradeOriginalCopy;
            this.crateAnimState              = InventoryCrateAnimationState.Falling;
            this.crateLandTimer              = 0u;
            this.playOpenOnLanding           = false;
            this.isSkippingReward            = false;
            this.rewardAnimStarted           = false;
            this.rewardAnimEventReceived     = false;
            this.IsLoaded                    = false;
            int i     = 0;
            int count = supplyTableDataList.Count;

            while (i < count)
            {
                SupplyCrateTag supplyCrateTag = new SupplyCrateTag();
                CrateSupplyVO  crateSupplyVO  = supplyTableDataList[i];
                SupplyType     type           = crateSupplyVO.Type;
                supplyCrateTag.CrateSupply = crateSupplyVO;
                this.supplyCrateDataList.Add(supplyCrateTag);
                if (type != SupplyType.Currency)
                {
                    IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(crateSupplyVO, this.hq);
                    this.AddAssetToLoadList(assetNames, cookies, iconVOFromCrateSupply.IconAssetName);
                    ProjectorConfig projectorConfig;
                    if (iconVOFromCrateSupply is EquipmentVO)
                    {
                        EquipmentVO equipmentVO = (EquipmentVO)iconVOFromCrateSupply;
                        supplyCrateTag.Equipment    = equipmentVO;
                        supplyCrateTag.ShardQuailty = equipmentVO.Quality;
                        projectorConfig             = ProjectorUtils.GenerateEquipmentConfig(iconVOFromCrateSupply as EquipmentVO, new Action <RenderTexture, ProjectorConfig>(this.RenderTextureCompleteCallback), 256f, 256f);
                    }
                    else
                    {
                        if (type == SupplyType.ShardSpecialAttack || type == SupplyType.ShardTroop)
                        {
                            ShardVO shardVO = staticDataController.Get <ShardVO>(crateSupplyVO.RewardUid);
                            supplyCrateTag.ShardQuailty = shardVO.Quality;
                            supplyCrateTag.UnlockShard  = shardVO;
                        }
                        projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, new Action <RenderTexture, ProjectorConfig>(this.RenderTextureCompleteCallback), 256f, 256f);
                    }
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    supplyCrateTag.Config          = projectorConfig;
                    supplyCrateTag.Projector       = ProjectorUtils.GenerateProjector(projectorConfig);
                }
                i++;
            }
            this.AddAssetToLoadList(assetNames, cookies, this.crateVO.RewardAnimationAssetName);
            this.AddAssetToLoadList(assetNames, cookies, "crate_controller");
            Service.AssetManager.MultiLoad(this.assetHandles, assetNames, new AssetSuccessDelegate(this.LoadSuccess), new AssetFailureDelegate(this.LoadFailed), cookies, new AssetsCompleteDelegate(this.AssetsCompleteDelegate), null);
        }
        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);
            }
        }
Esempio n. 29
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
            });
        }
        private void OnInfoButtonClicked(UXButton button)
        {
            CrateSupplyVO crateSupply = (CrateSupplyVO)button.Tag;

            TimedEventPrizeUtils.HandleCrateSupplyRewardClicked(crateSupply);
        }