Ejemplo n.º 1
0
 private void Update()
 {
     if (TheForest.Utils.Input.GetButtonDown("Save"))
     {
         DateTime now = DateTime.Now;
         LevelSerializer.SaveGame("Game");
         Radical.CommitLog();
         Debug.Log(string.Format("{0:0.000}", (DateTime.Now - now).TotalSeconds));
     }
     if (LevelSerializer.CanResume && GUILayout.Button("Resume", new GUILayoutOption[0]))
     {
         LevelSerializer.Resume();
     }
     if (LevelSerializer.SavedGames.Count > 0)
     {
         GUILayout.Label("Available saved games", new GUILayoutOption[0]);
         foreach (LevelSerializer.SaveEntry saveEntry in LevelSerializer.SavedGames[LevelSerializer.PlayerName])
         {
             if (GUILayout.Button(saveEntry.Caption, new GUILayoutOption[0]))
             {
                 saveEntry.Load();
             }
         }
     }
 }
Ejemplo n.º 2
0
    void OnGUI()
    {
        if (GUILayout.Button("Save"))
        {
            //Save the game with a prefix of Game
            var t = DateTime.Now;
            LevelSerializer.SaveGame("Game");
            Radical.CommitLog();
            Debug.Log(string.Format("{0:0.000}", (DateTime.Now - t).TotalSeconds));
        }

        //Check to see if there is resume info
        if (LevelSerializer.CanResume)
        {
            if (GUILayout.Button("Resume"))
            {
                LevelSerializer.Resume();
            }
        }

        if (LevelSerializer.SavedGames.Count > 0)
        {
            GUILayout.Label("Available saved games");
            //Look for saved games under the given player name
            foreach (var g in LevelSerializer.SavedGames[LevelSerializer.PlayerName])
            {
                if (GUILayout.Button(g.Caption))
                {
                    g.Load();
                }
            }
        }
    }
Ejemplo n.º 3
0
 public void Dispose()
 {
     _deferredLoggingEnabled--;
     if (_deferredLoggingEnabled == 0)
     {
         Radical.CommitLog();
     }
 }
Ejemplo n.º 4
0
    public IEnumerator Load()
    {
        var t = DateTime.Now;

        LevelSerializer.LoadSavedLevelFromFile("DROD RPG Savefile.txt");
        Radical.CommitLog();
        Debug.Log(string.Format("{0:0.000}", (DateTime.Now - t).TotalSeconds));
        yield return(new WaitForSeconds(0));
    }
Ejemplo n.º 5
0
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(10, 10, Screen.width - 20, 40));
        if (GUI.Button(new Rect(0, 0, 180, 40), "Combat"))
        {
            game.ChangeScene("Combat");
        }
        if (GUI.Button(new Rect(190, 0, 180, 40), "Navigate"))
        {
            game.Navigate();
        }
        GUI.EndGroup();

        GUILayout.BeginArea(new Rect(10, 10, 250, Screen.height - 20));
        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Clear"))
        {
            hullManifest      = null;
            inventoryManifest = null;
            hull.Reset();
            inventory.Reset();
        }
        if (GUILayout.Button("Reset"))
        {
            hull.Reset();
            inventory.Reset();
        }
        if (GUILayout.Button("Save"))
        {
            // Save the game with a prefix of Game
            var t = DateTime.Now;
            hull.Save();
            inventory.Save();
            LevelSerializer.SaveGame("Game");
            Radical.CommitLog();
            Debug.Log(string.Format("{0:0.000}", (DateTime.Now - t).TotalSeconds));
        }

        // Check to see if there is resume info
        if (LevelSerializer.CanResume)
        {
            if (GUILayout.Button("Resume"))
            {
                LevelSerializer.Resume();
            }
        }

        if (LevelSerializer.SavedGames.Count > 0)
        {
            GUILayout.Label("Available saved games");
            // Look for saved games under the given player name
            foreach (var g in LevelSerializer.SavedGames[LevelSerializer.PlayerName])
            {
                if (GUILayout.Button(g.Caption))
                {
                    g.Load();
                }
            }
        }

        if (GUILayout.Button("Delete All"))
        {
            PlayerPrefs.DeleteAll();
        }
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }