Esempio n. 1
0
        private void onTalkTree(object sender, EventArgs e)
        {
            String conversation = null;

            if (m_stage.hasTalkTrees())
            {
                // Edit the talk tree
                StringWriter stringWriter = new StringWriter();
                m_stage.getTalkTreesXML(stringWriter);
                conversation = stringWriter.ToString();
            }
            m_frmTalkTree.setConversation(conversation);

            // Specify the valid stages (for the goto_stage flag)
            List <CodeValue> stages = new List <CodeValue>();
            Int32            stageId;

            foreach (Stage stage in m_mission.getStages())
            {
                stageId = Int32.Parse(stage.getId());
                stages.Add(CodeValue.FormattedLeft(stageId, stage.getDescription()));
            }
            m_frmTalkTree.setStages(stages);

            m_frmTalkTree.ShowDialog();
            if (m_frmTalkTree.getConversation(out conversation))
            {
                m_parent.onChanged();
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.Load(new StringReader("<Chat>" + conversation + "</Chat>"));
                m_stage.clearTalkTrees();
                TalkTree talkTree;
                foreach (XmlNode nodeTree in xmlDocument.DocumentElement.ChildNodes)
                {
                    talkTree = new TalkTree();
                    talkTree.fromXML(nodeTree);
                    m_stage.addTalkTree(talkTree);
                }
            }
        }