Esempio n. 1
0
 public static void DeleteData(RoomObject roomToDelete)
 {
     if (SaveGame.Exists(roomToDelete.name, SaveGamePath.RoomDataPath))
     {
         SaveGame.Delete(roomToDelete.name, SaveGamePath.RoomDataPath);
     }
 }
Esempio n. 2
0
 public static void ClearData()
 {
     ins = new DataManager();
     SaveGame.Delete(MyConstant.rootSaveName);
     ins.versionData      = 0;
     ins.save_versionData = -1;
     SaveData();
 }
    public void RemoveAllReminders()
    {
        Debug.Log("All reminders removed and data cleaned");
        for (int i = 0; i < _reminders.Count; i++)
        {
            _reminders[i].Reset();
        }

        _reminders.Clear();
        SaveGame.Delete(_ACTUAL_REMINDERS_FILE_PATH);
        PlayerPrefs.DeleteKey(_DEFAULT_REMINDERS_ADDED_KEY);

        OnRemindersUpdate?.Invoke(GetAllReminders(AppManager.Instance.currentAppMode));
    }
Esempio n. 4
0
    private void SaveShop()
    {
        SaveGame.Delete("shop.txt");

        var shop = FindObjectOfType <Shop>();

        if (!shop)
        {
            return;
        }

        var shopUpgrades = shop._saleQueue.ToList();

        foreach (var shopSlot in shop.Slots)
        {
            if (shopSlot.Upgrade != null)
            {
                shopUpgrades.Add(shopSlot.Upgrade);
            }
        }

        SaveGame.Save("shop.txt", shopUpgrades.ToArray());
    }
Esempio n. 5
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();
        }
Esempio n. 6
0
 /// <summary>
 /// Delete the data from the specified path.
 /// </summary>
 public void Delete()
 {
     SaveGame.Delete(identifierInputField.text);
 }
 public void DeleteSave()
 {
     SaveGame.Delete("player.txt");
     SaveGame.Delete("shop.txt");
     Hide();
 }
Esempio n. 8
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();
        }
Esempio n. 9
0
        public void RemoveSpell()
        {
            var spellPath = saveFilePrefix + spellID;

            SaveGame.Delete(spellPath);
        }
Esempio n. 10
0
 /// <summary>
 /// Delete the saved file.
 /// </summary>
 public void Delete()
 {
     SaveGame.Delete(file.Name);
     Destroy(gameObject);
 }