示例#1
0
        private void UpdateTimeRemaining()
        {
            if (this.currentTournamentVO == null)
            {
                return;
            }
            int             secondsRemaining = TimedEventUtils.GetSecondsRemaining(this.currentTournamentVO);
            string          text             = LangUtils.FormatTime((long)secondsRemaining);
            TimedEventState timedEventState  = this.currentEventState;

            if (timedEventState != TimedEventState.Upcoming)
            {
                if (timedEventState == TimedEventState.Live)
                {
                    this.inProgressEventTimerLabel.Text = base.LangController.Get("CAMPAIGN_ENDS_IN", new object[]
                    {
                        text
                    });
                    this.comingSoonEventTimerLabel.Text = base.LangController.Get("CAMPAIGN_ENDS_IN", new object[]
                    {
                        text
                    });
                }
            }
            else
            {
                this.comingSoonEventTimerLabel.Text = base.LangController.Get("CAMPAIGN_BEGINS_IN", new object[]
                {
                    text
                });
            }
        }
        private void Update()
        {
            int             num   = 0;
            string          text  = null;
            TimedEventState state = TimedEventUtils.GetState(this.currentTournamentVO);

            if (state != TimedEventState.Upcoming)
            {
                if (state == TimedEventState.Live)
                {
                    text = "CAMPAIGN_ENDS_IN";
                    num  = TimedEventUtils.GetSecondsRemaining(this.currentTournamentVO);
                }
            }
            else
            {
                text = "CAMPAIGN_BEGINS_IN";
                num  = TimedEventUtils.GetSecondsRemaining(this.currentTournamentVO);
            }
            if (text != null)
            {
                this.countdownLabel.Text = this.lang.Get(text, new object[]
                {
                    LangUtils.FormatTime((long)num)
                });
                return;
            }
            if (this.countdownLabel.Visible)
            {
                this.countdownLabel.Visible = false;
            }
        }
示例#3
0
 public void OnViewFrameTime(float dt)
 {
     if (this.NextExpiringConflict != null && TimedEventUtils.GetState(this.NextExpiringConflict) == TimedEventState.Closing)
     {
         Service.Get <ViewTimeEngine>().UnregisterFrameTimeObserver(this);
         this.UpdateTournamentsData(true);
     }
 }
示例#4
0
 public bool ShouldShowTournamentLeaderboard(TournamentVO tournamentVO)
 {
     if (tournamentVO != null)
     {
         TimedEventState state = TimedEventUtils.GetState(tournamentVO);
         return(state == TimedEventState.Live || state == TimedEventState.Closing);
     }
     return(false);
 }
示例#5
0
        public void ReadRow(Row row)
        {
            this.Uid       = row.Uid;
            this.Title     = row.TryGetString(SaleTypeVO.COLUMN_title);
            this.SaleItems = row.TryGetStringArray(SaleTypeVO.COLUMN_saleItems);
            string dateString  = row.TryGetString(SaleTypeVO.COLUMN_startDate);
            string dateString2 = row.TryGetString(SaleTypeVO.COLUMN_endDate);

            this.StartTimestamp = TimedEventUtils.GetTimestamp(this.Uid, dateString);
            this.EndTimestamp   = TimedEventUtils.GetTimestamp(this.Uid, dateString2);
        }
示例#6
0
        public static TournamentVO GetActiveTournamentOnPlanet(string planetId)
        {
            IDataController dataController = Service.Get <IDataController>();

            foreach (TournamentVO current in dataController.GetAll <TournamentVO>())
            {
                if (current.PlanetId == planetId && TimedEventUtils.IsTimedEventActive(current))
                {
                    return(current);
                }
            }
            return(null);
        }
示例#7
0
        public void ReadRow(Row row)
        {
            this.Uid      = row.Uid;
            this.PlanetId = row.TryGetString(TournamentVO.COLUMN_planetId);
            string dateString  = row.TryGetString(TournamentVO.COLUMN_startDate);
            string dateString2 = row.TryGetString(TournamentVO.COLUMN_endDate);

            this.BackgroundTextureName = row.TryGetString(TournamentVO.COLUMN_backgroundTextureName);
            this.StartingRating        = row.TryGetInt(TournamentVO.COLUMN_startingRating);
            this.RewardGroupId         = row.TryGetString(TournamentVO.COLUMN_rewardGroupId);
            this.RewardBanner          = row.TryGetInt(TournamentVO.COLUMN_rewardBanner);
            this.StartTimestamp        = TimedEventUtils.GetTimestamp(this.Uid, dateString);
            this.EndTimestamp          = TimedEventUtils.GetTimestamp(this.Uid, dateString2);
        }
示例#8
0
        public void UpdateTournamentsData(bool canShowDialog)
        {
            this.FindNextExpiringConflict();
            this.CurrentPlanetActiveTournament = this.GetActiveTournamentOnCurrentPlanet();
            List <TournamentVO> tournamentVOs = TournamentController.GetTournamentVOs(TournamentFilter.All);

            for (int i = 0; i < tournamentVOs.Count; i++)
            {
                TournamentVO    tournamentVO = tournamentVOs[i];
                TimedEventState state        = TimedEventUtils.GetState(tournamentVO);
                if (tournamentVO != null && state != TimedEventState.Live && state != TimedEventState.Upcoming && this.IsPlayerInTournament(tournamentVO) && !this.IsTournamentRedeemed(tournamentVO))
                {
                    this.RedeemTournaments(canShowDialog);
                    return;
                }
            }
        }
示例#9
0
        public void OnViewClockTime(float dt)
        {
            if (!this.isLoaded)
            {
                return;
            }
            TimedEventState state = TimedEventUtils.GetState(this.currentTournamentVO);

            if (state != this.currentEventState)
            {
                this.RefreshView();
            }
            if (this.currentTournamentVO != null)
            {
                this.UpdateTimeRemaining();
            }
        }
        private void UpdateTimeRemaining()
        {
            TimedEventState state = TimedEventUtils.GetState(this.Campaign);
            string          text  = "";

            switch (state)
            {
            case TimedEventState.Upcoming:
            {
                int    num   = TimedEventUtils.GetSecondsRemaining(this.Campaign);
                string text2 = LangUtils.FormatTime((long)num);
                text = this.lang.Get("CAMPAIGN_BEGINS_IN", new object[]
                    {
                        text2
                    });
                break;
            }

            case TimedEventState.Live:
            {
                int    num   = TimedEventUtils.GetSecondsRemaining(this.Campaign);
                string text2 = LangUtils.FormatTime((long)num);
                text = this.lang.Get("CAMPAIGN_ENDS_IN", new object[]
                    {
                        text2
                    });
                break;
            }

            case TimedEventState.Closing:
            {
                int    num   = TimedEventUtils.GetStoreSecondsRemaining(this.Campaign);
                string text2 = LangUtils.FormatTime((long)num);
                text = this.lang.Get("REWARD_DURATION", new object[]
                    {
                        text2
                    });
                break;
            }
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.label.Text = UXUtils.WrapTextInColor(text, this.timerColor);
            }
        }
示例#11
0
 public void ReadRow(Row row)
 {
     this.Uid                              = row.Uid;
     this.StartTime                        = TimedEventUtils.GetTimestamp(this.Uid, row.TryGetString(StickerVO.COLUMN_startDate));
     this.EndTime                          = TimedEventUtils.GetTimestamp(this.Uid, row.TryGetString(StickerVO.COLUMN_endDate));
     this.Type                             = StringUtils.ParseEnum <StickerType>(row.TryGetString(StickerVO.COLUMN_type));
     this.IconAsset                        = row.TryGetString(StickerVO.COLUMN_iconAsset);
     this.LabelText                        = row.TryGetString(StickerVO.COLUMN_labelKey);
     this.LabelColor                       = row.TryGetHexValueString(StickerVO.COLUMN_labelColor);
     this.GradientColor                    = row.TryGetHexValueString(StickerVO.COLUMN_gradientColor);
     this.Priority                         = row.TryGetInt(StickerVO.COLUMN_priority);
     this.AudienceConditions               = row.TryGetStringArray(StickerVO.COLUMN_audienceConditions);
     this.MainColor                        = row.TryGetHexValueString(StickerVO.COLUMN_mainColor);
     this.TextureOverrideAssetNameRebel    = row.TryGetString(StickerVO.COLUMN_textureOverrideRebel);
     this.TextureOverrideAssetBundleRebel  = row.TryGetString(StickerVO.COLUMN_textureOverrideRebelAssetBundle);
     this.TextureOverrideAssetNameEmpire   = row.TryGetString(StickerVO.COLUMN_textureOverrideEmpire);
     this.TextureOverrideAssetBundleEmpire = row.TryGetString(StickerVO.COLUMN_textureOverrideEmpireAssetBundle);
 }
示例#12
0
        public static List <TournamentVO> GetTournamentVOs(TournamentFilter tournamentFilter)
        {
            List <TournamentVO> list           = new List <TournamentVO>();
            IDataController     dataController = Service.Get <IDataController>();

            foreach (TournamentVO current in dataController.GetAll <TournamentVO>())
            {
                if (TournamentController.IsPlanetaryConflict(current))
                {
                    bool flag;
                    switch (tournamentFilter)
                    {
                    case TournamentFilter.Live:
                        flag = TimedEventUtils.IsTimedEventLive(current);
                        break;

                    case TournamentFilter.LiveOrClosing:
                        flag = TimedEventUtils.IsTimedEventLiveOrClosing(current);
                        break;

                    case TournamentFilter.Active:
                        flag = TimedEventUtils.IsTimedEventActive(current);
                        break;

                    case TournamentFilter.All:
                        goto IL_60;

                    default:
                        goto IL_60;
                    }
IL_63:
                    if (flag)
                    {
                        list.Add(current);
                        continue;
                    }
                    continue;
IL_60:
                    flag = true;
                    goto IL_63;
                }
            }
            return(list);
        }
示例#13
0
        public void RefreshView()
        {
            this.currentTournamentVO = TournamentController.GetActiveTournamentOnPlanet(this.screen.viewingPlanetVO.Uid);
            if (this.currentTournamentVO != null)
            {
                this.comingSoonEventTitleLabel.Text = LangUtils.GetTournamentTitle(this.currentTournamentVO);
                this.currentEventState = TimedEventUtils.GetState(this.currentTournamentVO);
                this.screen.UpdatePvpPanel(this.currentEventState == TimedEventState.Live, this.currentTournamentVO);
                bool isPlayerInTournament = this.tournamentController.IsPlayerInTournament(this.currentTournamentVO);
                this.ShowTimedEventDetails(isPlayerInTournament);
            }
            else
            {
                this.observingClockTime = false;
                Service.ViewTimeEngine.UnregisterClockTimeObserver(this);
                this.currentEventState = TimedEventState.Invalid;
                this.screen.UpdatePvpPanel(false, null);
            }
            TimedEventState timedEventState = this.currentEventState;

            if (timedEventState != TimedEventState.Upcoming)
            {
                if (timedEventState == TimedEventState.Live)
                {
                    this.inProgressEventTimerLabel.TextColor = this.planetActiveTextColor;
                    this.comingSoonEventTimerLabel.TextColor = this.planetActiveTextColor;
                    this.comingSoonBg.Color            = this.planetActiveTextColor;
                    this.comingSoonBgGlow.Color        = this.planetActiveTextGlowColor;
                    this.comingSoonDividerLeft.Color   = this.planetActiveTextColor;
                    this.comingSoonDividerCenter.Color = this.planetActiveTextColor;
                }
            }
            else
            {
                this.comingSoonEventTimerLabel.TextColor = this.planetUpcomingTextColor;
                this.comingSoonBg.Color            = this.planetUpcomingTextColor;
                this.comingSoonBgGlow.Color        = this.planetUpcomingTextGlowColor;
                this.comingSoonDividerLeft.Color   = this.planetUpcomingTextColor;
                this.comingSoonDividerCenter.Color = this.planetUpcomingTextColor;
            }
            this.UpdateTimeRemaining();
        }
示例#14
0
        public bool UpdatePlanetTournamentState()
        {
            bool         result = false;
            TournamentVO activeTournamentOnPlanet = TournamentController.GetActiveTournamentOnPlanet(this.VO.Uid);

            if (activeTournamentOnPlanet != this.tournamentVO)
            {
                result = true;
            }
            else if (activeTournamentOnPlanet != null)
            {
                TimedEventState state = TimedEventUtils.GetState(this.tournamentVO);
                if (state != this.tournamentState)
                {
                    result = true;
                }
            }
            this.Tournament = activeTournamentOnPlanet;
            return(result);
        }
示例#15
0
        public void OnViewFrameTime(float dt)
        {
            if (this.selectedPlanet == null)
            {
                return;
            }
            TournamentVO activeTournamentOnPlanet = TournamentController.GetActiveTournamentOnPlanet(this.selectedPlanet.Uid);

            if (activeTournamentOnPlanet != null)
            {
                TimedEventState state = TimedEventUtils.GetState(activeTournamentOnPlanet);
                if (state == TimedEventState.Live)
                {
                    int    secondsRemaining = TimedEventUtils.GetSecondsRemaining(activeTournamentOnPlanet);
                    string text             = LangUtils.FormatTime((long)secondsRemaining);
                    this.labelUnlockPlanetTimer.Text = this.lang.Get("PLANETS_GNC_UPGRADE_CONFLICT_ENDS", new object[]
                    {
                        text
                    });
                }
                else if (state == TimedEventState.Upcoming)
                {
                    int    secondsRemaining2 = TimedEventUtils.GetSecondsRemaining(activeTournamentOnPlanet);
                    string text2             = LangUtils.FormatTime((long)secondsRemaining2);
                    this.labelUnlockPlanetTimer.Text = this.lang.Get("PLANETS_GNC_UPGRADE_NEXT_CONFLICT_BEGINS", new object[]
                    {
                        text2
                    });
                }
                else
                {
                    this.labelUnlockPlanetTimer.Text = string.Empty;
                }
            }
            else
            {
                this.labelUnlockPlanetTimer.Text = string.Empty;
            }
        }
示例#16
0
        public static TournamentVO GetActiveTournamentOnPlanet(string planetId)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            TournamentVO         result = null;

            foreach (TournamentVO current in staticDataController.GetAll <TournamentVO>())
            {
                if (!(current.PlanetId != planetId))
                {
                    if (TimedEventUtils.IsTimedEventActive(current))
                    {
                        TimedEventState state = TimedEventUtils.GetState(current);
                        if (state == TimedEventState.Live || state == TimedEventState.Closing)
                        {
                            return(current);
                        }
                        result = current;
                    }
                }
            }
            return(result);
        }
示例#17
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id != EventId.ScreenClosing)
     {
         if (id != EventId.GalaxyPlanetInfoButton)
         {
             if (id == EventId.TournamentRedeemed)
             {
                 if (this.currentTournamentVO != null)
                 {
                     TimedEventState state = TimedEventUtils.GetState(this.currentTournamentVO);
                     if (state == TimedEventState.Closing)
                     {
                         this.UpdateEndedUI();
                     }
                 }
             }
         }
         else if (this.eventInfoGroup.Visible)
         {
             this.UpdatePlanetViewDetailWithAnimation();
         }
     }
     else
     {
         if (cookie is LeaderboardsScreen)
         {
             this.screen.AnimateShowUI();
         }
         if ((cookie is TournamentTiersScreen || cookie is LeaderboardsScreen) && this.eventInfoGroup.Visible)
         {
             this.UpdatePlanetViewDetailWithAnimation();
         }
     }
     return(EatResponse.NotEaten);
 }
示例#18
0
        public void ReadRow(Row row)
        {
            this.Uid         = row.Uid;
            this.Faction     = StringUtils.ParseEnum <FactionType>(row.TryGetString(CampaignVO.COLUMN_faction));
            this.Title       = row.TryGetString(CampaignVO.COLUMN_title);
            this.Timed       = row.TryGetBool(CampaignVO.COLUMN_timed);
            this.UnlockOrder = row.TryGetInt(CampaignVO.COLUMN_unlockOrder);
            this.Description = row.TryGetString(CampaignVO.COLUMN_description);
            this.BundleName  = row.TryGetString(CampaignVO.COLUMN_bundleName);
            this.AssetName   = row.TryGetString(CampaignVO.COLUMN_assetName);
            this.Reward      = row.TryGetString(CampaignVO.COLUMN_reward);
            string dateString  = row.TryGetString(CampaignVO.COLUMN_startDate);
            string dateString2 = row.TryGetString(CampaignVO.COLUMN_endDate);

            this.IntroStory        = row.TryGetString(CampaignVO.COLUMN_introStory);
            this.PurchaseLimit     = row.TryGetInt(CampaignVO.COLUMN_purchaseLimit);
            this.TotalMasteryStars = 0;
            this.TotalMissions     = 0;
            if (this.Timed)
            {
                this.StartTimestamp = TimedEventUtils.GetTimestamp(this.Uid, dateString);
                this.EndTimestamp   = TimedEventUtils.GetTimestamp(this.Uid, dateString2);
            }
        }
示例#19
0
        public void ReadRow(Row row)
        {
            this.Uid           = row.Uid;
            this.SupplyDataUid = row.TryGetString(PlanetLootEntryVO.COLUMN_supplyDataUid);
            this.MinHQ         = row.TryGetInt(PlanetLootEntryVO.COLUMN_minHQ);
            this.MaxHQ         = row.TryGetInt(PlanetLootEntryVO.COLUMN_maxHQ);
            this.ReqArmory     = row.TryGetBool(PlanetLootEntryVO.COLUMN_reqArmory);
            this.Badge         = row.TryGetBool(PlanetLootEntryVO.COLUMN_badge);
            string text  = row.TryGetString(PlanetLootEntryVO.COLUMN_showDate);
            string text2 = row.TryGetString(PlanetLootEntryVO.COLUMN_hideDate);

            if (!string.IsNullOrEmpty(text))
            {
                this.ShowDateTimeStamp = TimedEventUtils.GetTimestamp(this.Uid, text);
            }
            if (!string.IsNullOrEmpty(text2))
            {
                this.HideDateTimeStamp = TimedEventUtils.GetTimestamp(this.Uid, text2);
            }
            this.FeatureAssetName   = row.TryGetString(PlanetLootEntryVO.COLUMN_featureAssetName);
            this.FeatureAssetBundle = row.TryGetString(PlanetLootEntryVO.COLUMN_featureAssetBundle);
            this.NotesString        = row.TryGetString(PlanetLootEntryVO.COLUMN_notesString);
            this.TypeStringID       = row.TryGetString(PlanetLootEntryVO.COLUMN_typeString);
        }
示例#20
0
        private static TournamentVO GetLiveTournamentForBonus(uint timeToCheck)
        {
            string          planetId       = Service.Get <CurrentPlayer>().PlanetId;
            IDataController dataController = Service.Get <IDataController>();

            foreach (TournamentVO current in dataController.GetAll <TournamentVO>())
            {
                if (TournamentController.IsPlanetaryConflict(current) && current.PlanetId == planetId && TimedEventUtils.IsTimedEventLive(current, timeToCheck))
                {
                    return(current);
                }
            }
            return(null);
        }
示例#21
0
 public bool IsThisTournamentLive(TournamentVO tournamentVO)
 {
     return(tournamentVO != null && TimedEventUtils.GetState(tournamentVO) == TimedEventState.Live);
 }
        public void InitPlanets(string startPlanetUid)
        {
            PlanetStatsCommand planetStatsCommand = null;
            PlanetStatsRequest planetStatsRequest = null;
            AssetManager       assetManager       = Service.Get <AssetManager>();

            if (this.updatePlanetPopulations)
            {
                this.updatePlanetPopulations = false;
                planetStatsRequest           = new PlanetStatsRequest();
                planetStatsCommand           = new PlanetStatsCommand(planetStatsRequest);
            }
            this.planetIndex = 0;
            this.planetsWithEvent.Clear();
            this.planetsWithActiveEvents.Clear();
            List <PlanetVO> allPlayerFacingPlanets = PlanetUtils.GetAllPlayerFacingPlanets();
            int             i     = 0;
            int             count = allPlayerFacingPlanets.Count;

            while (i < count)
            {
                Planet      planet = new Planet(allPlayerFacingPlanets[i]);
                AssetHandle handle = AssetHandle.Invalid;
                if (planet.VO.Uid == startPlanetUid)
                {
                    this.currentlyForegroundedPlanet = planet;
                    this.InitialPlanetPosition       = this.GetPlanetVect3Position(planet.VO.Angle, planet.VO.Radius, -planet.VO.HeightOffset);
                }
                if (planetStatsRequest != null)
                {
                    planetStatsRequest.AddPlanetID(planet.VO.Uid);
                }
                else
                {
                    planet.ThrashingPopulation = planet.VO.Population;
                }
                planet.IsCurrentPlanet = (startPlanetUid == planet.VO.Uid);
                this.planets.Add(planet);
                this.planetLookupDict[planet.VO.Uid] = planet;
                planet.Tournament = null;
                TournamentVO activeTournamentOnPlanet = TournamentController.GetActiveTournamentOnPlanet(planet.VO.Uid);
                if (activeTournamentOnPlanet != null)
                {
                    TimedEventState state = TimedEventUtils.GetState(activeTournamentOnPlanet);
                    if (state == TimedEventState.Live)
                    {
                        this.planetsWithEvent.Add(planet);
                        planet.Tournament = activeTournamentOnPlanet;
                        this.planetsWithActiveEvents.Add(planet);
                    }
                    else if (state == TimedEventState.Upcoming)
                    {
                        this.planetsWithEvent.Add(planet);
                    }
                }
                planet.UpdatePlanetTournamentState();
                assetManager.Load(ref handle, planet.VO.GalaxyAssetName, new AssetSuccessDelegate(this.OnPlanetLoaded), null, planet);
                planet.Handle = handle;
                i++;
            }
            this.UpdatePlanetsFriendData();
            this.UpdatePlanetsSquadData();
            if (planetStatsCommand != null)
            {
                Service.Get <ServerAPI>().Sync(planetStatsCommand);
            }
            this.planets.Sort(new Comparison <Planet>(this.ComparePlanetOrder));
        }
        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);
        }