示例#1
0
    /// <summary>
    /// Loads the Save Game Listing from disk
    /// </summary>
    /// <returns>ReturnObject: Status bearing object</returns>
    /// <remarks>
    /// <para>Unlike MDS, if we have no file to load, it's OK.</para>
    /// <para>When we DO load a file, it replaces the default empty GDS.GSC
    /// object that was created when GDS was initialized.</para>
    /// <para>Raises LoadSaveGameListingEvent(RO) on completion.</para>
    /// </remarks>
    ReturnObject LoadSaveGameListingData()
    {
        ReturnObject ro = new ReturnObject();

        if (File.Exists(GSCFilePath + GSDFileName))
        {
            try
            {
                string stringGSC        = File.ReadAllText(GSCFilePath + GSDFileName);
                GameStateCollection gsc = JsonConvert.DeserializeObject <GameStateCollection>(stringGSC);

                gds.GSC = gsc;

                ro = new ReturnObject(Enums.Return_Status.OK, "GSC loaded and transferred to GDS.", "GSC loaded and transferred to GDS.", null);

                //Messenger.Broadcast("PopulateSaveGameList");
            }
            catch (Exception ex)
            {
                ro = new ReturnObject(Enums.Return_Status.Error, "Error loading GDS.", "Error loading GDS: " + ex.Message, null);
            }
        }
        else
        {
            ro = new ReturnObject(Enums.Return_Status.Notice, "No GDS found on disk. NOT AN ERROR.", "No GDS found on disk. NOT AN ERROR.", null);
        }

        OnLoadSaveGameListingEvent(ro);

        return(ro);
    }
示例#2
0
 public void Initialize()
 {
     if(m_init)
     {
         return;
     }
     m_init = true;
     m_collection = new GameStateCollection(  );
     foreach( Type type in StateTypes )
     {
         AddNewGameState( type );
     }
     //this.GotoState( DefaultState, null );
     //this.GotoState(States.MainMenuState, null);
     this.GotoState(States.RunningGameState, null);
 }