コード例 #1
0
 public TournamentEndedScreen(Tournament tournament) : base("gui_tournaments")
 {
     this.tournament   = tournament;
     this.tournamentVO = Service.StaticDataController.Get <TournamentVO>(tournament.Uid);
     this.playerRank   = tournament.FinalRank;
     this.tierVO       = Service.StaticDataController.Get <TournamentTierVO>(this.playerRank.TierUid);
 }
コード例 #2
0
 private string GetTierTitleString(TournamentTierVO tierVO)
 {
     return(base.LangController.Get("CONFLICT_LEAGUE_AND_DIVISION", new object[]
     {
         base.LangController.Get(tierVO.RankName, new object[0]),
         base.LangController.Get(tierVO.DivisionSmall, new object[0])
     }));
 }
コード例 #3
0
 public static TournamentTierVO GetVOForNextTier(TournamentTierVO tierVO)
 {
     for (int i = TournamentController.tiers.Count - 1; i >= 0; i--)
     {
         if (TournamentController.tiers[i].Percentage < tierVO.Percentage)
         {
             return(TournamentController.tiers[i]);
         }
     }
     return(tierVO);
 }
コード例 #4
0
 private void UpdateTierInfoUI(TournamentTierVO tierVO, float percentile, UXSprite sprite, UXLabel tierName, UXLabel tierPercent)
 {
     if (tierVO != null)
     {
         sprite.SpriteName = this.tournamentController.GetTierIconName(tierVO);
         tierName.Text     = this.GetTierTitleString(tierVO);
         tierPercent.Text  = base.LangController.Get("CONFLICT_TIER_PERCENTILE", new object[]
         {
             Math.Round((double)percentile, 2)
         });
     }
 }
コード例 #5
0
 private void CheckForTierChangeAfterBattle(TournamentRank oldRank, TournamentRank rank, string tournamentUID)
 {
     if (oldRank != null && !string.IsNullOrEmpty(oldRank.TierUid))
     {
         IDataController  dataController    = Service.Get <IDataController>();
         TournamentTierVO tournamentTierVO  = dataController.Get <TournamentTierVO>(oldRank.TierUid);
         TournamentTierVO tournamentTierVO2 = dataController.Get <TournamentTierVO>(rank.TierUid);
         if (tournamentTierVO2.Percentage < tournamentTierVO.Percentage)
         {
             Service.Get <EventManager>().RegisterObserver(this, EventId.WorldInTransitionComplete, EventPriority.Default);
         }
     }
 }
コード例 #6
0
        private void InitLabels()
        {
            base.GetElement <UXLabel>("DialogTournamentsTitle").Text = this.lang.Get("TOURNAMENT_TIER_CHANGE_TITLE", new object[0]);
            base.GetElement <UXLabel>("LabelYourTier").Text          = this.lang.Get("TOURNAMENT_TIER_NEW", new object[0]);
            TournamentTierVO tournamentTierVO = Service.StaticDataController.Get <TournamentTierVO>(this.playerRank.TierUid);

            base.GetElement <UXLabel>("LabelTierLevel").Text = this.lang.Get("CONFLICT_TIER_CHANGE_PERCENTILE", new object[]
            {
                this.lang.Get(tournamentTierVO.RankName, new object[0]),
                this.lang.Get(tournamentTierVO.DivisionSmall, new object[0]),
                Math.Round(this.playerRank.Percentile, 2)
            });
        }
コード例 #7
0
        private string GetTierIdForPercentage(double percentile)
        {
            TournamentTierVO     tournamentTierVO     = null;
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (TournamentTierVO current in staticDataController.GetAll <TournamentTierVO>())
            {
                if (percentile <= (double)current.Percentage && (tournamentTierVO == null || tournamentTierVO.Percentage > current.Percentage))
                {
                    tournamentTierVO = current;
                }
            }
            return((tournamentTierVO != null) ? tournamentTierVO.Uid : null);
        }
コード例 #8
0
        protected override void OnScreenLoaded()
        {
            Animator component = base.Root.GetComponent <Animator>();

            if (component != null)
            {
                component.SetTrigger("Show");
            }
            this.InitLabels();
            TournamentTierVO tierVO = Service.StaticDataController.Get <TournamentTierVO>(this.playerRank.TierUid);

            base.GetElement <UXSprite>("SpriteTierIcon").SpriteName = Service.TournamentController.GetTierIconName(tierVO);
            Service.ViewTimerManager.CreateViewTimer(3f, false, new TimerDelegate(this.OnAnimationFinishedTimer), null);
        }
コード例 #9
0
        private void OnGetTournamentRank(TournamentRankResponse rankResponse, object cookie)
        {
            TournamentRank tournamentRank          = rankResponse.Rank;
            TournamentRank oldRank                 = null;
            Tournament     tournament              = null;
            Dictionary <string, object> dictionary = (Dictionary <string, object>)cookie;
            string text = (string)dictionary["tournamentId"];

            TournamentController.PlayerRankUpdatedCallback playerRankUpdatedCallback = (TournamentController.PlayerRankUpdatedCallback)dictionary["callback"];
            if (!string.IsNullOrEmpty(text))
            {
                tournament             = this.currentPlayer.TournamentProgress.GetTournament(text);
                oldRank                = tournament.CurrentRank;
                tournament.CurrentRank = tournamentRank;
                tournament.Sync(rankResponse.TournamentData);
            }
            if (tournamentRank == null)
            {
                tournamentRank = new TournamentRank();
                if (tournament != null)
                {
                    tournament.CurrentRank = tournamentRank;
                }
            }
            if (string.IsNullOrEmpty(tournamentRank.TierUid))
            {
                TournamentTierVO tournamentTierVO = null;
                IDataController  dataController   = Service.Get <IDataController>();
                foreach (TournamentTierVO current in dataController.GetAll <TournamentTierVO>())
                {
                    if (tournamentTierVO == null || current.Percentage > tournamentTierVO.Percentage)
                    {
                        tournamentTierVO       = current;
                        tournamentRank.TierUid = tournamentTierVO.Uid;
                    }
                }
                if (tournamentTierVO != null)
                {
                    tournamentRank.Percentile = (double)tournamentTierVO.Percentage;
                }
                else
                {
                    tournamentRank.Percentile = 100.0;
                }
            }
            if (playerRankUpdatedCallback != null)
            {
                playerRankUpdatedCallback(oldRank, tournamentRank, text);
            }
        }
コード例 #10
0
        public string GetTierIconName(TournamentTierVO tierVO)
        {
            string      result  = null;
            FactionType faction = Service.Get <CurrentPlayer>().Faction;

            if (faction != FactionType.Empire)
            {
                if (faction == FactionType.Rebel)
                {
                    result = tierVO.SpriteNameRebel;
                }
            }
            else
            {
                result = tierVO.SpriteNameEmpire;
            }
            return(result);
        }
コード例 #11
0
        private string GetTierIdForPercentage(double percentile)
        {
            TournamentTierVO tournamentTierVO = null;
            IDataController  dataController   = Service.Get <IDataController>();

            foreach (TournamentTierVO current in dataController.GetAll <TournamentTierVO>())
            {
                if (percentile <= (double)current.Percentage && (tournamentTierVO == null || tournamentTierVO.Percentage > current.Percentage))
                {
                    tournamentTierVO = current;
                }
            }
            if (tournamentTierVO != null)
            {
                return(tournamentTierVO.Uid);
            }
            return(null);
        }
コード例 #12
0
 private void OnTournamentRankUpdated(TournamentRank oldRank, TournamentRank rank, string tournamentUID)
 {
     if (!this.isLoaded)
     {
         return;
     }
     if (this.currentEventState == TimedEventState.Closing)
     {
         this.endedTierTitleLabel.Text = base.LangController.Get("CONFLICT_YOUR_LEAGUE", new object[0]);
         this.UpdateEndedUI();
     }
     else
     {
         if (this.currentTournamentVO == null || this.currentTournamentVO.Uid != tournamentUID)
         {
             return;
         }
         TournamentTierVO optional      = base.Sdc.GetOptional <TournamentTierVO>(rank.TierUid);
         TournamentTierVO vOForNextTier = TournamentController.GetVOForNextTier(optional);
         TournamentTierVO idForTopTier  = TournamentController.GetIdForTopTier();
         Dictionary <string, TournamentRewardsVO> tierRewardMap = TimedEventPrizeUtils.GetTierRewardMap(this.currentTournamentVO.RewardGroupId);
         TournamentRewardsVO rewardGroup  = null;
         TournamentRewardsVO rewardGroup2 = null;
         TournamentRewardsVO rewardGroup3 = null;
         if (optional != null && vOForNextTier != null && idForTopTier != null && tierRewardMap.TryGetValue(optional.Uid, out rewardGroup) && tierRewardMap.TryGetValue(vOForNextTier.Uid, out rewardGroup2) && tierRewardMap.TryGetValue(idForTopTier.Uid, out rewardGroup3))
         {
             this.UpdateTierInfoUI(optional, optional.Percentage, this.inProgressCurrentTierIconSprite, this.inProgressCurrentTierLabel, this.inProgressCurrentTierPercentLabel);
             this.inProgressCurrentTierPercentLabel.Text = base.LangController.Get("CONFLICT_TIER_PERCENTILE", new object[]
             {
                 Math.Round(rank.Percentile, 2)
             });
             this.UpdateTierInfoUI(vOForNextTier, vOForNextTier.Percentage, this.inProgressNextTierIconSprite, this.inProgressNextTierLabel, this.inProgressNextTierPercentLabel);
             this.UpdateTierInfoUI(idForTopTier, idForTopTier.Percentage, this.inProgressTopTierIconSprite, this.inProgressTopTierLabel, this.inProgressTopTierPercentLabel);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup, this.inProgressCurrentRewardLabel, this.inProgressCurrentRewardSprite, this.inProgressCurrentRewardCrateSprite, this.inProgressCurrentRewardItemCardUnit, this.inProgressCurrentRewardItemCardBasic, this.inProgressCurrentRewardItemCardAdvanced, this.inProgressCurrentRewardItemCardElite, this.currentCrateCount, this.inProgressCurrentRewardDataFragSprite, null);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup2, this.inProgressNextRewardLabel, this.inProgressNextRewardSprite, this.inProgressNextRewardCrateSprite, this.inProgressNextRewardItemCardUnit, this.inProgressNextRewardItemCardBasic, this.inProgressNextRewardItemCardAdvanced, this.inProgressNextRewardItemCardElite, this.nextCrateCount, this.inProgressNextRewardDataFragSprite, null);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup3, this.inProgressTopRewardLabel, this.inProgressTopRewardSprite, this.inProgressTopRewardCrateSprite, this.inProgressTopRewardItemCardUnit, this.inProgressTopRewardItemCardBasic, this.inProgressTopRewardItemCardAdvanced, this.inProgressTopRewardItemCardElite, this.topCrateCount, this.inProgressTopRewardDataFragSprite, null);
             this.AnimateShowNext();
         }
         else
         {
             Service.Logger.ErrorFormat("Unable to load InProgress UI, invalid tiers meta data for tournamentUID: " + tournamentUID, new object[0]);
         }
     }
 }
コード例 #13
0
        private void UpdateEndedUI()
        {
            if (this.currentTournamentVO == null)
            {
                Service.Logger.ErrorFormat("There is no Tournament to display reward on planet " + this.screen.viewingPlanetVO.Uid, new object[0]);
                return;
            }
            Tournament tournament = Service.CurrentPlayer.TournamentProgress.GetTournament(this.currentTournamentVO.Uid);

            if (tournament.FinalRank.TierUid != null)
            {
                TournamentTierVO optional = base.Sdc.GetOptional <TournamentTierVO>(tournament.FinalRank.TierUid);
                if (optional != null)
                {
                    float percentile = (float)tournament.FinalRank.Percentile;
                    this.UpdateTierInfoUI(optional, percentile, this.endedTierIconSprite, this.endedTierLabel, this.endedTierPercentLabel);
                }
            }
        }
コード例 #14
0
        protected override void OnScreenLoaded()
        {
            this.InitButtons();
            this.InitLabels();
            this.HideParentPlayScreenCloseButton();
            this.Update();
            this.tierGrid = base.GetElement <UXGrid>("LeagueGrid");
            this.tierGrid.SetTemplateItem("LeagueTemplate");
            TournamentTierVO tournamentTierVO = null;

            if (this.currentPlayerRank != null && this.currentPlayerRank.TierUid != null)
            {
                tournamentTierVO = Service.StaticDataController.Get <TournamentTierVO>(this.currentPlayerRank.TierUid);
            }
            Dictionary <string, TournamentRewardsVO> tierRewardMap = TimedEventPrizeUtils.GetTierRewardMap(this.currentTournamentVO.RewardGroupId);

            for (int i = 0; i < this.tiers.Count; i++)
            {
                this.AddTier(this.tiers[i], tournamentTierVO == this.tiers[i], i, tierRewardMap);
            }
            this.tierGrid.RepositionItemsFrameDelayed(new UXDragDelegate(this.ScrollCallback));
            Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f);
        }
コード例 #15
0
        private void UpdateComingSoonUI()
        {
            TournamentTierVO idForTopTier = TournamentController.GetIdForTopTier();

            if (idForTopTier == null)
            {
                return;
            }
            this.comingSoonTopTierTitle.Text        = base.LangController.Get("CONFLICT_TOP_LEAGUE", new object[0]);
            this.comingSoonTopRewardTitleLabel.Text = base.LangController.Get("CONFLICT_TOP_REWARD", new object[0]);
            this.UpdateTierInfoUI(idForTopTier, idForTopTier.Percentage, this.comingSoonTopTierIcon, this.comingSoonTopTierName, this.comingSoonTopTierPercent);
            Dictionary <string, TournamentRewardsVO> tierRewardMap = TimedEventPrizeUtils.GetTierRewardMap(this.currentTournamentVO.RewardGroupId);

            if (tierRewardMap.ContainsKey(idForTopTier.Uid))
            {
                TournamentRewardsVO rewardGroup = tierRewardMap[idForTopTier.Uid];
                TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup, this.comingSoonTopRewardIconLabel, this.comingSoonTopRewardSprite, this.comingSoonTopRewardCrateSprite, this.comingSoonTopRewardItemCardUnit, this.comingSoonTopRewardItemCardBasic, this.comingSoonTopRewardItemCardAdvanced, this.comingSoonTopRewardItemCardElite, this.comingSoonCrateCount, this.comingSoonTopRewardDataFragIcon, this.comingSoonTopRewardLabel);
                this.AnimateShowNext();
            }
            else
            {
                Service.Logger.ErrorFormat("No Tournament to display reward on planet " + this.screen.viewingPlanetVO.Uid, new object[0]);
            }
        }
コード例 #16
0
 private static int CompareTiers(TournamentTierVO a, TournamentTierVO b)
 {
     return(a.Percentage.CompareTo(b.Percentage));
 }
コード例 #17
0
        private void SetupConflictTransmission(TransmissionVO transmission)
        {
            this.battleLogTransmission.Visible = false;
            this.ShowGenericTransmissionGroup(false);
            this.conflictContainer.Visible            = true;
            this.squadWarEndedContainer.Visible       = false;
            this.genericTransmissionTextGroup.Visible = false;
            this.SetupTransmissionButtons(transmission);
            IDataController dataController = Service.Get <IDataController>();
            CurrentPlayer   currentPlayer  = Service.Get <CurrentPlayer>();

            this.conflictEndVO = dataController.GetOptional <TournamentVO>(transmission.TransData);
            TournamentTierVO optional = dataController.GetOptional <TournamentTierVO>(transmission.Btn1Data);

            if (this.conflictEndVO == null || optional == null)
            {
                return;
            }
            Tournament tournament = currentPlayer.TournamentProgress.GetTournament(this.conflictEndVO.Uid);

            if (tournament == null)
            {
                Service.Get <StaRTSLogger>().ErrorFormat("Tournament doesn't exist for player. tournament {0}", new object[]
                {
                    this.conflictEndVO.Uid
                });
                this.conflictMessage.Visible  = false;
                this.conflictTierIcon.Visible = false;
                return;
            }
            TournamentRank finalRank = tournament.FinalRank;
            string         text      = LangUtils.AppendPlayerFactionToKey("hn_conflict_end_message");

            this.conflictMessage.Visible  = true;
            this.conflictTierIcon.Visible = true;
            this.conflictMessage.Text     = this.lang.Get(text.ToString(), new object[]
            {
                LangUtils.GetPlanetDisplayName(this.conflictEndVO.PlanetId)
            });
            this.conflictTierIcon.SpriteName = Service.Get <TournamentController>().GetTierIconName(optional);
            this.conflictTierTitle.Text      = this.lang.Get("s_YourTier", new object[0]);
            this.conflictTierLevel.Text      = this.lang.Get("CONFLICT_LEAGUE_AND_DIVISION", new object[]
            {
                this.lang.Get(optional.RankName, new object[0]),
                this.lang.Get(optional.DivisionSmall, new object[0])
            });
            this.conflictTierPercent.Text = this.lang.Get("CONFLICT_TIER_PERCENTILE", new object[]
            {
                Math.Round(finalRank.Percentile, 2)
            });
            bool flag = TimedEventPrizeUtils.TrySetupConflictEndedRewardView(tournament.RedeemedRewards, this.holonetScreen.GetElement <UXLabel>("LabelReward"), this.holonetScreen.GetElement <UXSprite>("SpriteReward"));

            if (flag)
            {
                this.holonetScreen.GetElement <UXLabel>("LabelRewardTitle").Text = this.lang.Get("CONFLICT_END_PRIZE", new object[0]);
            }
            else
            {
                Service.Get <StaRTSLogger>().ErrorFormat("There is no reward given to player for tournament {0}", new object[]
                {
                    this.conflictEndVO.Uid
                });
            }
            Service.Get <ViewTimerManager>().CreateViewTimer(0.5f, false, new TimerDelegate(this.ShowReward), null);
        }
コード例 #18
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);
                }
            }
        }
コード例 #19
0
        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);
        }
コード例 #20
0
 private int CompareTiers(TournamentTierVO a, TournamentTierVO b)
 {
     return(a.Order.CompareTo(b.Order));
 }