Ejemplo n.º 1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 1:
            {
                if (m_Node.Parent != null)
                {
                    from.SendGump(new GoGump(0, from, m_Tree, m_Node.Parent));
                }

                break;
            }

            case 2:
            {
                if (m_Page > 0)
                {
                    from.SendGump(new GoGump(m_Page - 1, from, m_Tree, m_Node));
                }

                break;
            }

            case 3:
            {
                if ((m_Page + 1) * EntryCount < m_Node.Children.Length)
                {
                    from.SendGump(new GoGump(m_Page + 1, from, m_Tree, m_Node));
                }

                break;
            }

            default:
            {
                int index = info.ButtonID - 4;

                if (index >= 0 && index < m_Node.Children.Length)
                {
                    object o = m_Node.Children[index];

                    if (o is ParentNode)
                    {
                        from.SendGump(new GoGump(0, from, m_Tree, (ParentNode)o));
                    }
                    else
                    {
                        ChildNode n = (ChildNode)o;

                        from.MoveToWorld(n.Location, m_Tree.Map);
                    }
                }

                break;
            }
            }
        }
Ejemplo n.º 2
0
        private void Parse(XmlTextReader xml)
        {
            if (xml.MoveToAttribute("name"))
            {
                m_Name = xml.Value;
            }
            else
            {
                m_Name = "empty";
            }

            if (xml.IsEmptyElement)
            {
                m_Children = new object[0];
            }
            else
            {
                ArrayList children = new ArrayList();

                while (xml.Read() && (xml.NodeType == XmlNodeType.Element || xml.NodeType == XmlNodeType.Comment))
                {
                    if (xml.NodeType == XmlNodeType.Comment)
                    {
                        continue;
                    }

                    if (xml.Name == "child")
                    {
                        ChildNode n = new ChildNode(xml, this);

                        children.Add(n);
                    }
                    else
                    {
                        children.Add(new ParentNode(xml, this));
                    }
                }

                m_Children = children.ToArray();
            }
        }