Beispiel #1
0
        public static void SetRewardIcon(UXSprite sprite, IGeometryVO config, AnimationPreference animPreference = AnimationPreference.NoAnimation)
        {
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(config, sprite);

            projectorConfig.AnimPreference = animPreference;
            ProjectorUtils.GenerateProjector(projectorConfig);
        }
Beispiel #2
0
        private void UpdatePage(bool showSwapPage)
        {
            this.swapLabel.Visible       = showSwapPage;
            this.swapTypeGroup.Visible   = showSwapPage;
            this.infoTurretGroup.Visible = !showSwapPage;
            IGeometryVO arg_3A_0;

            if (!showSwapPage)
            {
                arg_3A_0 = this.GetImageGeometryConfig();
            }
            else
            {
                IGeometryVO buildingInfo = this.buildingInfo;
                arg_3A_0 = buildingInfo;
            }
            IGeometryVO geometryVO = arg_3A_0;

            this.SetupProjectorWithUpdatedConfig(geometryVO);
            if (showSwapPage)
            {
                this.ShowSwapConfirmAndCancelButtons();
                this.SetupGrid();
                this.UpdateTitleText(true);
                this.UpdateHQUpgradeDesc(false);
                return;
            }
            this.ShowSwapAndUpgradeButtons();
            this.UpdateTitleText(false);
            this.UpdateHQUpgradeDesc(true);
        }
Beispiel #3
0
        public static ProjectorConfig GenerateEquipmentConfig(EquipmentVO equipmentVO, Action <RenderTexture, ProjectorConfig> callback, float width, float height)
        {
            IGeometryVO     vo = ProjectorUtils.DetermineVOForEquipment(equipmentVO);
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(vo, callback, width, height);

            projectorConfig.buildingEquipmentShaderName = ProjectorUtils.GetEquipmentBuildingShaderName(equipmentVO);
            return(projectorConfig);
        }
Beispiel #4
0
        public static ProjectorConfig GenerateEquipmentConfig(EquipmentVO equipmentVO, UXSprite frameSprite, bool closeup)
        {
            IGeometryVO     vo = ProjectorUtils.DetermineVOForEquipment(equipmentVO);
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(vo, frameSprite, closeup);

            projectorConfig.buildingEquipmentShaderName = ProjectorUtils.GetEquipmentBuildingShaderName(equipmentVO);
            return(projectorConfig);
        }
 protected string GetAssetNameFromGeometryConfig(IGeometryVO config)
 {
     if (!(config is IAssetVO))
     {
         return(null);
     }
     return(((IAssetVO)config).AssetName);
 }
Beispiel #6
0
        protected override void InitImages()
        {
            IGeometryVO     imageGeometryConfig = this.GetImageGeometryConfig();
            ProjectorConfig config = ProjectorUtils.GenerateBuildingConfig(imageGeometryConfig as BuildingTypeVO, base.GetElement <UXSprite>("BldgImageBottomFrame"));

            this.projector = ProjectorUtils.GenerateProjector(config);
            base.GetElement <UXSprite>("SpriteSquadSymbol").Visible = false;
        }
Beispiel #7
0
 private void Init(IGeometryVO geometry, ProjectorConfig projector, string assetName, string tooltipText, BattleEntry battle, ActiveArmory armory)
 {
     this.geometry    = geometry;
     this.projector   = projector;
     this.assetName   = assetName;
     this.tooltipText = tooltipText;
     this.battle      = battle;
     this.armory      = armory;
 }
        private void ShowFx(object asset, object cookie)
        {
            this.rig = (GameObject)asset;
            this.rig = UnityEngine.Object.Instantiate <GameObject>(this.rig);
            this.rig.transform.position = new Vector3(0f, 300f, 0f);
            IGeometryVO geometryVO = ProjectorUtils.DetermineVOForEquipment(this.subjectVO);

            Service.Get <AssetManager>().Load(ref this.subjectHandle, geometryVO.IconAssetName, new AssetSuccessDelegate(this.ArrangeRig), null, null);
        }
Beispiel #9
0
        private void ShowFx(object asset, object cookie)
        {
            this.rig = (GameObject)asset;
            this.rig = UnityEngine.Object.Instantiate <GameObject>(this.rig);
            this.rig.transform.position = new Vector3(0f, 1000f, 0f);
            IGeometryVO geometryVO = this.subjectVO;

            Service.AssetManager.Load(ref this.subjectHandle, geometryVO.IconAssetName, new AssetSuccessDelegate(this.ArrangeRig), null, null);
        }
Beispiel #10
0
        private void SetupProjectorWithUpdatedConfig(IGeometryVO geometryVO)
        {
            UXSprite frameSprite = this.projector.Config.FrameSprite;

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

            this.projector = ProjectorUtils.GenerateProjector(config);
        }
Beispiel #11
0
        public static ProjectorConfig GenerateGeometryConfig(IGeometryVO vo, Action <RenderTexture, ProjectorConfig> callback, float width, float height)
        {
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(vo, null, false);

            projectorConfig.RenderCallback = callback;
            projectorConfig.RenderWidth    = width;
            projectorConfig.RenderHeight   = height;
            return(projectorConfig);
        }
Beispiel #12
0
        protected virtual void InitImages()
        {
            IGeometryVO     imageGeometryConfig = this.GetImageGeometryConfig();
            UXSprite        element             = base.GetElement <UXSprite>((!this.useStorageGroup) ? "BldgImageFrame" : "BldgImageFrameStorage");
            ProjectorConfig projectorConfig     = ProjectorUtils.GenerateBuildingConfig(imageGeometryConfig as BuildingTypeVO, element);

            projectorConfig.AnimPreference = AnimationPreference.AnimationAlways;
            this.projector = ProjectorUtils.GenerateProjector(projectorConfig);
            base.GetElement <UXSprite>("SpriteSquadSymbol").Visible = false;
        }
Beispiel #13
0
        private UXElement CreateTileWithPrizeInfo(string id, int count, PrizeType prizeType)
        {
            string title       = null;
            string description = null;
            DeployableShardUnlockController deployableShardUnlockController = Service.DeployableShardUnlockController;
            IGeometryVO geometryVO = TimedEventPrizeUtils.GetFinalUnitFromPrize(prizeType, id);
            int         quality    = 0;

            switch (prizeType)
            {
            case PrizeType.Currency:
                title      = this.lang.Get(id.ToUpper(), new object[0]);
                geometryVO = UXUtils.GetDefaultCurrencyIconVO(id);
                break;

            case PrizeType.Infantry:
            case PrizeType.Hero:
            case PrizeType.Vehicle:
            case PrizeType.Mercenary:
            {
                TroopTypeVO troopTypeVO = (TroopTypeVO)geometryVO;
                quality     = deployableShardUnlockController.GetUpgradeQualityForDeployable(troopTypeVO);
                title       = LangUtils.GetTroopDisplayName(troopTypeVO);
                description = LangUtils.GetTroopDescription(troopTypeVO);
                break;
            }

            case PrizeType.SpecialAttack:
            {
                SpecialAttackTypeVO specialAttackTypeVO = (SpecialAttackTypeVO)geometryVO;
                quality     = deployableShardUnlockController.GetUpgradeQualityForDeployable(specialAttackTypeVO);
                title       = LangUtils.GetStarshipDisplayName(specialAttackTypeVO);
                description = LangUtils.GetStarshipDescription(specialAttackTypeVO);
                break;
            }

            case PrizeType.Crate:
            {
                CrateData crateData        = this.cp.Prizes.Crates.Available[id];
                string    crateDisplayName = LangUtils.GetCrateDisplayName(crateData.CrateId);
                title = this.lang.Get("CRATE_INVENTORY_CRATE_TITLE", new object[]
                    {
                        LangUtils.GetPlanetDisplayName(crateData.PlanetId),
                        crateDisplayName
                    });
                geometryVO = Service.StaticDataController.Get <CrateVO>(crateData.CrateId);
                break;
            }
            }
            return(this.CreateInventoryGridItem(id, prizeType, title, description, count, geometryVO, quality));
        }
Beispiel #14
0
        public static ProjectorConfig GenerateGeometryConfig(IGeometryVO vo, UXSprite frameSprite, bool closeup)
        {
            ProjectorConfig projectorConfig = new ProjectorConfig();

            projectorConfig.IconRotationSpeed = vo.IconRotationSpeed;
            projectorConfig.AnimPreference    = AnimationPreference.NoAnimation;
            projectorConfig.AssetName         = vo.IconAssetName;
            projectorConfig.closeup           = closeup;
            if (projectorConfig.closeup)
            {
                projectorConfig.CameraPosition = vo.IconCloseupCameraPosition;
                projectorConfig.CameraInterest = vo.IconCloseupLookatPosition;
            }
            else
            {
                projectorConfig.CameraPosition = vo.IconCameraPosition;
                projectorConfig.CameraInterest = vo.IconLookatPosition;
            }
            projectorConfig.AnimState   = AnimState.Idle;
            projectorConfig.FrameSprite = frameSprite;
            return(projectorConfig);
        }
Beispiel #15
0
        private void AddGoToStoreItem(List <UXElement> list)
        {
            int cRATE_INVENTORY_TO_STORE_LINK_SORT = GameConstants.CRATE_INVENTORY_TO_STORE_LINK_SORT;

            if (cRATE_INVENTORY_TO_STORE_LINK_SORT == 0 || !CrateUtils.HasVisibleCrateStoreItems())
            {
                return;
            }
            string      cRATE_INVENTORY_TO_STORE_LINK_CRATE_ASSET = GameConstants.CRATE_INVENTORY_TO_STORE_LINK_CRATE_ASSET;
            IGeometryVO vo          = Service.StaticDataController.Get <CrateVO>(cRATE_INVENTORY_TO_STORE_LINK_CRATE_ASSET);
            string      title       = this.lang.Get("CRATE_INVENTORY_TO_STORE_TITLE", new object[0]);
            string      description = this.lang.Get("CRATE_INVENTORY_TO_STORE_DESC", new object[0]);
            UXElement   item        = this.CreateInventoryGridItem("Id_Store", PrizeType.None, title, description, 0, vo, 0);

            if (cRATE_INVENTORY_TO_STORE_LINK_SORT == 1)
            {
                list.Insert(0, item);
            }
            else if (cRATE_INVENTORY_TO_STORE_LINK_SORT == 2)
            {
                list.Add(item);
            }
        }
Beispiel #16
0
        public static void SetupGeometryForIcon(UXSprite itemIconSprite, IGeometryVO data)
        {
            ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(data, itemIconSprite);

            UXUtils.SetupGeometryForIcon(itemIconSprite, config);
        }
Beispiel #17
0
 public virtual void SetIconAsset(IGeometryVO geometery)
 {
     this.geometry = geometery;
 }
Beispiel #18
0
 public void InitCampaignGrid()
 {
     this.screen.CurrentBackButton    = this.backButtonChapter;
     this.screen.CurrentBackDelegate  = new UXButtonClickedDelegate(this.OnBackButtonClicked);
     this.campaignSelectGroup.Visible = true;
     if (this.campaignGroupInitialized)
     {
         return;
     }
     this.campaignGroupInitialized = true;
     this.campaignGrid             = this.screen.GetElement <UXGrid>("CampaignGrid");
     this.campaignGrid.SetTemplateItem("CampaignTemplate");
     foreach (CampaignVO current in base.Sdc.GetAll <CampaignVO>())
     {
         if (!current.Timed && current.Faction == base.Player.Faction)
         {
             string    uid       = current.Uid;
             UXElement uXElement = this.campaignGrid.CloneTemplateItem(uid);
             uXElement.Tag = current;
             int     totalCampaignStarsEarned = base.Player.CampaignProgress.GetTotalCampaignStarsEarned(current);
             int     totalMasteryStars        = current.TotalMasteryStars;
             UXLabel subElement = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelCampaignName");
             subElement.Text = LangUtils.GetCampaignTitle(current);
             UXLabel subElement2 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterDescription");
             subElement2.Text = LangUtils.GetCampaignDescription(current);
             UXLabel subElement3 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelStarsCount");
             subElement3.Text = base.LangController.Get("LABEL_CAMPAIGN_STARS", new object[]
             {
                 totalCampaignStarsEarned,
                 totalMasteryStars
             });
             UXButton subElement4 = this.campaignGrid.GetSubElement <UXButton>(uid, "ButtonCampaignCard");
             subElement4.Tag       = current;
             subElement4.OnClicked = new UXButtonClickedDelegate(this.OnCampaignItemButtonClicked);
             UXTexture subElement5 = this.campaignGrid.GetSubElement <UXTexture>(uid, "SpriteCampaignImage");
             subElement5.LoadTexture(current.Uid);
             if (!base.Player.CampaignProgress.HasCampaign(current))
             {
                 subElement4.Enabled = false;
             }
             UXSprite subElement6 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteIcoChapterLocked");
             subElement6.Visible = !subElement4.Enabled;
             UXLabel subElement7 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterNumberSelect");
             this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterReward").Text = base.LangController.Get("s_Rewards", new object[0]);
             subElement7.Text = base.LangController.Get("CHAPTER_NUMBER", new object[]
             {
                 current.UnlockOrder
             });
             UXLabel     subElement8  = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelObjectivesCount");
             UXLabel     subElement9  = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelCampaignComplete");
             UXSprite    subElement10 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteIconCheck");
             UXLabel     subElement11 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelUnlocks");
             UXSprite    subElement12 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteChapterRewardItem");
             UXLabel     subElement13 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterRewarded");
             int         totalCampaignMissionsCompleted = base.Player.CampaignProgress.GetTotalCampaignMissionsCompleted(current);
             int         totalMissions = current.TotalMissions;
             IGeometryVO config        = null;
             RewardType  rewardType    = RewardType.Invalid;
             base.RManager.GetFirstRewardAssetName(current.Reward, ref rewardType, out config);
             RewardUtils.SetRewardIcon(subElement12, config, AnimationPreference.NoAnimation);
             if (totalCampaignMissionsCompleted > 0 && totalCampaignMissionsCompleted == totalMissions)
             {
                 subElement8.Visible = false;
                 subElement9.Text    = base.LangController.Get("LABEL_CAMPAIGN_COMPLETE", new object[0]);
                 subElement11.Text   = base.RManager.GetRewardString(current.Reward);
                 bool flag = totalCampaignStarsEarned >= totalMasteryStars;
                 subElement13.Visible = flag;
                 subElement12.Visible = !flag;
                 subElement11.Visible = !flag;
             }
             else
             {
                 subElement9.Visible  = false;
                 subElement10.Visible = false;
                 subElement8.Text     = base.LangController.Get("LABEL_CAMPAIGN_MISSIONS", new object[]
                 {
                     totalCampaignMissionsCompleted,
                     totalMissions
                 });
                 subElement11.Text = base.RManager.GetRewardString(current.Reward);
             }
             UXSlider subElement14 = this.campaignGrid.GetSubElement <UXSlider>(uid, "ChapterPbar");
             subElement14.Value = ((totalMissions != 0) ? ((float)totalCampaignMissionsCompleted / (float)totalMissions) : 0f);
             this.campaignGrid.AddItem(uXElement, current.UnlockOrder);
         }
     }
     this.campaignGrid.RepositionItems();
 }
Beispiel #19
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);
        }
Beispiel #20
0
        public void Render(ShardShopViewTO vto, bool shouldShowProgressLerp)
        {
            bool flag  = this.vto == null || this.vto.SupplyVO != vto.SupplyVO;
            bool flag2 = this.vto != null && !this.vto.ValueEquals(vto);

            if (flag2)
            {
                this.previousShardsEarned = this.vto.UpgradeShardsEarned;
            }
            this.vto = vto;
            if (flag)
            {
                IGeometryVO     iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(vto.SupplyVO, vto.PlayerHQLevel);
                ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, this.iconSprite);
                this.projector = ProjectorUtils.GenerateProjector(config);
            }
            int upgradeShardsEarned   = vto.UpgradeShardsEarned;
            int upgradeShardsRequired = vto.UpgradeShardsRequired;

            this.quantityCounter.Text = vto.RemainingShardsForSale.ToString();
            this.bodyText.Text        = this.lang.Get("shard_shop_shards_remaining", new object[]
            {
                vto.ItemName
            });
            this.purchaseSingleDescLabel.Text    = this.lang.Get("shard_shop_buy_single", new object[0]);
            this.purchaseAllDescLabel.Text       = this.lang.Get("shard_shop_buy_all", new object[0]);
            this.nextProgressBarValue            = this.GetProgessBarValue(upgradeShardsEarned, upgradeShardsRequired);
            this.previousProgressBarValue        = this.GetProgessBarValue(this.previousShardsEarned, upgradeShardsRequired);
            this.iconDeltaShardProgressBar.Value = this.nextProgressBarValue;
            if (!shouldShowProgressLerp)
            {
                this.isProgressBarLerping           = false;
                this.iconProgressLabel.Text         = upgradeShardsEarned + "/" + upgradeShardsRequired;
                this.iconBaseShardProgressBar.Value = this.nextProgressBarValue;
            }
            else if (flag2)
            {
                this.progressLerpTimer              = 0f;
                this.isProgressBarLerping           = true;
                this.iconProgressLabel.Text         = this.previousShardsEarned + "/" + upgradeShardsRequired;
                this.iconBaseShardProgressBar.Value = this.previousProgressBarValue;
                Service.ViewTimeEngine.RegisterFrameTimeObserver(this);
            }
            SupplyType type = vto.SupplyVO.Type;

            if (type != SupplyType.Shard)
            {
                if (type == SupplyType.ShardTroop || type == SupplyType.ShardSpecialAttack)
                {
                    this.titleText.Text = this.lang.Get("shard_shop_buy_unit_shards", new object[0]);
                }
            }
            else
            {
                this.titleText.Text = this.lang.Get("shard_shop_buy_equipment_shards", new object[0]);
            }
            if (vto.RemainingShardsForSale > 0)
            {
                UXUtils.SetupSingleResourceUI(vto.CostOfNextShard, this.purchaseSingleLabel, this.purchaseSingleSprite);
                UXUtils.SetupSingleResourceUI(vto.CostOfAllShards, this.purchaseAllLabel, this.purchaseAllSprite);
            }
            this.returnBtn.Visible         = (vto.RemainingShardsForSale == 0);
            this.purchaseSingleBtn.Visible = (vto.RemainingShardsForSale > 0);
            this.purchaseAllBtn.Visible    = (vto.RemainingShardsForSale > 0);
            this.parent.RevertToOriginalNameRecursively(this.icon.Root, "ModalIcon");
            Service.Engine.StartCoroutine(this.SetAnimatorState());
        }
        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);
            }
        }
Beispiel #22
0
        public void GetFirstRewardAssetName(string rewardUid, ref RewardType type, out IGeometryVO config)
        {
            if (string.IsNullOrEmpty(rewardUid))
            {
                config = null;
                return;
            }
            RewardVO rewardVO = this.sdc.Get <RewardVO>(rewardUid);

            if (rewardVO.BuildingUnlocks != null && rewardVO.BuildingUnlocks.Length > 0)
            {
                BuildingTypeVO buildingTypeVO = this.sdc.Get <BuildingTypeVO>(rewardVO.BuildingUnlocks[0]);
                type   = RewardType.Building;
                config = buildingTypeVO;
                return;
            }
            if (rewardVO.TroopUnlocks != null && rewardVO.TroopUnlocks.Length > 0)
            {
                TroopTypeVO troopTypeVO = this.sdc.Get <TroopTypeVO>(rewardVO.TroopUnlocks[0]);
                type   = RewardType.Troop;
                config = troopTypeVO;
                return;
            }
            if (rewardVO.TroopRewards != null && rewardVO.TroopRewards.Length > 0)
            {
                string[] array = rewardVO.TroopRewards[0].Split(new char[]
                {
                    ':'
                });
                if (array != null && array.Length > 0)
                {
                    TroopTypeVO troopTypeVO = this.sdc.Get <TroopTypeVO>(array[0]);
                    type   = RewardType.Troop;
                    config = troopTypeVO;
                    return;
                }
            }
            if (rewardVO.HeroUnlocks != null && rewardVO.HeroUnlocks.Length > 0)
            {
                TroopTypeVO troopTypeVO2 = this.sdc.Get <TroopTypeVO>(rewardVO.HeroUnlocks[0]);
                type   = RewardType.Troop;
                config = troopTypeVO2;
                return;
            }
            if (rewardVO.HeroRewards != null && rewardVO.HeroRewards.Length > 0)
            {
                string[] array2 = rewardVO.HeroRewards[0].Split(new char[]
                {
                    ':'
                });
                if (array2 != null && array2.Length > 0)
                {
                    TroopTypeVO troopTypeVO2 = this.sdc.Get <TroopTypeVO>(array2[0]);
                    type   = RewardType.Troop;
                    config = troopTypeVO2;
                    return;
                }
            }
            if (rewardVO.SpecialAttackRewards != null && rewardVO.SpecialAttackRewards.Length > 0)
            {
                string[] array3 = rewardVO.SpecialAttackRewards[0].Split(new char[]
                {
                    ':'
                });
                if (array3 != null && array3.Length > 0)
                {
                    SpecialAttackTypeVO specialAttackTypeVO = this.sdc.Get <SpecialAttackTypeVO>(array3[0]);
                    type   = RewardType.Troop;
                    config = specialAttackTypeVO;
                    return;
                }
            }
            if (rewardVO.SpecialAttackUnlocks != null && rewardVO.SpecialAttackUnlocks.Length > 0)
            {
                SpecialAttackTypeVO specialAttackTypeVO = this.sdc.Get <SpecialAttackTypeVO>(rewardVO.SpecialAttackUnlocks[0]);
                type   = RewardType.Troop;
                config = specialAttackTypeVO;
                return;
            }
            if (rewardVO.CurrencyRewards != null && rewardVO.CurrencyRewards.Length > 0)
            {
                type   = RewardType.Currency;
                config = null;
                string[] array4 = rewardVO.CurrencyRewards[0].Split(new char[]
                {
                    ':'
                });
                if (array4 != null && array4.Length > 0)
                {
                    string text = array4[0];
                    if (!string.IsNullOrEmpty(text))
                    {
                        config = UXUtils.GetDefaultCurrencyIconVO(text);
                    }
                    return;
                }
            }
            type   = RewardType.Invalid;
            config = null;
        }
Beispiel #23
0
        public void UpdateObjectiveEntry(ObjectiveViewData objectiveData, bool isGrace)
        {
            ObjectiveProgress objective              = objectiveData.Objective;
            UXSprite          spriteCheckmark        = objectiveData.SpriteCheckmark;
            UXSprite          spriteSupplyCrate      = objectiveData.SpriteSupplyCrate;
            UXSprite          spriteObjectiveIcon    = objectiveData.SpriteObjectiveIcon;
            UXSprite          spritePreview          = objectiveData.SpritePreview;
            UXLabel           statusLabel            = objectiveData.StatusLabel;
            UXLabel           titleLabel             = objectiveData.TitleLabel;
            UXSlider          progressSlider         = objectiveData.ProgressSlider;
            UXSprite          radialProgress         = objectiveData.RadialProgress;
            UXLabel           expiredLabel           = objectiveData.ExpiredLabel;
            UXSprite          spriteObjectiveExpired = objectiveData.SpriteObjectiveExpired;
            UXElement         objectiveBgComplete    = objectiveData.ObjectiveBgComplete;
            UXElement         objectiveBgCollected   = objectiveData.ObjectiveBgCollected;
            UXElement         objectiveBgExpired     = objectiveData.ObjectiveBgExpired;
            UXElement         objectiveBgActive      = objectiveData.ObjectiveBgActive;
            UXElement         objectiveContainer     = objectiveData.ObjectiveContainer;
            UXElement         objectiveContainerLEI  = objectiveData.ObjectiveContainerLEI;
            bool        flag           = objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace);
            Lang        lang           = Service.Lang;
            ObjectiveVO vO             = objectiveData.Objective.VO;
            string      crateRewardUid = vO.CrateRewardUid;
            CrateVO     optional       = Service.StaticDataController.GetOptional <CrateVO>(crateRewardUid);

            if (optional == null)
            {
                Service.Logger.ErrorFormat("The objective {0} specifies an invalid crateRewardUid {1}", new object[]
                {
                    vO.Uid,
                    crateRewardUid
                });
                return;
            }
            string value = null;

            if (objectiveContainerLEI != null)
            {
                FactionType faction = Service.CurrentPlayer.Faction;
                if (faction != FactionType.Rebel)
                {
                    if (faction == FactionType.Empire)
                    {
                        value = optional.EmpireLEIUid;
                    }
                }
                else
                {
                    value = optional.RebelLEIUid;
                }
            }
            if (objectiveBgCollected == null || objectiveContainer == null || objectiveContainerLEI == null || objectiveBgComplete == null || objectiveBgExpired == null)
            {
                Service.Logger.Error("ObjectiveViewData is initialized incompletely");
            }
            else
            {
                ObjectiveState state = objective.State;
                if (state != ObjectiveState.Active)
                {
                    if (state != ObjectiveState.Complete)
                    {
                        if (state == ObjectiveState.Rewarded)
                        {
                            objectiveBgCollected.Visible  = true;
                            objectiveBgExpired.Visible    = false;
                            objectiveContainer.Visible    = false;
                            objectiveContainerLEI.Visible = false;
                            objectiveBgComplete.Visible   = false;
                            objectiveBgActive.Visible     = false;
                        }
                    }
                    else
                    {
                        objectiveBgComplete.Visible   = true;
                        objectiveBgExpired.Visible    = false;
                        objectiveContainer.Visible    = false;
                        objectiveContainerLEI.Visible = false;
                        objectiveBgCollected.Visible  = false;
                        objectiveBgActive.Visible     = false;
                    }
                }
                else if (isGrace)
                {
                    objectiveBgExpired.Visible    = true;
                    objectiveBgCollected.Visible  = false;
                    objectiveContainer.Visible    = false;
                    objectiveContainerLEI.Visible = false;
                    objectiveBgComplete.Visible   = false;
                    objectiveBgActive.Visible     = false;
                }
                else
                {
                    objectiveContainerLEI.Visible = !string.IsNullOrEmpty(value);
                    objectiveContainer.Visible    = string.IsNullOrEmpty(value);
                    objectiveBgActive.Visible     = true;
                    objectiveBgExpired.Visible    = false;
                    objectiveBgCollected.Visible  = false;
                    objectiveBgComplete.Visible   = false;
                }
            }
            if (progressSlider != null)
            {
                if (objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace))
                {
                    progressSlider.Visible = true;
                    progressSlider.Value   = (float)objective.Count / (float)objective.Target;
                }
                else
                {
                    progressSlider.Visible = false;
                }
            }
            if (radialProgress != null)
            {
                if (objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace))
                {
                    radialProgress.Visible    = true;
                    radialProgress.FillAmount = (float)objective.Count / (float)objective.Target;
                }
                else
                {
                    radialProgress.Visible = false;
                }
            }
            if (expiredLabel != null)
            {
                expiredLabel.Visible = (isGrace && objective.State == ObjectiveState.Active);
            }
            if (spriteObjectiveExpired != null)
            {
                spriteObjectiveExpired.Visible = (isGrace && objective.State == ObjectiveState.Active);
            }
            if (statusLabel != null)
            {
                ObjectiveState state2 = objective.State;
                if (state2 != ObjectiveState.Active)
                {
                    if (state2 != ObjectiveState.Complete)
                    {
                        if (state2 == ObjectiveState.Rewarded)
                        {
                            statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR);
                            statusLabel.Text      = lang.Get("OBJECTIVE_COLLECTED", new object[]
                            {
                                lang.ThousandsSeparated(objective.Count),
                                lang.ThousandsSeparated(objective.Target)
                            });
                        }
                    }
                    else
                    {
                        statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR);
                        statusLabel.Text      = lang.Get("OBJECTIVE_ACTIVE_UNLOCKED", new object[]
                        {
                            lang.ThousandsSeparated(objective.Count),
                            lang.ThousandsSeparated(objective.Target)
                        });
                    }
                }
                else if (isGrace)
                {
                    statusLabel.TextColor = ObjectiveController.TEXT_RED_DIM_COLOR;
                    statusLabel.Text      = lang.Get("OBJECTIVE_EXPIRED", new object[0]);
                }
                else
                {
                    statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR);
                    statusLabel.Text      = lang.Get("OBJECTIVE_PROGRESS", new object[]
                    {
                        lang.ThousandsSeparated(objective.Count),
                        lang.ThousandsSeparated(objective.Target)
                    });
                }
            }
            if (titleLabel != null)
            {
                titleLabel.Text = lang.Get(objective.VO.ObjString, new object[]
                {
                    lang.ThousandsSeparated(objective.Target)
                });
                titleLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREY_COLOR : ObjectiveController.TEXT_WHITE_COLOR);
            }
            UXSprite uXSprite  = null;
            UXSprite uXSprite2 = null;

            if (spriteSupplyCrate != null)
            {
                spriteSupplyCrate.Tag = objectiveData;
                uXSprite2             = spriteSupplyCrate;
                ObjectiveState state3 = objective.State;
                if (state3 != ObjectiveState.Active)
                {
                    if (state3 != ObjectiveState.Complete)
                    {
                        if (state3 == ObjectiveState.Rewarded)
                        {
                            spriteCheckmark.Visible    = true;
                            spriteCheckmark.SpriteName = "IcoCheck";
                            spriteSupplyCrate.Alpha    = 0.6f;
                            spriteSupplyCrate.Visible  = true;
                        }
                    }
                    else
                    {
                        spriteCheckmark.Visible   = false;
                        spriteSupplyCrate.Alpha   = 1f;
                        spriteSupplyCrate.Visible = true;
                    }
                }
                else
                {
                    spriteCheckmark.Visible   = false;
                    spriteSupplyCrate.Visible = !isGrace;
                }
            }
            if (spritePreview != null)
            {
                spritePreview.Tag = objectiveData;
                ObjectiveState state4 = objective.State;
                if (state4 != ObjectiveState.Active)
                {
                    if (state4 != ObjectiveState.Complete)
                    {
                        if (state4 == ObjectiveState.Rewarded)
                        {
                            uXSprite2 = spritePreview;
                            uXSprite  = null;
                            spriteCheckmark.Visible    = true;
                            spriteCheckmark.SpriteName = "IcoCheck";
                        }
                    }
                    else
                    {
                        uXSprite2 = spritePreview;
                        uXSprite  = null;
                        spriteCheckmark.Visible = false;
                    }
                }
                else
                {
                    uXSprite  = spritePreview;
                    uXSprite2 = null;
                    spriteCheckmark.Visible    = isGrace;
                    spriteCheckmark.SpriteName = "icoCancelRed";
                }
            }
            if (spriteObjectiveIcon != null)
            {
                uXSprite = spriteObjectiveIcon;
            }
            if (objectiveData.GeoControlCrate != null)
            {
                objectiveData.GeoControlCrate.Destroy();
            }
            if (objectiveData.GeoControlIcon != null)
            {
                objectiveData.GeoControlIcon.Destroy();
            }
            if (uXSprite2 != null)
            {
                ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(optional, uXSprite2);
                projectorConfig.AnimState      = this.GetAnimStateFromObjectiveState(objectiveData.Objective.State);
                projectorConfig.AnimPreference = AnimationPreference.AnimationAlways;
                projectorConfig.Outline        = (objective.State == ObjectiveState.Complete);
                projectorConfig.OutlineInner   = GameConstants.CRATE_OUTLINE_INNER;
                projectorConfig.OutlineOuter   = GameConstants.CRATE_OUTLINE_OUTER;
                objectiveData.GeoControlCrate  = ProjectorUtils.GenerateProjector(projectorConfig);
                uXSprite2.Alpha = ((!flag) ? 0.5f : 1f);
            }
            if (uXSprite != null)
            {
                IGeometryVO     iconVOFromObjective = GameUtils.GetIconVOFromObjective(objectiveData.Objective.VO, objectiveData.Objective.HQ);
                ProjectorConfig projectorConfig2    = ProjectorUtils.GenerateGeometryConfig(iconVOFromObjective, uXSprite);
                projectorConfig2.AnimPreference = AnimationPreference.AnimationPreferred;
                objectiveData.GeoControlIcon    = ProjectorUtils.GenerateProjector(projectorConfig2);
                uXSprite.Alpha = ((!flag) ? 0.5f : 1f);
            }
        }
        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);
        }
Beispiel #25
0
 public GeometryTag(IGeometryVO geometry, string assetName)
 {
     this.Init(geometry, null, assetName, null, null, null);
 }
Beispiel #26
0
        private UXElement CreateInventoryGridItem(string id, PrizeType prizeType, string title, string description, int count, IGeometryVO vo, int quality)
        {
            PrizeInventoryItemTag prizeInventoryItemTag = new PrizeInventoryItemTag();
            UXElement             uXElement             = this.itemGrid.CloneTemplateItem(id);

            prizeInventoryItemTag.TileElement = uXElement;
            prizeInventoryItemTag.PrizeID     = id;
            prizeInventoryItemTag.PrizeType   = prizeType;
            uXElement.Tag = prizeInventoryItemTag;
            this.SetupGridItemQuality(id, quality);
            prizeInventoryItemTag.MainElement = this.itemGrid.GetSubElement <UXElement>(id, "ItemInfo");
            UXLabel subElement = this.itemGrid.GetSubElement <UXLabel>(id, "LabelName");

            subElement.Text = title;
            UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(id, "BtnItemInfo");

            prizeInventoryItemTag.InfoLabel = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemInfo");
            if (!string.IsNullOrEmpty(description) && prizeType != PrizeType.None)
            {
                prizeInventoryItemTag.InfoLabel.Text = description;
                subElement2.Visible   = true;
                subElement2.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked);
                subElement2.Tag       = prizeInventoryItemTag;
            }
            else
            {
                subElement2.Visible = false;
            }
            prizeInventoryItemTag.CountLabel = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemCount");
            UXSprite subElement3 = this.itemGrid.GetSubElement <UXSprite>(id, "SpriteItemImage");

            if (prizeType == PrizeType.None)
            {
                RewardUtils.SetCrateIcon(subElement3, (CrateVO)vo, AnimState.Idle);
            }
            else if (prizeType == PrizeType.Crate)
            {
                RewardUtils.SetCrateIcon(subElement3, (CrateVO)vo, AnimState.Closed);
            }
            else
            {
                RewardUtils.SetRewardIcon(subElement3, vo, AnimationPreference.NoAnimation);
            }
            prizeInventoryItemTag.IconAssetName = vo.IconAssetName;
            UXButton subElement4 = this.itemGrid.GetSubElement <UXButton>(id, "InventoryCard");

            subElement4.OnClicked = new UXButtonClickedDelegate(this.OnTileClicked);
            subElement4.Tag       = prizeInventoryItemTag;
            this.itemGrid.GetSubElement <UXElement>(id, "CountAndBuildTime").Visible = true;
            this.itemGrid.GetSubElement <UXElement>(id, "ContainerJewelNew").Visible = false;
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemExpiration");
            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(id, "LabelCurrencyAmount");

            subElement6.Visible = false;
            if (prizeType == PrizeType.None)
            {
                prizeInventoryItemTag.CountLabel.Visible = false;
                subElement5.Visible = false;
                subElement6.Text    = description;
                subElement6.Visible = true;
            }
            else if (prizeType == PrizeType.Crate)
            {
                prizeInventoryItemTag.CountLabel.Visible = false;
                CrateData crateData = this.cp.Prizes.Crates.Available[id];
                subElement5.Visible = true;
                UXUtils.SetCrateExpirationTimerLabel(crateData, subElement5, this.lang);
                if (!string.IsNullOrEmpty(crateData.PlanetId))
                {
                    PlanetVO  planetVO    = Service.StaticDataController.Get <PlanetVO>(crateData.PlanetId);
                    UXTexture subElement7 = this.itemGrid.GetSubElement <UXTexture>(id, "TexturePlanet");
                    subElement7.LoadTexture(planetVO.LeaderboardTileTexture);
                }
                if (this.crateTabLastViewedTime < crateData.ReceivedTimeStamp)
                {
                    this.itemGrid.GetSubElement <UXElement>(id, "ContainerJewelNew").Visible = true;
                    this.itemGrid.GetSubElement <UXLabel>(id, "LabelMessageCountNew").Text   = this.lang.Get("CRATE_INVENTORY_CRATE_NEW_BADGE", new object[0]);
                }
                subElement4.Tag = prizeInventoryItemTag;
            }
            else
            {
                prizeInventoryItemTag.CountLabel.Text    = string.Format("x{0}", count);
                prizeInventoryItemTag.CountLabel.Visible = true;
                subElement5.Visible = false;
            }
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemInfo").Visible        = false;
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemRequirement").Visible = false;
            this.itemGrid.GetSubElement <UXSprite>(id, "SpriteItemTimeIcon").Visible  = false;
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelBuildTime").Visible       = false;
            uXElement.Tag = prizeInventoryItemTag;
            return(uXElement);
        }
Beispiel #27
0
        private void UpdateRewardUI(CrateFlyoutItemVO crateFlyoutItemVO)
        {
            IDataController dataController = Service.Get <IDataController>();
            InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>();
            string        crateSupplyUid = crateFlyoutItemVO.CrateSupplyUid;
            CrateSupplyVO optional       = dataController.GetOptional <CrateSupplyVO>(crateSupplyUid);

            if (optional != null)
            {
                base.GetElement <UXElement>("RewardItemDefault").Visible = false;
                for (int i = 1; i <= 3; i++)
                {
                    base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[]
                    {
                        i
                    })).Visible = false;
                }
                if (optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack)
                {
                    ShardVO optional2 = Service.Get <IDataController>().GetOptional <ShardVO>(optional.RewardUid);
                    int     quality   = (int)optional2.Quality;
                    base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[]
                    {
                        quality
                    })).Visible = true;
                    base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[]
                    {
                        quality
                    })).Visible = false;
                }
                else if (optional.Type == SupplyType.Shard)
                {
                    EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(optional.RewardUid);
                    int         quality2 = (int)currentEquipmentDataByID.Quality;
                    base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[]
                    {
                        quality2
                    })).Visible = true;
                    base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[]
                    {
                        quality2
                    })).Visible = true;
                }
                else if (optional.Type == SupplyType.Troop || optional.Type == SupplyType.Hero || optional.Type == SupplyType.SpecialAttack)
                {
                    int upgradeQualityForDeployableUID = Service.Get <DeployableShardUnlockController>().GetUpgradeQualityForDeployableUID(optional.RewardUid);
                    if (upgradeQualityForDeployableUID > 0)
                    {
                        base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[]
                        {
                            upgradeQualityForDeployableUID
                        })).Visible = true;
                        base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[]
                        {
                            upgradeQualityForDeployableUID
                        })).Visible = false;
                    }
                }
                else
                {
                    base.GetElement <UXElement>("RewardItemDefault").Visible = true;
                }
                IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(optional, this.hqLevel);
                if (iconVOFromCrateSupply != null)
                {
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, this.spriteRewardImage, true);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                }
                else
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("CrateInfoModalScreen: Could not generate geometry for crate supply {0}", new object[]
                    {
                        optional.Uid
                    });
                }
                this.labelRewardChance.Text = this.lang.Get(crateFlyoutItemVO.DetailChanceString, new object[0]);
                this.labelRewardName.Text   = this.lang.Get(crateFlyoutItemVO.DetailDescString, new object[0]);
                string[] listIcons = crateFlyoutItemVO.ListIcons;
                if (listIcons != null && listIcons.Length != 0)
                {
                    this.spriteRewardIcon.SpriteName = listIcons[listIcons.Length - 1];
                }
                else
                {
                    this.spriteRewardIcon.Visible = false;
                }
                string detailTypeStringId = crateFlyoutItemVO.DetailTypeStringId;
                if (!string.IsNullOrEmpty(detailTypeStringId))
                {
                    this.labelRewardType.Visible = true;
                    string text = this.lang.Get(detailTypeStringId, new object[0]);
                    this.labelRewardType.Text = text;
                }
                else
                {
                    this.labelRewardType.Visible = false;
                }
                int    rewardAmount   = inventoryCrateRewardController.GetRewardAmount(optional, this.hqLevel);
                string text2          = this.lang.ThousandsSeparated(rewardAmount);
                string quantityString = crateFlyoutItemVO.QuantityString;
                if (!string.IsNullOrEmpty(quantityString))
                {
                    this.labelRewardAmt.Text = this.lang.Get(quantityString, new object[]
                    {
                        text2
                    });
                }
                else if (rewardAmount > 1)
                {
                    this.labelRewardAmt.Text = this.lang.Get("lcfly_quant", new object[]
                    {
                        text2
                    });
                }
                else
                {
                    this.labelRewardAmt.Visible = false;
                }
                UXSprite element  = base.GetElement <UXSprite>("SpriteLockIcon");
                UXSprite element2 = base.GetElement <UXSprite>("SpriteRewardDim");
                UXLabel  element3 = base.GetElement <UXLabel>("LabelEquipmentRequirement");
                element.Visible  = false;
                element2.Visible = false;
                element3.Visible = false;
                bool flag = crateFlyoutItemVO.ReqArmory && !ArmoryUtils.PlayerHasArmory();
                if (flag)
                {
                    element2.Visible = true;
                    element.Visible  = true;
                    element3.Visible = true;
                    element3.Text    = this.lang.Get("EQUIPMENT_ARMORY_REQUIRED", new object[0]);
                }
                this.UpdateRowHighlight(crateFlyoutItemVO.Uid, true);
                return;
            }
            Service.Get <StaRTSLogger>().ErrorFormat("CrateInfoModalScreen: Could not find crate supply {0} for crate flyout {1}", new object[]
            {
                crateSupplyUid,
                crateFlyoutItemVO.Uid
            });
        }
Beispiel #28
0
 public GeometryTag(IGeometryVO geometry, string tooltipText, BattleEntry battle)
 {
     this.Init(geometry, null, null, tooltipText, battle, null);
 }
Beispiel #29
0
 public static ProjectorConfig GenerateGeometryConfig(IGeometryVO vo, UXSprite frameSprite)
 {
     return(ProjectorUtils.GenerateGeometryConfig(vo, frameSprite, false));
 }
Beispiel #30
0
        public static void TrySetupConflictItemRewardView(TournamentRewardsVO rewardGroup, UXLabel prizeLabel, UXSprite iconSprite, UXSprite crateSprite, UXElement basicElement, UXElement advancedElement, UXElement eliteElement, UXLabel crateCountLabel, UXSprite dataFragIcon, UXLabel optionalUnitName)
        {
            IDataController dataController = Service.Get <IDataController>();
            CurrentPlayer   currentPlayer  = Service.Get <CurrentPlayer>();
            string          text           = string.Empty;
            FactionType     faction        = currentPlayer.Faction;

            if (faction != FactionType.Empire)
            {
                if (faction == FactionType.Rebel)
                {
                    text = rewardGroup.RebelGuaranteedReward;
                }
            }
            else
            {
                text = rewardGroup.EmpireGuaranteedReward;
            }
            CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(text);
            Lang          lang     = Service.Get <Lang>();

            if (optional != null)
            {
                UXUtils.TrySetupItemQualityView(optional, basicElement, advancedElement, eliteElement, null);
                int         num = currentPlayer.Map.FindHighestHqLevel();
                IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(optional, num);
                if (iconVOFromCrateSupply != null)
                {
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, iconSprite, true);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                }
                else
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("Could not generate geometry for crate supply {0}", new object[]
                    {
                        optional.Uid
                    });
                }
                if (iconVOFromCrateSupply != null)
                {
                    int shardQualityNumeric = GameUtils.GetShardQualityNumeric(optional);
                    if (shardQualityNumeric > -1)
                    {
                        dataFragIcon.SpriteName = string.Format("icoDataFragQ{0}", new object[]
                        {
                            shardQualityNumeric
                        });
                        dataFragIcon.Visible = true;
                    }
                    else
                    {
                        dataFragIcon.Visible = false;
                    }
                }
                InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>();
                int rewardAmount = inventoryCrateRewardController.GetRewardAmount(optional, num);
                if (rewardAmount > 1)
                {
                    string text2 = lang.ThousandsSeparated(rewardAmount);
                    prizeLabel.Text = lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[]
                    {
                        text2
                    });
                }
                else
                {
                    prizeLabel.Visible = false;
                }
                if (optionalUnitName != null)
                {
                    optionalUnitName.Text = inventoryCrateRewardController.GetCrateSupplyRewardName(optional);
                }
            }
            else
            {
                Service.Get <StaRTSLogger>().ErrorFormat("Could not find crate supply {0} for faction {1}", new object[]
                {
                    text,
                    currentPlayer.Faction
                });
            }
            if (crateCountLabel != null)
            {
                crateCountLabel.Visible = false;
            }
            string[] crateRewardIds = rewardGroup.CrateRewardIds;
            CrateVO  crateVO        = null;

            if (crateRewardIds != null)
            {
                if (crateRewardIds.Length != 0)
                {
                    crateVO = dataController.GetOptional <CrateVO>(rewardGroup.CrateRewardIds[0]);
                }
                if (crateCountLabel != null && crateRewardIds.Length > 1)
                {
                    crateCountLabel.Visible = true;
                    crateCountLabel.Text    = lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[]
                    {
                        crateRewardIds.Length
                    });
                }
            }
            if (crateVO != null)
            {
                RewardUtils.SetCrateIcon(crateSprite, crateVO, AnimState.Idle);
                return;
            }
            Service.Get <StaRTSLogger>().ErrorFormat("Missing crate reward meta data for tournament reward:{0}", new object[]
            {
                rewardGroup.Uid
            });
        }