Exemplo n.º 1
0
    public static void Save()
    {
        StreamWriter file = new StreamWriter(savePath);

        file.WriteLine("gold;" + PlayerCoin.Get());

        for (int i = 0; i < PlayerMonster.Count; i++)
        {
            file.WriteLine("monster;" + PlayerMonster.Get(i).monsterName + ";" + PlayerMonster.Get(i).exp);
        }

        foreach (KeyValuePair <string, int> pair in PlayerItems.Items)
        {
            file.WriteLine("item;" + pair.Key + ";" + pair.Value);
        }

        for (int i = 0; PlayerField.Has(i); i++)
        {
            switch (PlayerField.Get(i))
            {
            case FieldStatus.FIELD_EMPTY:
                file.WriteLine("field;" + i.ToString() + ";-1");
                break;

            case FieldStatus.FIELD_FAILED:
                file.WriteLine("field;" + i.ToString() + ";0");
                break;

            case FieldStatus.FIELD_1STAR:
                file.WriteLine("field;" + i.ToString() + ";1");
                break;

            case FieldStatus.FIELD_2STAR:
                file.WriteLine("field;" + i.ToString() + ";2");
                break;

            case FieldStatus.FIELD_3STAR:
                file.WriteLine("field;" + i.ToString() + ";3");
                break;
            }
        }

        file.Close();
    }