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); * }*/ }
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)); } }
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(); } }
//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(); }
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(); }