Exemplo n.º 1
0
    //Zeigt die Spielstände und lädt sie (falls notwendig)
    public void showSavegame()
    {
        menuOpened = true;
        Debug.Log(savegame_panel);
        if (!Laden.loaded)
        {
            Laden.Load();
        }

        int i = 0;

        foreach (Game save in Laden.saveGames)
        {
            savegame_text[i].GetComponent <Text>().text = save.name;
            i++;
        }

        while (i < 3)
        {
            savegame_text[i].GetComponent <Text>().text = "Freier Spielstand";
            i++;
        }

        savegame_panel.gameObject.SetActive(true);
    }
Exemplo n.º 2
0
    //Zeigt/Lädt die Spielstände und versteckt das Hauptmenü
    public void showSavegames()
    {
        if (!Laden.loaded)
        {
            Laden.Load();
            Laden.loaded = true;
        }

        int i = 0;

        foreach (Game save in Laden.saveGames)
        {
            savegame_text[i].GetComponent <Text>().text = save.name;
            i++;
        }

        while (i < 3)
        {
            savegame_text[i].GetComponent <Text>().text = "Freier Spielstand";
            i++;
        }

        GameObject saveGames   = GameObject.FindGameObjectWithTag("Menu");
        GameObject start_panel = saveGames.transform.GetChild(0).gameObject;
        GameObject panel       = saveGames.transform.GetChild(1).gameObject;

        panel.SetActive(true);
        start_panel.SetActive(false);
    }
Exemplo n.º 3
0
    //Holt sich die Daten des Spiels und speichert sie ab
    public static void Save()
    {
        if (!Laden.loaded)
        {
            Laden.Load();
        }
        saveGames = Laden.saveGames;
        if (saveGames.Count <= gameToSave)
        {
            saveGames.Add(Game.current);
        }
        else
        {
            saveGames[(int)gameToSave] = Game.current;
        }
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.dataPath + "/savedGames.gd");

        bf.Serialize(file, saveGames);
        file.Close();
        Laden.loaded = false;
    }