Exemple #1
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}");
        }
Exemple #2
0
        private UXElement CreateCommonEquipmentCard(UXGrid grid, EquipmentVO equipment, string labelName, string labelLevel, string icon, string cardName, bool shouldAnimate, bool closeup)
        {
            CurrentPlayer currentPlayer = Service.CurrentPlayer;
            string        uid           = equipment.Uid;
            UXElement     uXElement     = grid.CloneTemplateItem(uid);

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

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

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

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

            if (uXElement2 != null)
            {
                uXElement2.SkipBoundsCalculations(true);
            }
            return(uXElement);
        }
Exemple #3
0
        private void Redraw()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CurrentPlayer        currentPlayer        = Service.CurrentPlayer;

            UXUtils.HideQualityCards(this, "TroopImage", "TroopImageQ{0}");
            int quality = (int)this.selectedEquipment.Quality;

            base.GetElement <UXElement>(string.Format("TroopImageQ{0}", quality)).Visible = true;
            base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", quality)).Visible = true;
            base.GetElement <UXElement>("TroopImage").Visible = false;
            int quality2 = (int)this.selectedEquipment.Quality;

            base.GetElement <UXLabel>(string.Format("LabelQualityQ{0}", quality2)).Text = LangUtils.GetShardQuality(this.selectedEquipment.Quality);
            UXSprite        element         = base.GetElement <UXSprite>(string.Format("SpriteTroopSelectedItemImageQ{0}", quality2));
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateEquipmentConfig(this.selectedEquipment, element, true);

            projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
            this.equipmentImage            = ProjectorUtils.GenerateProjector(projectorConfig);
            this.SetProgressBarElements(currentPlayer, quality2);
            base.SetupFragmentSprite(quality2);
            base.GetElement <UXLabel>("LabelTroopInfo").Text = this.lang.Get(this.selectedEquipment.EquipmentDescription, new object[0]);
            base.GetElement <UXLabel>(string.Format("LabelQuantityOwnQ{0}", quality2)).Visible = false;
            this.PopulateAvailablePlanetsPanel(staticDataController);
            this.SetUpUpgradeElements(false);
            base.GetElement <UXElement>("MovementSpeed").Visible      = false;
            base.GetElement <UXElement>("Range").Visible              = false;
            base.GetElement <UXElement>("UnitCapacity").Visible       = false;
            base.GetElement <UXElement>("TrainingTime").Visible       = false;
            base.GetElement <UXElement>("TrainingCost").Visible       = false;
            base.GetElement <UXElement>("InfoRow3alt").Visible        = false;
            base.GetElement <UXButton>("BtnFinish").Visible           = false;
            base.GetElement <UXButton>("ButtonPrimaryAction").Visible = false;
            this.DisplayBarsForEquipmentBuffs(staticDataController);
            if (this.forResearchLab)
            {
                this.SetUpResearchLabScreenInfo(staticDataController, currentPlayer);
            }
            else if (this.forArmoryScreen)
            {
                this.SetUpArmoryScreenInfo(currentPlayer);
            }
            else
            {
                base.GetElement <UXButton>("BtnNormal").Visible       = false;
                base.GetElement <UXLabel>("LabelRequirement").Visible = false;
                UXLabel element2 = base.GetElement <UXLabel>("DialogBldgUpgradeTitle");
                this.SetTitleText(element2, "BUILDING_INFO", this.selectedEquipment.EquipmentName, this.selectedEquipment.Lvl);
            }
            for (int i = 0; i < 4; i++)
            {
                this.SetupLeftTableItem(i, null, null);
            }
            string affectedUnit = this.GetAffectedUnit();

            if (affectedUnit != null)
            {
                this.SetupLeftTableItem(0, "EQUIPMENT_INFO_AFFECTED_UNIT", affectedUnit);
            }
            this.SetupLeftTableItem(1, "EQUIPMENT_INFO_CAPACITY", this.selectedEquipment.Size.ToString());
        }
Exemple #4
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);
        }
Exemple #5
0
        private UXElement FetchEquipmentCardGridItem(CurrentPlayer player, EquipmentVO equipmentVO, EquipmentUpgradeCatalog catalog)
        {
            UXElement    result    = this.equipmentGrid.CloneTemplateItem(equipmentVO.Uid);
            string       uid       = equipmentVO.Uid;
            EquipmentVO  nextLevel = catalog.GetNextLevel(equipmentVO);
            ShardQuality quality   = equipmentVO.Quality;

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

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

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

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

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

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

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

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