public override void LoadDefaults() { SetupPlanets(); List <PlanetSave> defaultSaves = new List <PlanetSave>(); foreach (int planetId in PlanetConst.PlanetIds) { if (planetId == PlanetConst.EARTH_ID) { defaultSaves.Add(new PlanetSave { id = planetId, state = PlanetState.Opened, unlockTimer = 0 }); } else { defaultSaves.Add(new PlanetSave { id = planetId, state = PlanetState.Closed, unlockTimer = 0 }); } } LoadFromSaves(defaultSaves); currentPlanetId = PlanetConst.EARTH_ID; currentPlanet = CurrentPlanet; StartCoroutine(SetEarthStartTime()); IsLoaded = true; }
private void SetupPlanets() { planets.Clear(); foreach (int planetId in PlanetConst.PlanetIds) { PlanetInfo planetInfo = new PlanetInfo(planetId, Services); planets.Add(planetId, planetInfo); } }
private void OnPlanetChanged(PlanetInfo oldPlanet, PlanetInfo newPlanet) { if (oldPlanet != null) { LogPlanetInterval(oldPlanet); if (Planets.PlanetOpenCounter > 0) { LogPlanetOpenCounter(Planets.PlanetOpenCounter); } } }
private void LogPlanetInterval(PlanetInfo planet) { FB.LogAppEvent("planet_interval", 1, new Dictionary <string, object> { ["planet_id"] = planet.Id, ["interval"] = (planet.EndTime - planet.StartTime).ToTextMark() }); InitSeparatePlanetLoggers(); if (separatePlanetLoggers.ContainsKey(planet.Id)) { separatePlanetLoggers[planet.Id](planet); } }
public void ChangeCurrentPlanet(int newPlanetId) { if (newPlanetId == NextPlanetId && HasNextPlanet) { if (GetPlanet(newPlanetId).State == PlanetState.Opened) { PlanetInfo oldPlanet = CurrentPlanet; oldPlanet.SetEndTime(TimeService.UnixTimeInt); currentPlanetId = newPlanetId; currentPlanet = CurrentPlanet; currentPlanet.SetStartTime(TimeService.UnixTimeInt); Services.SetLoadingPlanet(CurrentPlanet.Id); PlanetOpenCounter++; GameEvents.OnCurrentPlanetChanged(oldPlanet, CurrentPlanet); } } }
public override void LoadSave(object obj) { PlanetServiceSave save = obj as PlanetServiceSave; if (save != null) { SetupPlanets(); if (save.planets != null) { LoadFromSaves(save.planets); } currentPlanetId = save.currentPlanetId; currentPlanet = CurrentPlanet; PlanetOpenCounter = save.planetOpenCounter; IsLoaded = true; } else { LoadDefaults(); } }
public static void OnCurrentPlanetChanged(PlanetInfo oldPlanet, PlanetInfo newPlanet) => CurrentPlanetChanged?.Invoke(oldPlanet, newPlanet);
private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet) { if (IsLoaded) { if (planet.Id == PlanetConst.MARS_ID) { if (newState == PlanetState.Opened || newState == PlanetState.Opening || newState == PlanetState.ReadyToOpen) { SkipState(TutorialStateName.Mars); } } } }
private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo info) { if (newState == PlanetState.Opened && info.Id > PlanetConst.EARTH_ID) { UpdateIcon(); } }
private void OnPlanetChanged(PlanetInfo planetOld, PlanetInfo planetNew) { UpdateBg(); }
private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo info) { UpdateButtonState(); }
private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet) { if (newState == PlanetState.Opened) { ChangeCurrentPlanet(planet.Id); ResetAfterOpenedPlanet(); } }
private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet) { if (newState == PlanetState.Opened) { MakeAvailableModuleForPlanet(planet.Data.Id); } }
private void LogTitanInterval(PlanetInfo planet) => FB.LogAppEvent("planet_interval_titan", 1, new Dictionary <string, object> { ["planet_id"] = 5, ["interval"] = (planet.EndTime - planet.StartTime).ToTextMark() });
private void LogAsteroidsInterval(PlanetInfo planet) => FB.LogAppEvent("planet_interval_asteroidbelt", 1, new Dictionary <string, object> { ["planet_id"] = 3, ["interval"] = (planet.EndTime - planet.StartTime).ToTextMark() });
public static void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet) => PlanetStateChanged?.Invoke(oldState, newState, planet);
private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet) { if (IsLoaded) { if (newState == PlanetState.Opened && planet.Id != PlanetConst.EARTH_ID) { planetStartTime = Services.TimeService.UnixTimeInt; offerState = SpecialOfferState.NotStarted; } } }
private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet) { if (IsLoaded) { if (newState == PlanetState.Opened) { if (GameMode.IsGame) { int countRemoved = RemoveBoosts(BoostSourceType.CoinUpgrade); UDebug.Log($"count of boosts removed: {countRemoved}"); } MakeGeneratorsManual(); } } }