public void InitLeaderBoardListForPlanet() { List <PlanetVO> allPlayerFacingPlanets = PlanetUtils.GetAllPlayerFacingPlanets(); for (int i = 0; i < allPlayerFacingPlanets.Count; i++) { string uid = allPlayerFacingPlanets[i].Uid; LeaderboardList <PlayerLBEntity> value = new LeaderboardList <PlayerLBEntity>(); this.LeadersByPlanet.Add(uid, value); value = new LeaderboardList <PlayerLBEntity>(); this.LeadersNearMeByPlanet.Add(uid, value); } List <TournamentVO> allLiveAndClosingTournaments = TournamentController.GetAllLiveAndClosingTournaments(); int j = 0; int count = allLiveAndClosingTournaments.Count; while (j < count) { string planetId = allLiveAndClosingTournaments[j].PlanetId; if (this.TournamentLeadersByPlanet.ContainsKey(planetId)) { Service.Logger.Error("Multiple tournaments are active on planet " + planetId); } else { this.InitTournamentListForPlanet(planetId); } j++; } }
private void InitPlanetOptionPlayerTab() { this.planetGrid.Clear(); this.planetGrid.Visible = true; this.selectedPlanet = null; List <PlanetVO> allPlayerFacingPlanets = PlanetUtils.GetAllPlayerFacingPlanets(); foreach (PlanetVO current in allPlayerFacingPlanets) { if (current != null) { this.AddPlanetButton(current, false, false); } } this.AddAllPlanetButton(); this.planetOptionPanelBackground.Height = (float)this.planetGrid.Count * this.planetGrid.CellHeight + 20f; this.planetGrid.RepositionItems(); }
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)); }