Beispiel #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;
            }
        }
Beispiel #3
0
 public Planet(PlanetVO vo)
 {
     this.THRASH_TIME          = GameConstants.GALAXY_PLANET_POPULATION_UPDATE_TIME;
     this.THRASH_DELTA_PERCENT = GameConstants.GALAXY_PLANET_POPULATION_COUNT_PERCENTAGE;
     this.VO                   = vo;
     this.thrashTimer          = 0f;
     this.ThrashingPopulation  = 0;
     this.thrashValue          = 0;
     this.IsCurrentPlanet      = false;
     this.CurrentBackUIShown   = false;
     this.FriendsOnPlanet      = new List <SocialFriendData>();
     this.CurrentPlanetFXState = PlanetFXState.Unknown;
     this.tournamentState      = TimedEventState.Invalid;
 }
Beispiel #4
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);
            }
        }
Beispiel #6
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();
        }
Beispiel #7
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);
        }
Beispiel #8
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);
        }
Beispiel #9
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);
 }
        private void RebuildPlanetEvent(Planet planet)
        {
            GalaxyViewController galaxyViewController = Service.Get <GalaxyViewController>();
            MiscElementsManager  miscElementsManager  = Service.Get <UXController>().MiscElementsManager;

            this.UpdateEventEffectStatus(planet);
            AssetManager assetManager = Service.Get <AssetManager>();

            if (planet.ParticleFXHandle != AssetHandle.Invalid)
            {
                assetManager.Unload(planet.ParticleFXHandle);
                planet.ParticleFXHandle = AssetHandle.Invalid;
            }
            planet.DestroyParticles();
            int arg_52_0 = 0;
            int b        = this.planetParticleCount - 1;

            this.planetParticleCount = b;
            this.planetParticleCount = Mathf.Max(arg_52_0, b);
            if (planet.Tournament == null)
            {
                if (this.planetsWithActiveEvents.Contains(planet))
                {
                    this.planetsWithActiveEvents.Remove(planet);
                }
                if (this.planetsWithEvent.Contains(planet))
                {
                    this.planetsWithEvent.Remove(planet);
                }
                galaxyViewController.HideBackgroundPlanetUI(planet);
            }
            else
            {
                AssetHandle     particleFXHandle = AssetHandle.Invalid;
                TimedEventState tournamentState  = planet.TournamentState;
                if (tournamentState != TimedEventState.Upcoming)
                {
                    if (tournamentState == TimedEventState.Live)
                    {
                        if (!this.planetsWithEvent.Contains(planet))
                        {
                            this.planetsWithEvent.Add(planet);
                        }
                        if (!this.planetsWithActiveEvents.Contains(planet))
                        {
                            this.planetsWithActiveEvents.Add(planet);
                        }
                        assetManager.Load(ref particleFXHandle, "fx_planet_Conflict", new AssetSuccessDelegate(this.OnEventParticleFXLoaded), null, planet);
                    }
                    else
                    {
                        if (this.planetsWithEvent.Contains(planet))
                        {
                            this.planetsWithEvent.Remove(planet);
                        }
                        if (this.planetsWithActiveEvents.Contains(planet))
                        {
                            this.planetsWithActiveEvents.Remove(planet);
                        }
                    }
                }
                else
                {
                    if (!this.planetsWithEvent.Contains(planet))
                    {
                        this.planetsWithEvent.Add(planet);
                    }
                    assetManager.Load(ref particleFXHandle, "fx_planet_Imminent", new AssetSuccessDelegate(this.OnEventParticleFXLoaded), null, planet);
                }
                planet.ParticleFXHandle = particleFXHandle;
                miscElementsManager.DestroyPlanetBackgroundUI(planet);
                miscElementsManager.CreatePlanetBackgroundUI(planet);
            }
            miscElementsManager.UpdateFrontPlanetEventTimer();
        }
        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));
        }
        public static bool IsTimedEventClosing(ITimedEventVO eventVO, uint timeToCheck)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO, timeToCheck);

            return(state == TimedEventState.Closing);
        }
        public static bool IsTimedEventActive(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

            return(state != TimedEventState.Invalid && state != TimedEventState.Hidden);
        }
        public static bool IsTimedEventLiveOrClosing(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

            return(state == TimedEventState.Live || state == TimedEventState.Closing);
        }
        public static bool IsTimedEventLive(ITimedEventVO eventVO, uint timeToCheck)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO, timeToCheck);

            return(state == TimedEventState.Live);
        }
        public static bool IsTimedEventLive(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

            return(state == TimedEventState.Live);
        }