Esempio n. 1
0
        private void InitCrateProjector(UXSprite sprite, CrateVO crateVO)
        {
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(crateVO, sprite);

            projectorConfig.AnimState = AnimState.Closed;
            ProjectorUtils.GenerateProjector(projectorConfig);
        }
Esempio n. 2
0
        public static string GetCrateDisplayName(string crateId)
        {
            IDataController dataController = Service.Get <IDataController>();
            CrateVO         crateVO        = dataController.Get <CrateVO>(crateId);

            return(LangUtils.GetCrateDisplayName(crateVO));
        }
Esempio n. 3
0
        public static string GetCrateDisplayName(string crateId)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CrateVO crateVO = staticDataController.Get <CrateVO>(crateId);

            return(LangUtils.GetCrateDisplayName(crateVO));
        }
Esempio n. 4
0
        public CrateInfoModalScreen(string crateUid, string planetID, int hqLevel)
        {
            this.selectedRowIndex = -1;
            base..ctor("gui_modal_crateinfo");
            IDataController dataController = Service.Get <IDataController>();

            this.targetCrateVO = dataController.Get <CrateVO>(crateUid);
            string      text    = null;
            FactionType faction = Service.Get <CurrentPlayer>().Faction;

            if (faction != FactionType.Empire)
            {
                if (faction == FactionType.Rebel)
                {
                    text = this.targetCrateVO.RebelLEIUid;
                }
            }
            else
            {
                text = this.targetCrateVO.EmpireLEIUid;
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.targetLEIVO = dataController.Get <LimitedEditionItemVO>(text);
            }
            this.planetVO            = dataController.GetOptional <PlanetVO>(planetID);
            this.hqLevel             = hqLevel;
            this.filteredFlyoutItems = new List <CrateFlyoutItemVO>();
            CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>();

            string[] array = (currentPlayer.Faction == FactionType.Empire) ? this.targetCrateVO.FlyoutEmpireItems : this.targetCrateVO.FlyoutRebelItems;
            if (array != null)
            {
                int i   = 0;
                int num = array.Length;
                while (i < num)
                {
                    string            text2    = array[i];
                    CrateFlyoutItemVO optional = dataController.GetOptional <CrateFlyoutItemVO>(text2);
                    if (optional == null)
                    {
                        Service.Get <StaRTSLogger>().ErrorFormat("CrateInfoModalScreen: FlyoutItemVO Uid {0} not found", new object[]
                        {
                            text2
                        });
                    }
                    else
                    {
                        bool flag  = UXUtils.IsValidRewardItem(optional, this.planetVO, hqLevel);
                        bool flag2 = UXUtils.ShouldDisplayCrateFlyoutItem(optional, CrateFlyoutDisplayType.Flyout);
                        if ((flag & flag2) && this.filteredFlyoutItems.Count < 4)
                        {
                            this.filteredFlyoutItems.Add(optional);
                        }
                    }
                    i++;
                }
            }
        }
Esempio n. 5
0
        private void SetupRaidRewards()
        {
            this.oneStarLabel.Text   = this.lang.Get(this.raidPool.Condition1StarRewardStringId, new object[0]);
            this.twoStarLabel.Text   = this.lang.Get(this.raidPool.Condition2StarRewardStringId, new object[0]);
            this.threeStarLabel.Text = this.lang.Get(this.raidPool.Condition3StarRewardStringId, new object[0]);
            CrateVO crateVO  = Service.StaticDataController.Get <CrateVO>(this.raidPool.Crate1StarRewardId);
            CrateVO crateVO2 = Service.StaticDataController.Get <CrateVO>(this.raidPool.Crate2StarRewardId);
            CrateVO crateVO3 = Service.StaticDataController.Get <CrateVO>(this.raidPool.Crate3StarRewardId);

            this.InitCrateProjector(this.leftCrateSprite, crateVO);
            this.InitCrateProjector(this.midCrateSprite, crateVO2);
            this.InitCrateProjector(this.rightCrateSprite, crateVO3);
            this.leftContainerBtn.Tag  = crateVO.Uid;
            this.midContainerBtn.Tag   = crateVO2.Uid;
            this.rightContainerBtn.Tag = crateVO3.Uid;
        }
Esempio n. 6
0
        public static bool SetupTargetedOfferCrateRewardDisplay(RewardVO rewardVO, UXLabel itemLabel, UXSprite itemSprite)
        {
            if (string.IsNullOrEmpty(rewardVO.CrateReward))
            {
                return(false);
            }
            CrateVO optional = Service.Get <IDataController>().GetOptional <CrateVO>(rewardVO.CrateReward);

            if (optional != null)
            {
                itemLabel.Text = LangUtils.GetCrateDisplayName(optional);
                RewardUtils.SetCrateIcon(itemSprite, optional, AnimState.Closed);
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
        public static bool TrySetupConflictEndedRewardView(List <string> rewardUids, UXLabel label, UXSprite sprite)
        {
            if (rewardUids == null || rewardUids.Count == 0)
            {
                return(false);
            }
            CrateVO optional = Service.Get <IDataController>().GetOptional <CrateVO>(rewardUids[0]);

            if (optional == null)
            {
                return(false);
            }
            string uid = optional.Uid;

            label.Text = LangUtils.GetCrateDisplayName(uid);
            RewardUtils.SetCrateIcon(sprite, optional, AnimState.Closed);
            return(true);
        }
Esempio n. 8
0
        public static void SetCrateIcon(UXSprite sprite, CrateVO crateVO, AnimState animState)
        {
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(crateVO, sprite);

            if (GameConstants.CRATE_SHOW_VFX && !string.IsNullOrEmpty(crateVO.VfxAssetName) && animState == AnimState.Idle)
            {
                projectorConfig.AttachmentAssets = new string[]
                {
                    crateVO.VfxAssetName
                };
                projectorConfig.AnimPreference = AnimationPreference.AnimationAlways;
            }
            else
            {
                projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
            }
            projectorConfig.AnimState = animState;
            ProjectorUtils.GenerateProjector(projectorConfig);
        }
Esempio n. 9
0
        private void SetupDailyCrateRewardTransmission(TransmissionVO transmission)
        {
            this.genericTransmissionButtonTable.Clear();
            this.battleLogTransmission.Visible = false;
            this.ShowGenericTransmissionGroup(true);
            this.conflictContainer.Visible            = false;
            this.squadWarEndedContainer.Visible       = false;
            this.genericTransmissionTextGroup.Visible = true;
            string btnID         = "DailyCrateReward_CTA";
            string cTAButtonText = this.GetCTAButtonText(transmission);

            this.CreateGenericTableButton(btnID, cTAButtonText, "BtnGold", new UXButtonClickedDelegate(this.OnGenericCTA), 0);
            this.genericTransmissionTitle.Text = this.lang.Get("hn_daily_crate_reward_title", new object[0]);
            CrateVO crateVO = Service.Get <IDataController>().Get <CrateVO>(transmission.CrateId);

            this.genericTransmissionBody.Text = this.lang.Get("hn_daily_crate_reward_body", new object[]
            {
                LangUtils.GetCrateDisplayName(crateVO)
            });
            this.genericBtnMsg.Visible = false;
        }
Esempio n. 10
0
 public static string GetCrateDisplayName(CrateVO crateVO)
 {
     return(Service.Get <Lang>().Get("crate_title_" + crateVO.Uid, new object[0]));
 }
Esempio n. 11
0
 public static bool IsPurchasableInStore(CrateVO crateTier)
 {
     return(crateTier.Purchasable && CrateUtils.AllConditionsMet(crateTier.StorePurchasableConditions));
 }
Esempio n. 12
0
 public static bool IsVisibleInStore(CrateVO crateVO)
 {
     return(crateVO.Purchasable && CrateUtils.AllConditionsMet(crateVO.StoreVisibilityConditions));
 }
Esempio n. 13
0
 public static string GetCrateDisplayName(CrateVO crateVO)
 {
     return(Service.Lang.Get(crateVO.TitleString, new object[0]));
 }
Esempio n. 14
0
        public static CrateInfoModalScreen CreateForTargetedOfferTest(TargetedBundleVO offer, CrateVO crate)
        {
            CrateInfoModalScreen crateInfoModalScreen = CrateInfoModalScreen.CreateForTargetedOffer(offer, crate);

            crateInfoModalScreen.ignoreExpirationAutoClose = true;
            return(crateInfoModalScreen);
        }
Esempio n. 15
0
        public static CrateInfoModalScreen CreateForTargetedOffer(TargetedBundleVO offer, CrateVO crate)
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            Entity         currentHQ    = buildingLookupController.GetCurrentHQ();
            BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType;
            string         planetId     = Service.Get <CurrentPlayer>().PlanetId;

            return(new CrateInfoModalScreen(crate.Uid, planetId, buildingType.Lvl)
            {
                ModalReason = CrateInfoReason.Reason_Targeted_Offer,
                CurrentOffer = offer
            });
        }
Esempio n. 16
0
        public static CrateInfoModalScreen CreateForTargetedOffer(TargetedBundleVO offer, CrateVO crate)
        {
            BuildingLookupController buildingLookupController = Service.BuildingLookupController;
            Entity         currentHQ    = buildingLookupController.GetCurrentHQ();
            BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType;
            string         planetId     = Service.CurrentPlayer.PlanetId;
            FactionType    faction      = Service.CurrentPlayer.Faction;
            bool           flag         = ArmoryUtils.PlayerHasArmory();

            return(new CrateInfoModalScreen(crate.Uid, planetId, buildingType.Lvl, faction, flag)
            {
                ModalReason = CrateInfoReason.Reason_Targeted_Offer,
                CurrentOffer = offer
            });
        }
Esempio n. 17
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);
        }
Esempio n. 18
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
            });
        }
Esempio n. 19
0
        public TransmissionsHolonetTab(HolonetScreen holoScreen, HolonetControllerType holonetControllerType) : base(holoScreen, holonetControllerType)
        {
            base.InitializeTab("TransmissionsLogTab", "hn_transmissions_tab");
            List <TransmissionVO> transmissions = Service.HolonetController.TransmissionsController.Transmissions;
            int count = transmissions.Count;

            this.table = holoScreen.GetElement <UXTable>("TransmissionsLogTable");
            this.table.SetTemplateItem("TransmissionsLogItem");
            string title = string.Empty;
            string body  = string.Empty;

            for (int i = 0; i < count; i++)
            {
                bool           flag           = false;
                TransmissionVO transmissionVO = transmissions[i];
                switch (transmissionVO.Type)
                {
                case TransmissionType.Research:
                    title = this.lang.Get("hn_transmission_research_title", new object[]
                    {
                        this.GetResearchDisplayName(transmissionVO.TransData)
                    });
                    body = this.lang.Get("hn_transmission_research_body", new object[]
                    {
                        this.GetResearchDisplayName(transmissionVO.TransData),
                        transmissionVO.Btn1Data
                    });
                    flag = true;
                    break;

                case TransmissionType.HqUpgrade:
                    title = this.lang.Get("hn_transmission_hqupgrade_title", new object[0]);
                    body  = this.lang.Get("hn_transmission_hqupgrade_body", new object[]
                    {
                        transmissionVO.Btn1Data
                    });
                    flag = true;
                    break;

                case TransmissionType.NavigationCenterUpgrade:
                    title = this.lang.Get("hn_transmission_pcupgrade_title", new object[0]);
                    body  = this.lang.Get("hn_transmission_pcupgrade_body", new object[]
                    {
                        transmissionVO.Btn1Data
                    });
                    flag = true;
                    break;

                case TransmissionType.Conflict:
                {
                    string text  = string.Empty;
                    string text2 = string.Empty;
                    StaticDataController staticDataController = Service.StaticDataController;
                    TournamentVO         optional             = staticDataController.GetOptional <TournamentVO>(transmissionVO.TransData);
                    TournamentTierVO     optional2            = staticDataController.GetOptional <TournamentTierVO>(transmissionVO.Btn1Data);
                    if (optional != null && optional2 != null)
                    {
                        text  = LangUtils.GetPlanetDisplayName(optional.PlanetId);
                        text2 = this.lang.Get(optional2.RankName, new object[0]) + " " + this.lang.Get(optional2.Division, new object[0]);
                    }
                    title = this.lang.Get("hn_transmission_conflict_title", new object[0]);
                    body  = this.lang.Get("hn_transmission_conflict_body", new object[]
                        {
                            text,
                            text2
                        });
                    flag = true;
                    break;
                }

                case TransmissionType.WarPreparation:
                    title = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_prep_title"), new object[0]);
                    body  = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_prep_body"), new object[0]);
                    flag  = true;
                    break;

                case TransmissionType.WarStart:
                    title = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_start_title"), new object[0]);
                    body  = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_start_body"), new object[0]);
                    flag  = true;
                    break;

                case TransmissionType.WarEnded:
                    title = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_end_title"), new object[0]);
                    body  = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_end_body"), new object[0]);
                    flag  = true;
                    break;

                case TransmissionType.SquadChange:
                {
                    object[] array = (transmissionVO.TransData ?? string.Empty).Split(new char[]
                        {
                            '\\'
                        });
                    if (array.Length > 1)
                    {
                        title = this.lang.Get("hn_squad_application_accepted_title", new object[]
                            {
                                array[1]
                            });
                        body = this.lang.Get("hn_squad_application_accepted_body", array);
                    }
                    flag = true;
                    break;
                }

                case TransmissionType.GuildLevelUp:
                    title = this.lang.Get("hn_perks_squad_level_up_title", new object[0]);
                    body  = this.lang.Get("hn_perks_squad_level_up_body", new object[]
                    {
                        transmissionVO.SquadLevel
                    });
                    flag = true;
                    break;

                case TransmissionType.DailyCrateReward:
                {
                    title = this.lang.Get("hn_daily_crate_reward_title", new object[0]);
                    CrateVO crateVO = Service.StaticDataController.Get <CrateVO>(transmissionVO.CrateId);
                    body = this.lang.Get("hn_daily_crate_reward_body", new object[]
                        {
                            LangUtils.GetCrateDisplayName(crateVO)
                        });
                    flag = true;
                    break;
                }
                }
                if (flag)
                {
                    this.AddCustomTransmission(transmissionVO, title, body, i);
                }
                else
                {
                    this.AddGenericTransmission(transmissionVO, i);
                }
            }
        }
        private void AddTier(TournamentTierVO tierVO, bool isCurrent, int order, Dictionary <string, TournamentRewardsVO> tierRewardMap)
        {
            if (!tierRewardMap.ContainsKey(tierVO.Uid))
            {
                Service.Get <StaRTSLogger>().ErrorFormat("There is no reward found for tier {0}", new object[]
                {
                    tierVO.Uid
                });
                return;
            }
            string    uid        = tierVO.Uid;
            UXElement item       = this.tierGrid.CloneTemplateItem(uid);
            UXElement subElement = this.tierGrid.GetSubElement <UXElement>(uid, "CurrentLeague");

            subElement.Visible = isCurrent;
            if (isCurrent && this.currentPlayerRank != null)
            {
                string  id          = (TimedEventUtils.GetState(this.currentTournamentVO) == TimedEventState.Live) ? "CONFLICT_CURRENT_PERCENTILE" : "CONFLICT_FINAL_PERCENTILE";
                UXLabel subElement2 = this.tierGrid.GetSubElement <UXLabel>(uid, "LabelCurrentLeague");
                subElement2.Text = this.lang.Get(id, new object[]
                {
                    Math.Round(this.currentPlayerRank.Percentile, 2)
                });
            }
            float   percentage  = tierVO.Percentage;
            UXLabel subElement3 = this.tierGrid.GetSubElement <UXLabel>(uid, "LabelRequirements");

            if (percentage < 100f)
            {
                subElement3.Text = this.lang.Get("CONFLICT_TIER_REQ_PERCENTAGE", new object[]
                {
                    percentage
                });
            }
            else
            {
                subElement3.Text = this.lang.Get("CONFLICT_TIER_REQ_ANY", new object[0]);
            }
            UXLabel subElement4 = this.tierGrid.GetSubElement <UXLabel>(uid, "LabelLeagueLevel");

            subElement4.Text = this.lang.Get(tierVO.RankName, new object[0]);
            if (tierVO.Division != null)
            {
                string text = this.lang.Get(tierVO.Division, new object[0]);
                if (!string.IsNullOrEmpty(text) && text.Trim().get_Length() != 0)
                {
                    UXLabel expr_1A0 = subElement4;
                    expr_1A0.Text = expr_1A0.Text + " - " + text;
                }
            }
            UXSprite subElement5 = this.tierGrid.GetSubElement <UXSprite>(uid, "SpriteLeagueIcon");

            subElement5.SpriteName = Service.Get <TournamentController>().GetTierIconName(tierVO);
            TournamentRewardsVO tournamentRewardsVO = tierRewardMap[tierVO.Uid];
            UXGrid        subElement6   = this.tierGrid.GetSubElement <UXGrid>(uid, "GridRewardCards");
            StringBuilder stringBuilder = new StringBuilder(" (");

            stringBuilder.Append(uid);
            stringBuilder.Append(")");
            string text2 = stringBuilder.ToString();

            subElement6.SetTemplateItem("EquipmentItemCard" + text2);
            CrateVO optional = Service.Get <IDataController>().GetOptional <CrateVO>(tournamentRewardsVO.CrateRewardIds[0]);

            if (optional != null)
            {
                IDataController          dataController = Service.Get <IDataController>();
                List <CrateFlyoutItemVO> list           = new List <CrateFlyoutItemVO>();
                CurrentPlayer            currentPlayer  = Service.Get <CurrentPlayer>();
                string[] array = (currentPlayer.Faction == FactionType.Empire) ? optional.FlyoutEmpireItems : optional.FlyoutRebelItems;
                if (array != null)
                {
                    int i   = 0;
                    int num = array.Length;
                    while (i < num)
                    {
                        string            text3     = array[i];
                        CrateFlyoutItemVO optional2 = dataController.GetOptional <CrateFlyoutItemVO>(text3);
                        if (optional2 == null)
                        {
                            Service.Get <StaRTSLogger>().ErrorFormat("CrateInfoModalScreen: FlyoutItemVO Uid {0} not found", new object[]
                            {
                                text3
                            });
                        }
                        else
                        {
                            bool flag = UXUtils.ShouldDisplayCrateFlyoutItem(optional2, CrateFlyoutDisplayType.TournamentTier);
                            if (flag)
                            {
                                PlanetVO optional3      = dataController.GetOptional <PlanetVO>(this.currentTournamentVO.PlanetId);
                                int      currentHqLevel = currentPlayer.Map.FindHighestHqLevel();
                                bool     flag2          = UXUtils.IsValidRewardItem(optional2, optional3, currentHqLevel);
                                if (flag2 && (!optional2.ReqArmory || ArmoryUtils.PlayerHasArmory()) && list.Count <= 5)
                                {
                                    list.Add(optional2);
                                    string    uid2      = optional2.Uid;
                                    UXElement uXElement = subElement6.CloneTemplateItem(uid2);
                                    this.SetupCrateReward(uid2, tournamentRewardsVO, subElement6, uXElement, text2, optional2);
                                    subElement6.AddItem(uXElement, i);
                                }
                            }
                        }
                        i++;
                    }
                }
                else
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("There is no crate data for {0}", new object[]
                    {
                        tournamentRewardsVO.CrateRewardIds[0]
                    });
                }
                UXSprite subElement7 = subElement6.GetSubElement <UXSprite>(uid, "SpriteSupplyPrize");
                RewardUtils.SetCrateIcon(subElement7, optional, AnimState.Closed);
                UXButton subElement8 = subElement6.GetSubElement <UXButton>(uid, "BtnConflictPrize");
                subElement8.OnClicked = new UXButtonClickedDelegate(this.OnCrateClicked);
                subElement8.Tag       = optional.Uid;
                UXLabel subElement9 = subElement6.GetSubElement <UXLabel>(uid, "LabelPrize");
                subElement9.Text = this.lang.Get("CONFLICT_PRIZE_CRATE", new object[]
                {
                    LangUtils.GetCrateDisplayName(optional)
                });
                UXLabel subElement10 = subElement6.GetSubElement <UXLabel>(uid, "LabelPrizeNumber");
                if (tournamentRewardsVO.CrateRewardIds.Length > 1)
                {
                    subElement10.Text = this.lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[]
                    {
                        tournamentRewardsVO.CrateRewardIds.Length
                    });
                }
                else
                {
                    subElement10.Visible = false;
                    subElement6.GetSubElement <UXElement>(uid, "SpritePrizeNumberShadow").Visible = false;
                }
            }
            this.tierGrid.AddItem(item, order);
        }
Esempio n. 21
0
 public CrateRewardModalScreen(CrateVO crateVO) : base("gui_modal_rewardnotif")
 {
     this.targetCrateVO = crateVO;
 }
Esempio n. 22
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);
            }
        }