Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 private void SetupPlanets()
 {
     planets.Clear();
     foreach (int planetId in PlanetConst.PlanetIds)
     {
         PlanetInfo planetInfo = new PlanetInfo(planetId, Services);
         planets.Add(planetId, planetInfo);
     }
 }
Exemplo n.º 3
0
 private void OnPlanetChanged(PlanetInfo oldPlanet, PlanetInfo newPlanet)
 {
     if (oldPlanet != null)
     {
         LogPlanetInterval(oldPlanet);
         if (Planets.PlanetOpenCounter > 0)
         {
             LogPlanetOpenCounter(Planets.PlanetOpenCounter);
         }
     }
 }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 5
0
        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);
                }
            }
        }
Exemplo n.º 6
0
        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();
            }
        }
Exemplo n.º 7
0
 public static void OnCurrentPlanetChanged(PlanetInfo oldPlanet, PlanetInfo newPlanet)
 => CurrentPlanetChanged?.Invoke(oldPlanet, newPlanet);
Exemplo n.º 8
0
 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);
             }
         }
     }
 }
Exemplo n.º 9
0
 private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo info)
 {
     if (newState == PlanetState.Opened && info.Id > PlanetConst.EARTH_ID)
     {
         UpdateIcon();
     }
 }
Exemplo n.º 10
0
 private void OnPlanetChanged(PlanetInfo planetOld, PlanetInfo planetNew)
 {
     UpdateBg();
 }
Exemplo n.º 11
0
 private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo info)
 {
     UpdateButtonState();
 }
Exemplo n.º 12
0
 private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet)
 {
     if (newState == PlanetState.Opened)
     {
         ChangeCurrentPlanet(planet.Id);
         ResetAfterOpenedPlanet();
     }
 }
Exemplo n.º 13
0
 private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet)
 {
     if (newState == PlanetState.Opened)
     {
         MakeAvailableModuleForPlanet(planet.Data.Id);
     }
 }
Exemplo n.º 14
0
 private void LogTitanInterval(PlanetInfo planet)
 => FB.LogAppEvent("planet_interval_titan", 1, new Dictionary <string, object> {
     ["planet_id"] = 5,
     ["interval"]  = (planet.EndTime - planet.StartTime).ToTextMark()
 });
Exemplo n.º 15
0
 private void LogAsteroidsInterval(PlanetInfo planet)
 => FB.LogAppEvent("planet_interval_asteroidbelt", 1, new Dictionary <string, object> {
     ["planet_id"] = 3,
     ["interval"]  = (planet.EndTime - planet.StartTime).ToTextMark()
 });
Exemplo n.º 16
0
 public static void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planet)
 => PlanetStateChanged?.Invoke(oldState, newState, planet);
Exemplo n.º 17
0
 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;
         }
     }
 }
Exemplo n.º 18
0
 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();
         }
     }
 }