Exemplo n.º 1
0
        public static Option <string> ConstructGeneratorName(this GeneratorLocalData generatorLocalData, int planetId, System.Func <string, string> getString)
        {
            var nameObject = generatorLocalData.GetName(planetId);

            if (nameObject == null)
            {
                UDBG.LogError($"not found name for generator {generatorLocalData.id} and planet {planetId}");
                return(F.None);
            }
            else
            {
                //UDBG.Log($"generator name founded...");
                return(F.Some(getString(nameObject.name)));
            }

            /*
             * string planetName = getString(planetNameData.name);
             * string generatorName = getString(generatorLocalData.name);
             * var generatorData = getGenerator(generatorLocalData.id);
             * if(generatorData.Type == GeneratorType.Normal ) {
             *  if(planetNameData.id == 0 ) {
             *      return F.Some(generatorName);
             *  } else {
             *      return F.Some(planetName + generatorName);
             *  }
             * } else {
             *  return F.Some(generatorName);
             * }*/
        }
Exemplo n.º 2
0
        public GeneratorInfo(GeneratorInfoSave save, GeneratorData data, GeneratorLocalData localData)
        {
            save.Guard();
            this.Data                = data;
            this.LocalData           = localData;
            this.GeneratorId         = save.generatorId;
            this.IsResearched        = save.isResearched;
            this.IsEnhanced          = save.isEnhanced;
            this.GenerateTimer       = save.generateTimer;
            this.isGenerationStarted = save.isGenerationStarted;
            this.IsAutomatic         = save.isAutomatic;
            this.State               = (GeneratorState)save.state;
            this.BuyCountButtonState = save.buyCountButtonState;
            this.ProfitBoosts.Load(save.profitBoosts);
            this.TimeBoosts.Load(save.timeBoosts);

            if (GeneratorId.IsRickshawOrTaxi())
            {
                IsResearched = true;
            }
            if (IsEnhanced)
            {
                AddTimeBoost(BoostInfo.CreateTemp(kEnhanceBoostName, 10));
            }
        }
Exemplo n.º 3
0
        public override void LoadSave(object obj)
        {
            try {
                GenerationServiceSave save = obj as GenerationServiceSave;

                if (save != null)
                {
                    save.Guard();

                    if (save.generators != null)
                    {
                        Generators.ClearGenerators();
                        foreach (var item in save.generators)
                        {
                            GeneratorData      generatorData = Services.ResourceService.Generators.GetGeneratorData(item.generatorId);
                            GeneratorLocalData localData     = Services.ResourceService.GeneratorLocalData.GetLocalData(item.generatorId);
                            Generators.AddGeneratorInner(new GeneratorInfo(item, generatorData, localData));
                        }
                    }

                    Generators.ProfitBoosts.Load(save.profitSave);
                    Generators.TimeBoosts.Load(save.timeSave);
                    IsLoaded = true;
                }
                else
                {
                    LoadDefaults();
                }
            } catch (Exception exception) {
                UnityEngine.Debug.LogException(exception);
                LoadDefaults();
            }
        }
Exemplo n.º 4
0
        //public void UpdateData(GeneratorData data ) {
        //    Data = data;
        //}

        #region constructors


        public GeneratorInfo(GeneratorData data, GeneratorLocalData localData)
        {
            this.GeneratorId    = data.Id;
            IsEnhanced          = false;
            Data                = data;
            LocalData           = localData;
            GenerateTimer       = 0f;
            BuyCountButtonState = 1;
            IsResearched        = GeneratorId.IsRickshawOrTaxi();
        }
Exemplo n.º 5
0
        public GeneratorInfo(int generatorId, BoostInfo profitBoost, BoostInfo timeBoost, GeneratorData data, GeneratorLocalData localData)
        {
            this.GeneratorId = generatorId;
            this.ProfitBoosts.Add(profitBoost);
            this.TimeBoosts.Add(timeBoost);

            this.IsEnhanced          = false;
            this.Data                = data;
            this.LocalData           = localData;
            this.GenerateTimer       = 0f;
            this.BuyCountButtonState = 1;
            this.IsResearched        = generatorId.IsRickshawOrTaxi();
        }