Esempio n. 1
0
        private void InitBattleStats(string id, out LeaderboardBattleHistory battleHistory)
        {
            battleHistory = null;
            bool flag = this.tab == SocialTabs.Tournament;

            this.medalGroup.Visible           = !flag;
            this.tournamentMedalGroup.Visible = flag;
            if (flag)
            {
                if (!string.IsNullOrEmpty(this.planetUid))
                {
                    this.tournamentMedalLabel.Text        = Service.Lang.ThousandsSeparated(this.player.BattleScore);
                    this.tournamentMedalSprite.SpriteName = GameUtils.GetTournamentPointIconName(this.planetUid);
                }
                else
                {
                    this.tournamentMedalGroup.Visible = false;
                }
                if (this.player.TournamentBattleHistory != null && !string.IsNullOrEmpty(this.planetUid))
                {
                    TournamentVO activeTournamentOnPlanet = TournamentController.GetActiveTournamentOnPlanet(this.planetUid);
                    if (activeTournamentOnPlanet != null)
                    {
                        this.player.TournamentBattleHistory.TryGetValue(activeTournamentOnPlanet.Uid, out battleHistory);
                    }
                }
            }
            else
            {
                this.medalLabel.Text = Service.Lang.ThousandsSeparated(this.player.BattleScore);
                battleHistory        = this.player.BattleHistory;
            }
            int num  = (battleHistory == null) ? 0 : battleHistory.AttacksWon;
            int num2 = (battleHistory == null) ? 0 : battleHistory.DefensesWon;

            this.attacksLabel.Text = Service.Lang.Get("ATTACKS_WON", new object[]
            {
                num
            });
            this.defensesLabel.Text = Service.Lang.Get("DEFENSES_WON", new object[]
            {
                num2
            });
        }
Esempio n. 2
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();
        }
Esempio n. 3
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);
        }
Esempio n. 4
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;
            }
        }
Esempio n. 5
0
        private void RefreshView(bool reloadTexture)
        {
            TournamentController tournamentController     = Service.TournamentController;
            TournamentVO         activeTournamentOnPlanet = TournamentController.GetActiveTournamentOnPlanet(this.screen.viewingPlanetVO.Uid);

            if (activeTournamentOnPlanet == null)
            {
                this.ShowNoActiveEventsAvailable();
                if (reloadTexture)
                {
                    this.timedEventFooterTexture.LoadTexture(this.screen.viewingPlanetVO.FooterTexture);
                }
            }
            else if (tournamentController.IsThisTournamentLive(activeTournamentOnPlanet))
            {
                this.timedEventFooterTexture.LoadTexture(this.screen.viewingPlanetVO.FooterConflictTexture);
            }
            else
            {
                this.timedEventFooterTexture.LoadTexture(this.screen.viewingPlanetVO.FooterTexture);
            }
            this.tournamentsView.RefreshView();
        }
        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));
        }