Example #1
0
 // ------------------------------------------------------------------------------------------------------------------------------------
 void ReadSaveInfo(bool writeDefault = false)
 // ------------------------------------------------------------------------------------------------------------------------------------
 {
     _info = FileUtils.ReadJsonObjectFromFile <SaveInfoList <SaveInfoType> >(SaveInfoFileName);
     if (_info == null)
     {
         _info = new SaveInfoList <SaveInfoType>();
         _info.InitDefaults(GetMaxNumSaveSlots());
         if (writeDefault)
         {
             WriteSaveInfo(); // will write out default
         }
     }
     else
     {
         // make sure that all of the things in the save list are actually on disk
         for (uint i = 0; i < _info.Length; i++)
         {
             if (_info[i].Used)
             {
                 _info[i].Present = File.Exists(MakeSaveFileName(i));
             }
         }
     }
     Events.SendGlobal(new SaveGameInfoChangedEvent());
 }
Example #2
0
 // ------------------------------------------------------------------------------------------------------------------------------------
 public void Initialize()
 // ------------------------------------------------------------------------------------------------------------------------------------
 {
     LoadedSave    = null;
     LoadedSaveNdx = 0;
     _info         = new SaveInfoList <SaveInfoType>();
     _info.InitDefaults(GetMaxNumSaveSlots());
     ReadSaveInfo(true);
 }