示例#1
0
        /// <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");
            }
        }
示例#2
0
        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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
 public void LoadGameSaveData(GameSaveData saveData)
 {
     playerData = new PlayerData();
     playerData.LoadPlayerSaveData(saveData.playerSaveData, saveData.assembleSaveData.partSaveData);
 }
示例#5
0
 /// <summary>
 /// Load Save Data
 /// </summary>
 public void LoadAllSave(GameSaveData saveData)
 {
     PlayerManager.Instance.LoadGameSaveData(saveData);
     TechnologyDataManager.Instance.LoadTechSaveData(saveData.technologySaveData);
     MainShipManager.Instance.LoadGameSave(saveData.mainShipSaveData);
 }