/// <summary> /// Save Data /// </summary> public void SaveGameFile(int groupID, string saveName, int indexID) { GameSaveData gameSave = GameSaveData.CreateSave(groupID, indexID); GameSaveDataItem saveItem = Create_gameSaveData_GroupNav(groupID, saveName); string SaveFilePath = Application.persistentDataPath + "/SaveData"; if (!Directory.Exists(SaveFilePath)) { Directory.CreateDirectory(SaveFilePath); } ///Crete Save Group DirectoryInfo info = new DirectoryInfo(SaveFilePath); string saveGroupFilePath = SaveFilePath + "/Sav_" + saveName; if (!Directory.Exists(saveGroupFilePath)) { Directory.CreateDirectory(saveGroupFilePath); } string savePath = saveGroupFilePath + "/" + saveName + "_" + indexID + ".sav"; string savePathNav = saveGroupFilePath + "/" + saveName + "_" + indexID + ".nav"; SaveData(savePath, gameSave); SaveData(savePathNav, saveItem); if (File.Exists(savePath) && File.Exists(savePathNav)) { Debug.Log("Save Success"); } }
public static GameSaveData CreateSave(int groupID, int saveIndex) { GameSaveData saveData = new GameSaveData(); saveData.GroupID = groupID; saveData.SaveIndex = saveIndex; saveData.playerSaveData = PlayerSaveData.CreateSave(); saveData.mainShipSaveData = MainShipSaveData.CreateSave(); saveData.assembleSaveData = AssembleSaveData.CreateSave(); saveData.technologySaveData = TechnologySaveData.CreateSave(); return(saveData); }
/// <summary> /// Load Save /// </summary> private GameSaveData LoadSave(string savePath) { GameSaveData result = null; if (File.Exists(savePath)) { try { result = (GameSaveData)GetData(savePath, typeof(GameSaveData)); } catch (Exception e) { Debug.LogError(e); } } return(result); }
public void LoadGameSaveData(GameSaveData saveData) { playerData = new PlayerData(); playerData.LoadPlayerSaveData(saveData.playerSaveData, saveData.assembleSaveData.partSaveData); }
/// <summary> /// Load Save Data /// </summary> public void LoadAllSave(GameSaveData saveData) { PlayerManager.Instance.LoadGameSaveData(saveData); TechnologyDataManager.Instance.LoadTechSaveData(saveData.technologySaveData); MainShipManager.Instance.LoadGameSave(saveData.mainShipSaveData); }