コード例 #1
0
ファイル: DialogDatabase.cs プロジェクト: KraigXu/GameProject
        public static DiaNodeMold GetRandomEncounterRootNode(DiaNodeType NType)
        {
            List <DiaNodeMold> list = new List <DiaNodeMold>();

            foreach (DiaNodeMold node in Nodes)
            {
                if (node.isRoot && (!node.unique || !node.used) && node.nodeType == NType)
                {
                    list.Add(node);
                }
            }
            return(list.RandomElement());
        }
コード例 #2
0
        public static DiaNodeMold GetRandomEncounterRootNode(DiaNodeType NType)
        {
            List <DiaNodeMold> list = new List <DiaNodeMold>();

            foreach (DiaNodeMold diaNodeMold in DialogDatabase.Nodes)
            {
                if (diaNodeMold.isRoot && (!diaNodeMold.unique || !diaNodeMold.used) && diaNodeMold.nodeType == NType)
                {
                    list.Add(diaNodeMold);
                }
            }
            return(list.RandomElement <DiaNodeMold>());
        }
コード例 #3
0
ファイル: LayerLoader.cs プロジェクト: wensincai/RW-Decompile
        public static void LoadFileIntoList(TextAsset ass, List <DiaNodeMold> NodeListToFill, List <DiaNodeList> ListListToFill, DiaNodeType NodesType)
        {
            TextReader     textReader     = new StringReader(ass.text);
            XPathDocument  xPathDocument  = new XPathDocument(textReader);
            XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();

            xPathNavigator.MoveToFirst();
            xPathNavigator.MoveToFirstChild();
            foreach (XPathNavigator xPathNavigator2 in xPathNavigator.Select("Node"))
            {
                try
                {
                    TextReader    textReader2   = new StringReader(xPathNavigator2.OuterXml);
                    XmlSerializer xmlSerializer = new XmlSerializer(typeof(DiaNodeMold));
                    DiaNodeMold   diaNodeMold   = (DiaNodeMold)xmlSerializer.Deserialize(textReader2);
                    diaNodeMold.nodeType = NodesType;
                    NodeListToFill.Add(diaNodeMold);
                    textReader2.Dispose();
                }
                catch (Exception ex)
                {
                    Log.Message(string.Concat(new object[]
                    {
                        "Exception deserializing ",
                        xPathNavigator2.OuterXml,
                        ":\n",
                        ex.InnerException
                    }), false);
                }
            }
            foreach (XPathNavigator xPathNavigator3 in xPathNavigator.Select("NodeList"))
            {
                try
                {
                    TextReader    textReader3    = new StringReader(xPathNavigator3.OuterXml);
                    XmlSerializer xmlSerializer2 = new XmlSerializer(typeof(DiaNodeList));
                    DiaNodeList   item           = (DiaNodeList)xmlSerializer2.Deserialize(textReader3);
                    ListListToFill.Add(item);
                }
                catch (Exception ex2)
                {
                    Log.Message(string.Concat(new object[]
                    {
                        "Exception deserializing ",
                        xPathNavigator3.OuterXml,
                        ":\n",
                        ex2.InnerException
                    }), false);
                }
            }
        }
コード例 #4
0
        public static void LoadFileIntoList(TextAsset ass, List <DiaNodeMold> NodeListToFill, List <DiaNodeList> ListListToFill, DiaNodeType NodesType)
        {
            TextReader     reader         = new StringReader(ass.text);
            XPathDocument  xpathDocument  = new XPathDocument(reader);
            XPathNavigator xpathNavigator = xpathDocument.CreateNavigator();

            xpathNavigator.MoveToFirst();
            xpathNavigator.MoveToFirstChild();
            IEnumerator enumerator = xpathNavigator.Select("Node").GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object         obj             = enumerator.Current;
                    XPathNavigator xpathNavigator2 = (XPathNavigator)obj;
                    try
                    {
                        TextReader    textReader    = new StringReader(xpathNavigator2.OuterXml);
                        XmlSerializer xmlSerializer = new XmlSerializer(typeof(DiaNodeMold));
                        DiaNodeMold   diaNodeMold   = (DiaNodeMold)xmlSerializer.Deserialize(textReader);
                        diaNodeMold.nodeType = NodesType;
                        NodeListToFill.Add(diaNodeMold);
                        textReader.Dispose();
                    }
                    catch (Exception ex)
                    {
                        Log.Message(string.Concat(new object[]
                        {
                            "Exception deserializing ",
                            xpathNavigator2.OuterXml,
                            ":\n",
                            ex.InnerException
                        }), false);
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            IEnumerator enumerator2 = xpathNavigator.Select("NodeList").GetEnumerator();

            try
            {
                while (enumerator2.MoveNext())
                {
                    object         obj2            = enumerator2.Current;
                    XPathNavigator xpathNavigator3 = (XPathNavigator)obj2;
                    try
                    {
                        TextReader    textReader2    = new StringReader(xpathNavigator3.OuterXml);
                        XmlSerializer xmlSerializer2 = new XmlSerializer(typeof(DiaNodeList));
                        DiaNodeList   item           = (DiaNodeList)xmlSerializer2.Deserialize(textReader2);
                        ListListToFill.Add(item);
                    }
                    catch (Exception ex2)
                    {
                        Log.Message(string.Concat(new object[]
                        {
                            "Exception deserializing ",
                            xpathNavigator3.OuterXml,
                            ":\n",
                            ex2.InnerException
                        }), false);
                    }
                }
            }
            finally
            {
                IDisposable disposable2;
                if ((disposable2 = (enumerator2 as IDisposable)) != null)
                {
                    disposable2.Dispose();
                }
            }
        }
コード例 #5
0
        public static void LoadFileIntoList(TextAsset ass, List <DiaNodeMold> NodeListToFill, List <DiaNodeList> ListListToFill, DiaNodeType NodesType)
        {
            XPathNavigator xPathNavigator = new XPathDocument(new StringReader(ass.text)).CreateNavigator();

            xPathNavigator.MoveToFirst();
            xPathNavigator.MoveToFirstChild();
            foreach (XPathNavigator item2 in xPathNavigator.Select("Node"))
            {
                try
                {
                    TextReader  textReader  = new StringReader(item2.OuterXml);
                    DiaNodeMold diaNodeMold = (DiaNodeMold) new XmlSerializer(typeof(DiaNodeMold)).Deserialize(textReader);
                    diaNodeMold.nodeType = NodesType;
                    NodeListToFill.Add(diaNodeMold);
                    textReader.Dispose();
                }
                catch (Exception ex)
                {
                    Log.Message("Exception deserializing " + item2.OuterXml + ":\n" + ex.InnerException);
                }
            }
            foreach (XPathNavigator item3 in xPathNavigator.Select("NodeList"))
            {
                try
                {
                    TextReader  textReader2 = new StringReader(item3.OuterXml);
                    DiaNodeList item        = (DiaNodeList) new XmlSerializer(typeof(DiaNodeList)).Deserialize(textReader2);
                    ListListToFill.Add(item);
                }
                catch (Exception ex2)
                {
                    Log.Message("Exception deserializing " + item3.OuterXml + ":\n" + ex2.InnerException);
                }
            }
        }