Пример #1
0
        public void DoQuestTree()
        {
            QuestTree.BeginUpdate();

            // Make a new quest tree or clear the old one
            if (QuestTree.Model == null)
            {
                QuestTree.Model = new TreeModel();
            }
            else
            {
                QuestTree.Clear();
            }

            TreeModel model = QuestTree.Model as TreeModel;

            for (int listIndex = 0; listIndex < CurrentWSG.NumberOfQuestLists; listIndex++)
            {
                // Create the category node for this playthrough
                // Quest tree category nodes:
                //     Text = human readable quest category ("Playthrough 1 Quests", etc)
                //     Tag = quest list index as string (0 based)
                ColoredTextNode parent = new ColoredTextNode();
                parent.Text = "Playthrough " + (listIndex + 1) + " Quests";
                parent.Tag  = listIndex.ToString();
                model.Nodes.Add(parent);

                WillowSaveGame.QuestTable qt = CurrentWSG.QuestLists[listIndex];
                // Create all the actual quest nodes for this playthrough
                //     Text = human readable quest name
                //     Tag = internal quest name
                for (int questIndex = 0; questIndex < qt.TotalQuests; questIndex++)
                {
                    string nodeName = qt.Quests[questIndex].Name;

                    ColoredTextNode node = new ColoredTextNode();
                    node.Tag  = nodeName;
                    node.Text = QuestsXml.XmlReadValue(nodeName, "MissionName");
                    if (node.Text == "")
                    {
                        node.Text = "(" + nodeName + ")";
                    }
                    parent.Nodes.Add(node);
                }
            }
            QuestTree.EndUpdate();
        }