예제 #1
0
 public override void OnSaveData()
 {
     if (Loader.CurrentLoadMode == LoadMode.LoadGame || Loader.CurrentLoadMode == LoadMode.NewGame)
     {
         DebugLog.LogToFileOnly("StartSave");
         var saveData = new byte[212992];
         MainDataStore.Save(ref saveData);
         SaveAndRestore._serializableData.SaveData("RealGasStation MainDataStore", saveData);
         saveData = new byte[196608];
         MainDataStore.SaveForMoreVehicle(ref saveData);
         SaveAndRestore._serializableData.SaveData("RealGasStation saveDataForMoreVehicle", saveData);
         SaveAndRestore._serializableData.SaveData("RealGasStation resourceCategory", MainDataStore.resourceCategory);
     }
 }
        public override void OnLoadData()
        {
            MainDataStore.DataInit();
            MainDataStore.saveData               = new byte[262144];
            MainDataStore.resourceCategory       = new byte[49152];
            MainDataStore.saveDataForMoreVehicle = new byte[196608];
            DebugLog.LogToFileOnly("OnLoadData");
            DebugLog.LogToFileOnly("startload");

            MainDataStore.saveData = SaveAndRestore._serializableData.LoadData("RealGasStation MainDataStore");
            if (MainDataStore.saveData == null)
            {
                DebugLog.LogToFileOnly("no RealGasStation MainDataStore save data, please check");
            }
            else
            {
                MainDataStore.load();
            }

            MainDataStore.resourceCategory = SaveAndRestore._serializableData.LoadData("RealGasStation resourceCategory");
            if (MainDataStore.resourceCategory == null)
            {
                DebugLog.LogToFileOnly("no RealGasStation resourceCategory save data, please check");
                MainDataStore.resourceCategory = new byte[49152];
                for (int i = 0; i < MainDataStore.resourceCategory.Length; i++)
                {
                    MainDataStore.resourceCategory[i] = 0;
                }
            }
            else
            {
                //MainDataStore.load();
            }

            MainDataStore.saveDataForMoreVehicle = SaveAndRestore._serializableData.LoadData("RealGasStation saveDataForMoreVehicle");
            if (MainDataStore.saveDataForMoreVehicle == null)
            {
                DebugLog.LogToFileOnly("no RealGasStation MainDataStore saveDataForMoreVehicle, please check");
            }
            else
            {
                MainDataStore.loadForMoreVehicle();
            }
        }
 public static void gather_saveData()
 {
     MainDataStore.save();
 }