Exemplo n.º 1
0
    protected override void OnCmpEnable()
    {
        List <string> allFiles = SaveLoader.GetAllFiles();

        foreach (string item in allFiles)
        {
            AddExistingSaveFile(item);
        }
        SpeedControlScreen.Instance.Pause(true);
    }
 // Start is called before the first frame update
 void Start()
 {
     sessionManager = FindObjectOfType <SessionManager>();
     saveLoader     = FindObjectOfType <SaveLoader>();
     scoreKeeper    = FindObjectOfType <ScoreKeeper>();
     endScreenContainer.SetActive(false);
     gameContainer.SetActive(false);
     intro.SetActive(true);
     Invoke("StartNewRound", 3f);
 }
Exemplo n.º 3
0
    public void OnClickNewSave()
    {
        FileNameDialog fileNameDialog = (FileNameDialog)KScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.FileNameDialog.gameObject, base.transform.parent.gameObject);

        fileNameDialog.onConfirm = delegate(string filename)
        {
            filename = Path.Combine(SaveLoader.GetSavePrefixAndCreateFolder(), filename);
            Save(filename);
        };
    }
Exemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     sessionManager     = FindObjectOfType <SessionManager>();
     scoreText.text     = "0";
     saveLoader         = FindObjectOfType <SaveLoader>();
     scoreKeeper        = FindObjectOfType <ScoreKeeper>();
     antonymsSfxManager = FindObjectOfType <AntonymsSfxManager>();
     endScreenContainer.SetActive(false);
     gameContainer.SetActive(false);
     Invoke("SetupGame", 3f);
 }
Exemplo n.º 5
0
        public bool OpenFile(string path, FileType fileType)
        {
            _dataModule = SaveLoader.LoadFromFile(path);
            if (_dataModule != null)
            {
                _SetCurrentFile(path, fileType);
                SelectPass(0);
            }

            return(_dataModule != null);
        }
Exemplo n.º 6
0
            /// <summary>
            /// Applied before DelayedSave runs.
            /// </summary>
            internal static System.Collections.IEnumerator Postfix(
                System.Collections.IEnumerator result, string filename, bool isAutoSave,
                Game.SavingPostCB ___activatePostCB, bool updateSavePointer,
                Game.SavingActiveCB ___activateActiveCB)
            {
                if (isAutoSave)
                {
                    // Wait for player to stop dragging
                    while (PlayerController.Instance.IsDragging())
                    {
                        yield return(null);
                    }
                    PlayerController.Instance.AllowDragging(false);
                    BackgroundAutosave.DisableSaving();
                    try {
                        yield return(null);

                        if (___activateActiveCB != null)
                        {
                            ___activateActiveCB();
                            yield return(null);
                        }
                        // Save in the background
                        Game.Instance.timelapser.SaveColonyPreview(filename);
                        BackgroundAutosave.Instance.StartSave(filename);
                        // Wait asynchronously for it
                        while (!BackgroundAutosave.Instance.CheckSaveStatus())
                        {
                            yield return(null);
                        }
                        if (updateSavePointer)
                        {
                            SaveLoader.SetActiveSaveFilePath(filename);
                        }
                        ___activatePostCB?.Invoke();
                        for (int i = 0; i < 5; i++)
                        {
                            yield return(null);
                        }
                    } finally {
                        BackgroundAutosave.EnableSaving();
                        PlayerController.Instance.AllowDragging(true);
                    }
                    yield break;
                }
                else
                {
                    // Original method
                    while (result.MoveNext())
                    {
                        yield return(result.Current);
                    }
                }
            }
Exemplo n.º 7
0
 private void Awake()
 {
     if (I == null)
     {
         I = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     sessionManager     = FindObjectOfType <SessionManager>();
     saveLoader         = FindObjectOfType <SaveLoader>();
     scoreKeeper        = FindObjectOfType <ScoreKeeper>();
     antonymsSfxManager = FindObjectOfType <AntonymsSfxManager>();
     endScreen.SetActive(false);
     game.SetActive(false);
     buttons.SetActive(false);
     timer = -1000000;
     Invoke("StartGame", 7.5f);
 }
Exemplo n.º 9
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            ImporttextBox.Text     = "stations.json";
            ChangeFiletextBox.Text = @"file.json";

            var rootmodel = SaveLoader.Load(Settings.Default.ファイルパス);

            foreach (var item in rootmodel.NotVisible)
            {
                NotVisibletextBox.Text += item.name + "\r\n";
            }
        }
Exemplo n.º 10
0
 // Start is called before the first frame update
 void Start()
 {
     sessionManager     = FindObjectOfType <SessionManager>();
     scoreKeeper        = FindObjectOfType <ScoreKeeper>();
     saveLoader         = FindObjectOfType <SaveLoader>();
     antonymsSfxManager = FindObjectOfType <AntonymsSfxManager>();
     originalColor      = button1Text.color;
     scores             = new List <int>();
     times = new List <float>();
     game.SetActive(true);
     endScreen.SetActive(false);
     SetupQuestion();
 }
Exemplo n.º 11
0
 public void OnApplicationQuit()
 {
     if (startGame && save != null && save.player != null)
     {
         Timer.start("Saving data");
         SaveLoader.save(save, saveFileName);
         foreach (Chunk chunk in Chunk.displayedChunks.ToArray())
         {
             chunk.unload(false);
         }
         Timer.endAndPrint("Saving data");
     }
 }
    public static bool CanLoadSave()
    {
        bool   flag = true;
        string activeSaveFilePath = SaveLoader.GetActiveSaveFilePath();

        flag = WorldGen.CanLoad(activeSaveFilePath);
        if (!flag)
        {
            SaveLoader.SetActiveSaveFilePath(null);
            flag = WorldGen.CanLoad(WorldGen.SIM_SAVE_FILENAME);
        }
        return(flag);
    }
Exemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     sessionManager     = FindObjectOfType <SessionManager>();
     saveLoader         = FindObjectOfType <SaveLoader>();
     scoreKeeper        = FindObjectOfType <ScoreKeeper>();
     antonymsSfxManager = FindObjectOfType <AntonymsSfxManager>();
     endScreen.SetActive(false);
     game.SetActive(true);
     originalColor  = button1Text.color;
     scores         = new List <int>();
     correctAnswers = new List <string>();
     SetupRound();
 }
 // Start is called before the first frame update
 void Start()
 {
     sessionManager = FindObjectOfType <SessionManager>();
     saveLoader     = FindObjectOfType <SaveLoader>();
     scoreKeeper    = FindObjectOfType <ScoreKeeper>();
     endScreen.SetActive(false);
     game.SetActive(true);
     originalColor  = button1Text.color;
     scores         = new List <int>();
     correctAnswers = new List <string>();
     cameraAni      = Camera.main.GetComponent <Animator>();
     SetupRound();
 }
Exemplo n.º 15
0
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("Clear progress"))
        {
            SaveLoader.SaveProgress(new Progress());
        }

        if (GUILayout.Button("Log current progress to console"))
        {
            Debug.Log(SaveLoader.LoadProgress());
        }

        DrawDefaultInspector();
    }
    private void ResumeGame()
    {
        string text = (!string.IsNullOrEmpty(GenericGameSettings.instance.performanceCapture.saveGame)) ? GenericGameSettings.instance.performanceCapture.saveGame : SaveLoader.GetLatestSaveFile();

        if (!string.IsNullOrEmpty(text))
        {
            KCrashReporter.MOST_RECENT_SAVEFILE = text;
            SaveLoader.SetActiveSaveFilePath(text);
            LoadingOverlay.Load(delegate
            {
                App.LoadScene("backend");
            });
        }
    }
Exemplo n.º 17
0
        /// <summary>
        /// Cleans up old autosaves.
        /// </summary>
        private void CleanAutosaves()
        {
            var inst = SaveLoader.Instance;

            if (!Klei.GenericGameSettings.instance.keepAllAutosaves && inst != null)
            {
                string autoSavePath = GetActiveAutoSavePath(), colonyID = inst.GameInfo.
                                                                          colonyGuid.ToString();
                var autoSaveFiles = ListPool <string, BackgroundAutosave> .Allocate();

                // Clean up old autosaves and their preview images
                foreach (var candidate in SaveLoader.GetSaveFiles(autoSavePath, true))
                {
                    var info = SaveGame.GetFileInfo(candidate.path);
                    if (info != null)
                    {
                        string uniqueID = SaveGame.GetSaveUniqueID(info.second);
                        if (uniqueID == colonyID)
                        {
                            autoSaveFiles.Add(candidate.path);
                        }
                    }
                }
                for (int i = autoSaveFiles.Count - 1; i >= SaveLoader.MAX_AUTOSAVE_FILES - 1;
                     i--)
                {
                    string autoName = autoSaveFiles[i], autoImage = Path.ChangeExtension(
                        autoName, ".png");
                    try {
                        PUtil.LogDebug("Deleting old autosave: " + autoName);
                        File.Delete(autoName);
                    } catch (Exception e) {
                        PUtil.LogWarning("Error deleting old autosave: " + autoName);
                        PUtil.LogExcWarn(e);
                    }
                    try {
                        if (File.Exists(autoImage))
                        {
                            File.Delete(autoImage);
                        }
                    } catch (Exception e) {
                        PUtil.LogWarning("Error deleting old screenshot: " + autoImage);
                        PUtil.LogExcWarn(e);
                    }
                }
                autoSaveFiles.Recycle();
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     stringArrays = new List <string[]>();
     stringArrays.Add(englishWords); stringArrays.Add(russianWords); stringArrays.Add(chineseWords); stringArrays.Add(spanishWords);
     stringArrays.Add(germanWords); stringArrays.Add(frenchWords); stringArrays.Add(norwegianWords); stringArrays.Add(turkishWords);
     stringArrays.Add(italianWords); stringArrays.Add(arabianWords); stringArrays.Add(hindiWords);
     sessionManager     = FindObjectOfType <SessionManager>();
     saveLoader         = FindObjectOfType <SaveLoader>();
     scoreKeeper        = FindObjectOfType <ScoreKeeper>();
     antonymsSfxManager = FindObjectOfType <AntonymsSfxManager>();
     endScreen.SetActive(false);
     game.SetActive(true);
     originalColor = button1Text.color;
     scores        = new List <int>();
     SetupRound();
 }
Exemplo n.º 19
0
    private void LoadScenario(PublishedFileId_t item)
    {
        SteamUGC.GetItemInstallInfo(item, out ulong punSizeOnDisk, out string pchFolder, 1024u, out uint punTimeStamp);
        DebugUtil.LogArgs("LoadScenario", pchFolder, punSizeOnDisk, punTimeStamp);
        System.DateTime lastModified;
        byte[]          bytesFromZip = SteamUGCService.GetBytesFromZip(item, new string[1]
        {
            ".sav"
        }, out lastModified, false);
        string text = Path.Combine(SaveLoader.GetSavePrefix(), "scenario.sav");

        File.WriteAllBytes(text, bytesFromZip);
        SaveLoader.SetActiveSaveFilePath(text);
        Time.timeScale = 0f;
        App.LoadScene("backend");
    }
Exemplo n.º 20
0
    // Start is called before the first frame update
    void Start()
    {
        List <int>   scores = new List <int>();
        List <float> times  = new List <float>();

        sessionManager = FindObjectOfType <SessionManager>();
        saveLoader     = FindObjectOfType <SaveLoader>();
        scoreKeeper    = FindObjectOfType <ScoreKeeper>();
        spawnedObjects = new List <GameObject>();
        endScreenContainer.SetActive(false);
        originalColor = background.material.color;
        gameContainer.SetActive(false);
        gameContainer2.SetActive(false);
        intro.SetActive(true);
        Invoke("StartNewRound", 3f);
    }
Exemplo n.º 21
0
    // Start is called before the first frame update
    void Start()
    {
        xText          = GameObject.FindGameObjectWithTag("XText").GetComponent <Text>();
        yText          = GameObject.FindGameObjectWithTag("YText").GetComponent <Text>();
        sessionManager = FindObjectOfType <SessionManager>();
        saveLoader     = FindObjectOfType <SaveLoader>();
        scoreKeeper    = FindObjectOfType <ScoreKeeper>();
        endScreen.SetActive(false);
        game.SetActive(false);
        NextExercise.SetActive(false);
        buttons.SetActive(false);
        berryCatchingTimer = -1000000;
        Invoke("StartGame", 7.5f);

        originalColor = backGround.color;
    }
Exemplo n.º 22
0
        private void Load_Internal(string path)
        {
            string[] data = new string[2];

            using (var sr = new StreamReader(path))
            {
                string alldata    = sr.ReadToEnd();
                int    breakIndex = alldata.IndexOf("]") + 1;


                data[0] = alldata.Substring(0, breakIndex);
                data[1] = alldata.Substring(breakIndex);
            }

            SaveLoader.Load(data, this, serializer);
        }
 private void Start()
 {
     xText          = GameObject.FindGameObjectWithTag("XText").GetComponent <Text>();
     yText          = GameObject.FindGameObjectWithTag("YText").GetComponent <Text>();
     scoreKeeper    = FindObjectOfType <ScoreKeeper>();
     sessionManager = FindObjectOfType <SessionManager>();
     saveLoader     = FindObjectOfType <SaveLoader>();
     endText        = GameObject.FindGameObjectWithTag("EndScreen");
     game           = GameObject.FindGameObjectWithTag("Game");
     next           = GameObject.FindGameObjectWithTag("Next");
     next.SetActive(false);
     endText.SetActive(false);
     CreateStatement();
     times         = new List <float>();
     scores        = new List <int>();
     originalColor = backGround.material.color;
 }
Exemplo n.º 24
0
        /// <summary>
        /// Gets the path to the current autosave folder.
        /// </summary>
        /// <returns>The location where autosaves are saved.</returns>
        private static string GetActiveAutoSavePath()
        {
            string filename = SaveLoader.GetActiveSaveFilePath();
            bool   flag     = filename == null;
            string result;

            if (flag)
            {
                result = SaveLoader.GetAutoSavePrefix();
            }
            else
            {
                string root = Path.GetDirectoryName(filename);
                result = Path.Combine(root, "auto_save");
            }
            return(result);
        }
Exemplo n.º 25
0
    void Awake()
    {
        ScoreCounter.onScoreChange.AddListener((score) =>
        {
            currentProgress.Score = score;
            SaveLoader.Save <Progress>(currentProgress);
        });

        ItemBuy.onPurchase.AddListener((item) =>
        {
            currentProgress.BuyedItems[item.number - 1]++;
            SaveLoader.Save <Progress>(currentProgress);
        });

        currentProgress = SaveLoader.Load <Progress>();
        currentSettings = SaveLoader.Load <Settings>();
    }
Exemplo n.º 26
0
    private bool IsFileValid(string filename)
    {
        bool result = false;

        try
        {
            SaveGame.Header   header;
            SaveGame.GameInfo gameInfo = SaveLoader.LoadHeader(filename, out header);
            result = (gameInfo.saveMajorVersion >= 7);
            return(result);
        }
        catch (Exception ex)
        {
            Debug.LogWarning("Corrupted save file: " + filename + "\n" + ex.ToString());
            return(result);
        }
    }
Exemplo n.º 27
0
 private Tuple <SaveGame.Header, SaveGame.GameInfo> GetFileInfo(string filename)
 {
     try
     {
         SaveGame.Header   header;
         SaveGame.GameInfo b = SaveLoader.LoadHeader(filename, out header);
         if (b.saveMajorVersion >= 7)
         {
             return(new Tuple <SaveGame.Header, SaveGame.GameInfo>(header, b));
         }
     }
     catch (Exception obj)
     {
         Debug.LogWarning(obj);
         InfoText.text = string.Format(UI.FRONTEND.LOADSCREEN.CORRUPTEDSAVE, filename);
     }
     return(null);
 }
Exemplo n.º 28
0
    private void OnSave()
    {
        string filename = SaveLoader.GetActiveSaveFilePath();

        if (!string.IsNullOrEmpty(filename) && File.Exists(filename))
        {
            base.gameObject.SetActive(false);
            ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)GameScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.transform.parent.gameObject, GameScreenManager.UIRenderTarget.ScreenSpaceOverlay);
            confirmDialogScreen.PopupConfirmDialog(string.Format(UI.FRONTEND.SAVESCREEN.OVERWRITEMESSAGE, Path.GetFileNameWithoutExtension(filename)), delegate
            {
                DoSave(filename);
                base.gameObject.SetActive(true);
            }, OnCancelPopup, null, null, null, null, null, null, true);
        }
        else
        {
            OnSaveAs();
        }
    }
Exemplo n.º 29
0
        private static void Postfix(SaveLoader __instance, string filename, bool isAutoSave, bool updateSavePointer)
        {
            var currentTime = System.DateTime.UtcNow;

            if (!isAutoSave || lastPostfixTime + TimeSpan.FromSeconds(1) > currentTime)
            {
                return;
            }
            lastPostfixTime = currentTime;
            Debug.Log(" === TimeLapser_SaveLoader_Save Postfix === ");
            var lastState = new GameStateRestoreInfo();

            var presetLocation = GetSavedCameraLocation(savedViewIndex);

            SetupForScreenshots(presetLocation);

            SafeDelayedAction.EnqueueAction(() =>
            {
                try
                {
                    Debug.Log(" === TimeLapser Taking screenshot");
                    Utilities.PressScreenShotKey();
                }
                catch (Exception e)
                {
                    Debug.LogError(" === TimeLapser Error encountered during state restore");
                    Debug.LogException(e);
                }
            }, 800);
            SafeDelayedAction.EnqueueAction(() =>
            {
                try {
                    Debug.Log(" === TimeLapser Restoring State");
                    ResetFromScreenshots(lastState);
                }
                catch (Exception e)
                {
                    Debug.LogError(" === TimeLapser Error encountered during state restore");
                    Debug.LogException(e);
                }
            }, 1000);
        }
Exemplo n.º 30
0
    void Start()
    {
        progress = SaveLoader.LoadProgress();

        switch (progress.Level)
        {
        case 0:
            goto case 1;

        case 1:
            doors[1].GetComponent <Image>().sprite        = imageNull;
            doors[1].GetComponent <Button>().interactable = false;
            goto case 2;

        case 2:
            doors[2].GetComponent <Image>().sprite        = imageNull;
            doors[2].GetComponent <Button>().interactable = false;
            break;
        }
    }
Exemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        character = Instantiate(character_prefab,new Vector3(0,1,0),Quaternion.identity) as GameObject;
        character.transform.parent = this.transform;
        control = character.GetComponent<Control>();
        control.main = this;
        ingameMenu = GetComponent<IngameMenu>();
        ingameMenu.main = this;
        stats = character.GetComponent<Stats>();
        stats.statsOwner = this.transform;
        stats.level = 1;
        stats.updateStats(true);
        saveLoader = GetComponent<SaveLoader>();
        saveLoader.main = this;

        if(GameObject.Find("load") != null)
        {
            saveLoader.loadGame();
            Destroy(GameObject.Find("load"));
        }
    }