public static PlayerResourceData InitData() { PlayerResourceData data = new PlayerResourceData(); var config = Config.ConfigData.PlayerConfig.gamePrepareConfig; if (config == null) { DebugPlus.LogError("GamePrepareConfig null! PlayerResourceData InitFail!"); return(null); } data.AddCurrencyMax(ModifierDetailRootType_Simple.OriginConfig, config.OriginalCurrencyMax); data.AddResearchMax(ModifierDetailRootType_Simple.OriginConfig, config.OriginalResearchMax); data.AddEnergyMax(ModifierDetailRootType_Simple.OriginConfig, config.OriginalEnergyMax); data.AddRoCoreMax(ModifierDetailRootType_Simple.OriginConfig, config.OriginalRoCoreMax); data.AddAIRobot_Maintenance_Max(ModifierDetailRootType_Simple.OriginConfig, config.OriginalAIRobot_Maintenance_Max); data.AddAIRobot_Builder_Max(ModifierDetailRootType_Simple.OriginConfig, config.OriginalAIRobot_Builder_Max); data.AddAIRobot_Operator_Max(ModifierDetailRootType_Simple.OriginConfig, config.OriginalAIRobot_Operator_Max); var prepareData = DataManager.Instance.gamePrepareData; data.AddCurrency(prepareData.GamePrepare_Currency); data.AddRoCore(prepareData.GamePrepare_RoCore); data.AddResearch(config.OriginalResearch); data.AddEnergy(config.OriginalEnergy); ///Init AIInfo data.AIRobotInfo.Add(ShipAIRobotType.Maintenance, prepareData.GamePrepare_AI_Maintenance); data.AIRobotInfo.Add(ShipAIRobotType.Builder, prepareData.GamePrepare_AI_Builder); data.AIRobotInfo.Add(ShipAIRobotType.Operator, prepareData.GamePrepare_AI_Operator); return(data); }
/// <summary> /// Game Save /// </summary> /// <param name="saveData"></param> public void LoadPlayerSaveData(PlayerSaveData saveData, AssemblePartGeneralSaveData partSaveData) { resourceData = PlayerResourceData.LoadSave(saveData.playerSaveData_Resource); timeData = TimeData.LoadGameSave(saveData.timeSave); materialStorageData = MaterialStorageData.LoadSaveData(saveData.materialSaveData); assemblePartData = PlayerAssemblePartData.LoadSaveData(partSaveData); }
public bool InitData() { var config = Config.ConfigData.PlayerConfig; if (config == null || config.timeConfig == null) { DebugPlus.LogError("[PlayerData] : playerConfig is null!"); return(false); } timeData = TimeData.InitData(config.timeConfig); resourceData = PlayerResourceData.InitData(); assemblePartData = PlayerAssemblePartData.InitData(); materialStorageData = new MaterialStorageData(); //Init BuildPanel UnLockBuildingPanelDataList = PlayerModule.GetUnLockBuildData(); return(true); }
/// <summary> /// Game Save /// </summary> /// <param name="saveData"></param> public static PlayerResourceData LoadSave(PlayerSaveData_Resource saveData) { PlayerResourceData data = new PlayerResourceData(); if (saveData != null) { data._currency = saveData.currentCurrency; data._currencyMax = saveData.currentCurrencyMax; data._currencyPerDay = saveData.currencyPerDay; data.currencyPerDayDetailPac = saveData.currencyPerDayDetailPac; data.currencyMaxDetailPac = saveData.currencyMaxDetailPac; data._research = saveData.currentResearch; data._researchMax = saveData.currentResearchMax; data._researchPerDay = saveData.researchPerDay; data.researchMaxDetailPac = saveData.researchMaxDetailPac; data.researchPerDayDetailPac = saveData.researchPerDayDetailPac; data._energy = saveData.currentEnergy; data._energyMax = saveData.currentEnergyMax; data.energyMaxDetailPac = saveData.energyMaxDetailPac; data.energyPerDayDetailPac = saveData.energyPerDayDetailPac; data._roCore = saveData.currentRoCore; data._roCoreMax = saveData.currentRoCoreMax; data.roCoreMaxDetailPac = saveData.roCoreMaxDetailPac; data.AIRobotInfo = saveData.currentAIRobotInfo; data._AIRobot_Builder_Max = saveData.AIRobot_Builder_Max; data.AIRobot_Builder_Max_DetailPac = saveData.AIRobot_Builder_Max_DetailPac; data._AIRobot_Maintenance_Max = saveData.AIRobot_Maintenance_Max; data.AIRobot_MaintenanceMax_DetailPac = saveData.AIRobot_Maintenance_Max_DetailPac; data._AIRobot_Operator_Max = saveData.AIRobot_Operator_Max; data.AIRobot_Operator_Max_DetailPac = saveData.AIRobot_Operator_Max_DetailPac; return(data); } DebugPlus.LogError("[PlayerSaveData_Resource] : Save is null!"); return(null); }