Exemplo n.º 1
0
    private void Save(string filename, SerializableData.Level level)
    {
        var serializer = new XmlSerializer(typeof(SerializableData.Level));
        var encoding   = Encoding.GetEncoding("UTF-8");

        using (var stream = new StreamWriter(filename, false, encoding))
        {
            serializer.Serialize(stream, level);
        }
    }
Exemplo n.º 2
0
    public void Save()
    {
        pauseMenu.SetActive(false);

        var level = new SerializableData.Level();
        level.name = levelNameField.text;

        foreach (var n in Level.Instance.tiles)
        {
            level.nodes.Add(new Position(n.transform.position));
        }

        LevelManager.Instance.loadedLevels.Clear();
        LevelManager.Instance.loadedLevels.Add(level);
        LevelManager.Instance.SaveLevels();
        LevelManager.Instance.LoadLevels();
    }
Exemplo n.º 3
0
    public void Save()
    {
        pauseMenu.SetActive(false);

        var level = new SerializableData.Level();

        level.name = levelNameField.text;

        foreach (var n in Level.Instance.tiles)
        {
            level.nodes.Add(new Position(n.transform.position));
        }

        LevelManager.Instance.loadedLevels.Clear();
        LevelManager.Instance.loadedLevels.Add(level);
        LevelManager.Instance.SaveLevels();
        LevelManager.Instance.LoadLevels();
    }
Exemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        var handle = target as Level;

        if (GUILayout.Button("Save"))
        {
            var level = new SerializableData.Level();
            level.name = handle.name;

            foreach (var h in handle.nodes)
            {
                level.nodes.Add(new SerializableData.Position(h.transform.position));
            }

            LevelManager.Instance.loadedLevels.Add(level);
        }
    }
Exemplo n.º 5
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        var handle = target as Level;

        if (GUILayout.Button("Save"))
        {
            var level = new SerializableData.Level();
            level.name = handle.name;

            foreach (var h in handle.nodes)
            {
                level.nodes.Add(new SerializableData.Position(h.transform.position));
            }

            LevelManager.Instance.loadedLevels.Add(level);
        }
    }
Exemplo n.º 6
0
    public void Create(SerializableData.Level level)
    {
        ClearNodes();
        foreach (var n in level.nodes)
        {
            var node = new GameObject().transform;
            node.position = n.Internal;
            nodes.Add(node);
        }

        GenerateTiles();
        int pair = FillTiles();

        while (pair == 0)
        {
            pair = FillTiles();
        }

        UIManager.Instance.inGameMenu.Reset(nodes.Count);
        ClearNodes();
    }