コード例 #1
0
    public void AddQuest(Quest quest)
    {
        QuestWithState qWS = new QuestWithState {
            Quest = quest, QuestState = QuestState.InProces
        };

        if (File.Exists(wayToFile))//Если файла есть
        {
            SaveQs = JsonConvert.DeserializeObject <SaveQuests>(File.ReadAllText(wayToFile), JsonSettings);
            QWSs   = SaveQs.TakedQuests;
            QWSs.Add(qWS);
        }
        else
        {
            QWSs.Add(qWS);
        }
        File.WriteAllText(wayToFile, JsonConvert.SerializeObject(new SaveQuests {
            TakedQuests = QWSs
        }, JsonSettings));
        QH.QuestUpdate();
    }