示例#1
0
    /// <summary>
    /// Bound to the button OnClick event
    /// If not new game, tries to load the file via ILoad
    /// ILoad loads new scene async, waits until completed
    /// Sets new scene activate, then moves moves/loads objects
    /// Unloads scene
    /// <para><param name="filename"> serialized file name</param></para>
    /// <para><param name="saveslot"> which file slot to load</param></para>
    /// </summary>
    void Load()
    {
        // If not new game, load game
        if (!newgame)
        {
            bool r = SAVELOAD.Load(filename);
            loadSystem.Load(saveslot);
            // Set fileName for new games
            SETTINGS.saveFileName = filename;
            SETTINGS.saveSlot     = saveslot;
            StartCoroutine(ILoad());
            return;
        }

        // If new game, first find an open slot
        if (newgame)
        {
            if (!SAVELOAD.LoadFileCheck("file1.steameng"))
            {
                SETTINGS.saveFileName = "file1.steameng";
                SETTINGS.saveSlot     = "1";
                StartCoroutine(ILoad());
                return;
            }
            if (!SAVELOAD.LoadFileCheck("file2.steameng"))
            {
                SETTINGS.saveFileName = "file2.steameng";
                SETTINGS.saveSlot     = "2";
                StartCoroutine(ILoad());
                return;
            }
            if (!SAVELOAD.LoadFileCheck("file3.steameng"))
            {
                SETTINGS.saveFileName = "file3.steameng";
                SETTINGS.saveSlot     = "3";
                StartCoroutine(ILoad());
                return;
            }
        }

        // Default Settings for New Games
        SETTINGS.saveFileName = "file1.steameng";
        SETTINGS.saveSlot     = "1";
        StartCoroutine(ILoad());
    }
示例#2
0
 public void OnClick()
 {
     LOAD.Load();
 }