Ejemplo n.º 1
0
 public void resetLeaderboardData()
 {
     if (SaveGame.Exists(this.scoreKey))
     {
         SaveGame.Clear();
     }
 }
Ejemplo n.º 2
0
        public void LoadTests()
        {
            // Null identifier
            Assert.Catch(() =>
            {
                SaveGame.Load <string> (null, "");
            });

            // Empty identifier
            Assert.Catch(() =>
            {
                SaveGame.Load <string> ("", "");
            });

            // Simple save/load
            SaveGame.Save <string> ("test/load", "saved");
            Assert.IsTrue(SaveGame.Exists("test/load"));
            Assert.AreEqual(SaveGame.Load <string> ("test/load", "not saved"), "saved");

            // Reset to default
            Assert.IsFalse(SaveGame.Exists("test/load2"));
            Assert.AreEqual(SaveGame.Load <string> ("test/load2", "not saved"), "not saved");

            // Clear at end
            SaveGame.Clear();
        }
Ejemplo n.º 3
0
 public void ClearTests()
 {
     // Clear all
     SaveGame.Save <string> ("test/clear", "saved");
     SaveGame.Clear();
     Assert.IsFalse(SaveGame.Exists("test/clear"));
     Assert.AreEqual(SaveGame.Load <string> ("test/clear", "not saved"), "not saved");
 }
Ejemplo n.º 4
0
 public void ClearPlayerData()
 {
     for (int i = 0; i < OwnPets.Count; i++)
     {
         Destroy(OwnPets[i].gameObject);
     }
     OwnPets.Clear();
     SaveGame.Clear();
 }
Ejemplo n.º 5
0
        public void ClearStats()
        {
            SaveGame.Clear();

            time      = 0;
            star      = 0;
            items     = 0;
            jumped    = 0;
            restarted = 0;
            score     = 0;

            print("All Saves cleared.");
        }
Ejemplo n.º 6
0
        // comes from Lock all levels chapter button
        public void LockAllLevels()
        {
            SaveGame.Clear();
            gold = 0;

            for (int i = 0; i < 10; i++)
            {
                PlayerPrefs.DeleteKey(i + "level");
                PlayerPrefs.DeleteKey(i + "lastLevelVisited");
            }

            CheckLevelUnlocks();
            PlayerPrefs.DeleteKey("loadMap");

            // reset cubey to 1st level
            if (levelButtons.Count > 0)
            {
                SetCubeyPosition(levelButtons[0].transform.position);
            }
        }
Ejemplo n.º 7
0
        public void ExistsTests()
        {
            // Null identifier
            Assert.Catch(() =>
            {
                SaveGame.Exists(null);
            });

            // Empty identifier
            Assert.Catch(() =>
            {
                SaveGame.Exists("");
            });

            // Check existent
            Assert.IsFalse(SaveGame.Exists("test/exists"));
            SaveGame.Save <string> ("test/exists", "saved");
            Assert.IsTrue(SaveGame.Exists("test/exists"));

            // Clear at end
            SaveGame.Clear();
        }
Ejemplo n.º 8
0
        public void SaveTests()
        {
            // Null identifier
            Assert.Catch(() =>
            {
                SaveGame.Save <string> (null, null);
            });

            // Empty identifier
            Assert.Catch(() =>
            {
                SaveGame.Save <string> ("", null);
            });

            // Simple save/load
            SaveGame.Save <string> ("test/save", "saved");
            Assert.IsTrue(SaveGame.Exists("test/save"));
            Assert.AreEqual(SaveGame.Load <string> ("test/save", "not saved"), "saved");

            // Clear at end
            SaveGame.Clear();
        }
Ejemplo n.º 9
0
        public void DeleteTests()
        {
            // Null identifier
            Assert.Catch(() =>
            {
                SaveGame.Delete(null);
            });

            // Empty identifier
            Assert.Catch(() =>
            {
                SaveGame.Delete("");
            });

            // Simple delete
            SaveGame.Save <string> ("test/delete", "saved");
            Assert.IsTrue(SaveGame.Exists("test/delete"));
            SaveGame.Delete("test/delete");
            Assert.IsFalse(SaveGame.Exists("test/delete"));
            Assert.AreEqual(SaveGame.Load <string> ("test/delete", "not saved"), "not saved");

            // Clear at end
            SaveGame.Clear();
        }
Ejemplo n.º 10
0
 protected virtual void GeneralTab()
 {
     GUILayout.Label("Actions", EditorStyles.boldLabel);
     GUILayout.Label("The below are some general actions you can apply and manage the data on this device", EditorStyles.wordWrappedLabel);
     EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
     if (GUILayout.Button("Clear Saved Data", GUILayout.Width(150f)))
     {
         bool clear = EditorUtility.DisplayDialog(
             "Clearing Saved Data",
             "Are you sure you want to clear all saved data on this device?",
             "Yes", "No");
         if (clear)
         {
             SaveGame.Clear();
         }
     }
     if (GUILayout.Button("Save Random Data", GUILayout.Width(150f)))
     {
         string randomIdentifier = StringUtils.RandomString(8) + ".txt";
         SaveGame.Save(randomIdentifier, "This is random data");
         EditorUtility.DisplayDialog(
             "Saving Random Data",
             string.Format("Random Data genereated and saved successfully with the below information:\n- Identifier: {0}", randomIdentifier),
             "Done");
     }
     if (GUILayout.Button("Uninstall Save Game Pro", GUILayout.Width(200f)))
     {
         bool uninstall = EditorUtility.DisplayDialog(
             "Uninstalling Save Game Pro",
             "Are you sure you want to Uninstall Save Game Pro?\nNote: This action will delete all files and folders under BayatGames/SaveGamePro folder, so make sure that you don't have any folder or files under this folder.",
             "Yes", "No");
         if (uninstall)
         {
             Close();
             AssetDatabase.DeleteAsset(SaveGameConstants.SaveGameProFolder);
             EditorUtility.DisplayDialog(
                 "Uninstalling Save Game Pro",
                 "Save Game Pro Successfully Uninstalled",
                 "Done");
         }
     }
     EditorGUILayout.EndVertical();
     GUILayout.Label("Information", EditorStyles.boldLabel);
     GUILayout.Label("The below are informational and readonly fields for copy/paste and such porpuses.", EditorStyles.wordWrappedLabel);
     EditorGUILayout.BeginVertical(EditorStyles.helpBox);
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.TextField("Persistent Data Path", Application.persistentDataPath);
     if (GUILayout.Button("Copy", GUILayout.Width(80f)))
     {
         EditorGUIUtility.systemCopyBuffer = Application.persistentDataPath;
     }
     if (GUILayout.Button("Open", GUILayout.Width(80f)))
     {
         EditorUtility.RevealInFinder(Application.persistentDataPath);
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.TextField("Data Path", Application.dataPath);
     if (GUILayout.Button("Copy", GUILayout.Width(80f)))
     {
         EditorGUIUtility.systemCopyBuffer = Application.dataPath;
     }
     if (GUILayout.Button("Open", GUILayout.Width(80f)))
     {
         EditorUtility.RevealInFinder(Application.dataPath);
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.EndVertical();
 }
Ejemplo n.º 11
0
 public void ResetSave()
 {
     SaveGame.Clear();
     LoadSave();
     SceneManager.LoadScene("Menu");
 }
Ejemplo n.º 12
0
 public static void EraseData()
 {
     SaveGame.Clear();
     Debug.Log("Data erased");
 }
Ejemplo n.º 13
0
        protected virtual void OnGUI()
        {
            bool guiEnabled = GUI.enabled;

            m_ScrollPosition = EditorGUILayout.BeginScrollView(
                m_ScrollPosition,
                false,
                true,
                GUIStyle.none,
                GUI.skin.verticalScrollbar,
                GUIStyle.none);
            EditorGUILayout.Separator();
            GUILayout.BeginVertical(
                GUILayout.MinWidth(400f),
                GUILayout.MaxWidth(Screen.width),
                GUILayout.ExpandWidth(true));
            GUILayout.Label("Save Game Pro", EditorStyles.boldLabel);
            GUILayout.Label(
                "Here you can manage general Save Game Pro stuff, such as clearing and browsing save game files and applying simple operations.",
                EditorStyles.wordWrappedLabel);
            GUILayout.EndVertical();

            EditorGUILayout.Separator();

            GUILayout.Label("Single Operations", EditorStyles.boldLabel);
            GUILayout.Label("Apply any operation on the specified identifier.");
            GUILayout.BeginHorizontal(
                GUILayout.MinWidth(400f),
                GUILayout.MaxWidth(Screen.width),
                GUILayout.ExpandWidth(true));
            GUILayout.BeginVertical();
            GUILayout.Label("Identifier", CenteredText);
            m_Identifier = EditorGUILayout.TextField(m_Identifier);
            GUILayout.EndVertical();
            GUILayout.BeginVertical(GUILayout.Width(100f));
            GUILayout.Label("Action", CenteredText);
            if (GUILayout.Button("Delete"))
            {
                SaveGame.Delete(m_Identifier);
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            EditorGUILayout.Separator();

            GUILayout.Label("From To Operations", EditorStyles.boldLabel);
            GUILayout.Label("Copy or Move identifier from specified identifier to desired identifier.");
            GUILayout.BeginHorizontal(
                GUILayout.MinWidth(400f),
                GUILayout.MaxWidth(Screen.width),
                GUILayout.ExpandWidth(true));
            GUILayout.BeginVertical();
            GUILayout.Label("From", CenteredText);
            m_FromIdentifer = EditorGUILayout.TextField(m_FromIdentifer);
            GUILayout.EndVertical();
            GUILayout.BeginVertical(GUILayout.Width(100f));
            GUILayout.Label("Action", CenteredText);
            if (GUILayout.Button("Copy"))
            {
                SaveGame.Copy(m_FromIdentifer, m_ToIdentifier);
            }
            if (GUILayout.Button("Move"))
            {
                SaveGame.Move(m_FromIdentifer, m_ToIdentifier);
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Label("To", CenteredText);
            m_ToIdentifier = EditorGUILayout.TextField(m_ToIdentifier);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            EditorGUILayout.Separator();

            GUILayout.Label("General Operations", EditorStyles.boldLabel);
            GUILayout.Label("Clear all, browse saved files and apply general operations.");
            GUILayout.BeginVertical(
                GUILayout.MinWidth(400f),
                GUILayout.MaxWidth(Screen.width),
                GUILayout.ExpandWidth(true),
                GUILayout.Width(200f));
            if (GUILayout.Button("Clear All Saved Data"))
            {
                if (EditorUtility.DisplayDialog(
                        "Clear All Saved Data",
                        "Are you sure you want to clear all saved data?",
                        "Yes, Clear",
                        "No, Cancel"))
                {
                    SaveGame.Clear();
                    EditorUtility.DisplayDialog(
                        "All Saved Data Cleard",
                        "All Saved Data have been cleared.",
                        "Done");
                }
            }
            if (GUILayout.Button("Show Save Path in File Browser"))
            {
                EditorUtility.RevealInFinder(Application.persistentDataPath);
            }
            if (GUILayout.Button("Save Dummy Data"))
            {
                SaveGame.Save("dummy.data", Vector3.zero);
                EditorUtility.DisplayDialog(
                    "Dummy Data Saved",
                    "Dummy Data Saved at " + Application.persistentDataPath + "/dummy.data",
                    "Done");
            }
            if (GUILayout.Button("Uninstall Save Game Pro"))
            {
                UninstallSaveGamePro();
            }
            GUILayout.Label(Application.persistentDataPath);
            GUILayout.EndVertical();

            EditorGUILayout.Separator();

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical(
                GUILayout.MinWidth(400f),
                GUILayout.MaxWidth(Screen.width),
                GUILayout.ExpandWidth(true),
                GUILayout.Width(200f));
            GUILayout.Label("Support & News", EditorStyles.boldLabel);
            if (GUILayout.Button("Documentation"))
            {
                Application.OpenURL("https://github.com/BayatGames/SaveGamePro#documentation");
            }
            if (GUILayout.Button("Unity Asset Store"))
            {
                Application.OpenURL("https://www.assetstore.unity3d.com/#!/content/89198");
            }
            if (GUILayout.Button("Itch.io"))
            {
                Application.OpenURL("https://bayat.itch.io/save-game-pro-save-everything");
            }
            if (GUILayout.Button("GitHub"))
            {
                Application.OpenURL("https://github.com/BayatGames/SaveGamePro");
            }
            if (GUILayout.Button("Issue Tracker"))
            {
                Application.OpenURL("https://github.com/BayatGames/SaveGamePro/issues");
            }
            if (GUILayout.Button("Support"))
            {
                Application.OpenURL("https://github.com/BayatGames/Support");
            }
            if (GUILayout.Button("News"))
            {
                Application.OpenURL("https://github.com/BayatGames/Support");
            }
            if (GUILayout.Button("Email"))
            {
                Application.OpenURL("mailto:[email protected]");
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical(
                GUILayout.MinWidth(400f),
                GUILayout.MaxWidth(Screen.width),
                GUILayout.ExpandWidth(true),
                GUILayout.Width(200f));
            GUILayout.Label("Install Integrations", EditorStyles.boldLabel);
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && !Installed(PlayFabFiles);
            if (GUILayout.Button("Install PlayFab"))
            {
                Install(PlayFabIntegration, "PlayFab");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && !Installed(PlayFabPlayMakerFiles);
            if (GUILayout.Button("Install PlayFab PlayMaker"))
            {
                Install(PlayFabPlayMakerIntegration, "PlayFab PlayMaker");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && !Installed(FirebaseFiles);
            if (GUILayout.Button("Install Firebase"))
            {
                Install(FirebaseIntegration, "Firebase");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && !Installed(FirebasePlayMakerFiles);
            if (GUILayout.Button("Install Firebase PlayMaker"))
            {
                Install(FirebasePlayMakerIntegration, "Firebase PlayMaker");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && !Installed(PlayMakerFiles);
            if (GUILayout.Button("Install PlayMaker"))
            {
                Install(PlaymakerIntegration, "PlayMaker");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUILayout.EndVertical();
            GUILayout.BeginVertical(
                GUILayout.MinWidth(400f),
                GUILayout.MaxWidth(Screen.width),
                GUILayout.ExpandWidth(true),
                GUILayout.Width(200f));
            GUILayout.Label("Uninstall Integrations", EditorStyles.boldLabel);
            GUI.enabled = GUI.enabled && Installed(PlayFabFiles);
            if (GUILayout.Button("Uninstall PlayFab"))
            {
                Uninstall(PlayFabFiles, "PlayFab");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && Installed(PlayFabPlayMakerFiles);
            if (GUILayout.Button("Uninstall PlayFab PlayMaker"))
            {
                Uninstall(PlayFabPlayMakerFiles, "PlayFab PlayMaker");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && Installed(FirebaseFiles);
            if (GUILayout.Button("Uninstall Firebase"))
            {
                Uninstall(FirebaseFiles, "Firebase");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && Installed(FirebasePlayMakerFiles);
            if (GUILayout.Button("Uninstall Firebase PlayMaker"))
            {
                Uninstall(FirebasePlayMakerFiles, "Firebase PlayMaker");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUI.enabled = GUI.enabled && Installed(PlayMakerFiles);
            if (GUILayout.Button("Uninstall PlayMaker"))
            {
                Uninstall(PlayMakerFiles, "PlayMaker");
            }
            GUI.enabled = guiEnabled;
            guiEnabled  = GUI.enabled;
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.Label("Made with ❤️ by Bayat Games", CenteredText);
            EditorGUILayout.Separator();
            EditorGUILayout.EndScrollView();
        }
Ejemplo n.º 14
0
 public void DeleteX()
 {
     SaveGame.Clear();
 }
Ejemplo n.º 15
0
 private static void GenerateCode()
 {
     SaveGame.Clear();
     PlayerPrefs.DeleteAll();
 }
Ejemplo n.º 16
0
 public void Löschen()
 {
     SaveGame.Clear();
 }