Exemplo n.º 1
0
    public void _on_SlotButton_StartGame(bool new_save, string filename, int slot)
    {
        GetNode <LevelSelection>("../LevelSelection").killConsumers();
        string fname = new_save ? KWorld.WorldDirectory + "/DefaultSavegame.ini" : filename;

        KnyttSave save = new KnyttSave(KWorld,
                                       new_save ? GDKnyttAssetManager.loadTextFile(KWorld.getWorldData("DefaultSavegame.ini")) :
                                       GDKnyttAssetManager.loadTextFile(filename),
                                       slot);

        KWorld.CurrentSave      = save;
        GDKnyttDataStore.KWorld = KWorld;
        GDKnyttDataStore.startGame(new_save);
        this.QueueFree();
    }
Exemplo n.º 2
0
    public void _on_SlotButton_StartGame(bool new_save, string filename, int slot)
    {
        GetNode <LevelSelection>("../LevelSelection").killConsumers();

        string cache_dir = GDKnyttAssetManager.extractFilename(KWorld.WorldDirectory);

        GDKnyttAssetManager.ensureDirExists($"user://Cache/{cache_dir}");
        var f = new File();

        f.Open($"user://Cache/{cache_dir}/LastPlayed.flag", File.ModeFlags.Write);
        f.Close();

        KnyttSave save = new KnyttSave(KWorld,
                                       new_save ? GDKnyttAssetManager.loadTextFile(KWorld.getWorldData("DefaultSavegame.ini")) :
                                       GDKnyttAssetManager.loadTextFile(filename),
                                       slot);

        KWorld.CurrentSave      = save;
        GDKnyttDataStore.KWorld = KWorld;
        GDKnyttDataStore.startGame(new_save);
        this.QueueFree();
    }