Пример #1
0
        private bool IsModuleBuyed()
        {
            var planetLocalData = Planets.GetPlanet(planetId).LocalData;

            if (!planetLocalData.IsModuleRequired)
            {
                return(true);
            }
            return(Services.Modules.IsOpened(planetLocalData.module_id));
        }
Пример #2
0
        private void UpdateOpenedClosedContent()
        {
            var planet = Planets.GetPlanet(planetId);

            if (planet.State == PlanetState.Opened)
            {
                openedContent?.Activate();
                closedContent?.Deactivate();
            }
            else
            {
                openedContent?.Deactivate();
                closedContent?.Activate();
            }
        }
Пример #3
0
        private bool IsAllowBuyModuleForCurrentPlanet()
        {
            var planetLocalData = Planets.GetPlanet(planetId).LocalData;

            if (!planetLocalData.IsModuleRequired)
            {
                return(true);
            }
            ModuleTransactionState state;

            if (Services.Modules.IsAllowBuyModule(planetLocalData.module_id, out state))
            {
                return(true);
            }
            return(false);
        }
Пример #4
0
        /// <summary>
        /// Activate only modules required for this planet
        /// </summary>
        /// <param name="planetId">Target planet id</param>
        public void Setup(int planetId)
        {
            var planetLocalData = Planets.GetPlanet(planetId).LocalData;

            if (planetLocalData.IsModuleRequired)
            {
                modules.ToList().ForEach(m => {
                    if (m.moduleId <= planetLocalData.module_id)
                    {
                        m.Activate();
                    }
                    else
                    {
                        m.Deactivate();
                    }
                });
            }
            else
            {
                modules.DeactivateEnumerable();
            }
        }
Пример #5
0
        private void UpdateModules()
        {
            var planetLocalData = Services.ResourceService.PlanetNameRepository.GetPlanetNameData(planetId);

            if (!planetLocalData.IsModuleRequired)
            {
                ToggleModules(false);
            }
            else
            {
                if (Services.Modules.IsOpened(planetLocalData.module_id))
                {
                    var planetData = Planets.GetPlanet(planetId);
                    if (planetData.State == PlanetState.Opening || planetData.State == PlanetState.Opened)
                    {
                        ToggleModules(false);
                    }
                    else
                    {
                        ToggleModules(true);
                    }
                }
                else
                {
                    var planetData = Planets.GetPlanet(planetId);
                    if (planetData.State == PlanetState.Opening || planetData.State == PlanetState.Opened)
                    {
                        ToggleModules(false);
                    }
                    else
                    {
                        ToggleModules(true);
                    }
                }
            }
        }