Exemplo n.º 1
0
 void LoadSettings()
 {
     try {
         if (FileEncoder.SaveVersionMatches("video_settings".ToPath()))
         {
             VideoSettings settings = (VideoSettings)Loader.Load(FileEncoder.Read("video_settings".ToPath()));
             Fullscreen = settings.Fullscreen;
             SetResolutionFromOption(settings.resolutionOption);
         }
         else
         {
             LoadDefaultSettings();
         }
     } catch (Exception) {
         LoadDefaultSettings();
     }
 }
Exemplo n.º 2
0
    public static void LoadGame(SceneTree tree)
    {
        string save = "";

        try {
            if (!FileEncoder.SaveExists())
            {
                return;
            }
            save = FileEncoder.Read();
        } catch (Utils.WrongVersionException e) {
            ThoughtPopup.Instance.OpenCustomMessage(e.GetMessage() + "\n\n[url=~title]Back to the title screen[/url]");
            var callback = Callback.ConnectOnce(ThoughtPopup.Instance, "popup_hide", () => tree.ChangeScene("res://Scenes/TitleScreen.tscn"));
            return;
        }
        var saveItems = Loader.LoadMany(save);

        GameData.Instance = (GameData)saveItems[0];
        RNG.StartCycle((int)saveItems[1]);
    }