Пример #1
0
    void InitializeContinue()
    {
        if (Prefs.Exist(Prefs.LOAD_SAVE_NAME))
        {
            lastSave = Prefs.Game_SaveName();

            if (fi != null && fi.Length > 0 && fi.Any(x => x.Name == lastSave))
            {
                continueButton.interactable = true;
                isSaveGame = true;
            }
            else
            {
                if (File.Exists(JsonManager.GetFilePath(FilePath.GameDataPath) + lastSave))
                {
                    continueButton.interactable = true;
                }
                else
                {
                    continueButton.interactable = false;
                }

                isSaveGame = false;
            }
        }
    }
Пример #2
0
    void Start()
    {
        Time.timeScale = 1f;
        SpinnerGO.SetActive(true);
        manuallySwitchText.SetActive(false);
        if (tipsManager)
        {
            tipsManager.TipsText.gameObject.SetActive(true);
        }

        SceneTool.threadPriority = threadPriority;

        if (Prefs.Exist(Prefs.LOAD_LEVEL_NAME))
        {
            string scene = Prefs.Game_LevelName();
            LoadLevelAsync(scene);
        }
        else
        {
            SpinnerGO.GetComponentInChildren <Spinner>().isSpinning = false;
            Debug.LogError("Loading Error: There is no scene to load!");
        }

        if (FindObjectOfType <Camera>() != null)
        {
            MainCamera = FindObjectOfType <Camera>().gameObject;
        }
        else
        {
            MainCamera = null;
        }
    }
Пример #3
0
    void Start()
    {
        inventory  = GetComponent <Inventory>();
        objectives = GetComponent <ObjectiveManager>();
        player     = GetComponent <HFPS_GameManager>().Player;
        switcher   = player.GetComponentInChildren <ScriptManager>().GetScript <ItemSwitcher>();

        JsonManager.Settings(SaveLoadSettings, true);

        if (saveableDataPairs.Any(pair => pair.Instance == null))
        {
            Debug.LogError("[SaveGameHandler] Some of Saveable Instances are missing or it's destroyed. Please select Setup SaveGame again from the Tools menu!");
            return;
        }

        if (Prefs.Exist(Prefs.LOAD_STATE))
        {
            int loadstate = Prefs.Game_LoadState();

            if (loadstate == 0)
            {
                DeleteNextLvlData();
            }
            else if (loadstate == 1 && Prefs.Exist(Prefs.LOAD_SAVE_NAME))
            {
                string filename = Prefs.Game_SaveName();

                if (File.Exists(JsonManager.GetFilePath(FilePath.GameSavesPath) + filename))
                {
                    JsonManager.DeserializeData(filename);
                    string loadScene = (string)JsonManager.Json()["scene"];
                    lastSave = filename;

                    if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == loadScene)
                    {
                        LoadSavedSceneData(true);
                    }
                }
                else
                {
                    Debug.Log("<color=yellow>[SaveGameHandler]</color> Could not find load file: " + filename);
                    Prefs.Game_LoadState(0);
                }
            }
            else if (loadstate == 2 && Prefs.Exist(Prefs.LOAD_SAVE_NAME) && dataBetweenScenes)
            {
                JsonManager.ClearArray();
                Prefs.Game_SaveName("_NextSceneData.sav");

                if (File.Exists(JsonManager.GetFilePath(FilePath.GameDataPath) + "_NextSceneData.sav"))
                {
                    JsonManager.DeserializeData(FilePath.GameDataPath, "_NextSceneData.sav");
                    LoadSavedSceneData(false);
                }
            }
        }
    }