Exemplo n.º 1
0
        public XmlAddCAGCategory(XmlAddCAGCategory parent, XmlTextReader xml)
        {
            m_Parent = parent;

            if (xml.MoveToAttribute("title"))
            {
                if (xml.Value == "Add Menu")
                {
                    m_Title = "XmlAdd Menu";
                }
                else
                {
                    m_Title = xml.Value;
                }
            }
            else
            {
                m_Title = "empty";
            }

            if (m_Title == "Docked")
            {
                m_Title = "Docked 2";
            }

            if (xml.IsEmptyElement)
            {
                m_Nodes = new XmlAddCAGNode[0];
            }
            else
            {
                ArrayList nodes = new ArrayList();

                try{
                    while (xml.Read() && xml.NodeType != XmlNodeType.EndElement)
                    {
                        if (xml.NodeType == XmlNodeType.Element && xml.Name == "object")
                        {
                            nodes.Add(new XmlAddCAGObject(this, xml));
                        }
                        else if (xml.NodeType == XmlNodeType.Element && xml.Name == "category")
                        {
                            if (!xml.IsEmptyElement)
                            {
                                nodes.Add(new XmlAddCAGCategory(this, xml));
                            }
                        }
                        else
                        {
                            xml.Skip();
                        }
                    }
                } catch (Exception ex) {
                    Console.WriteLine("XmlCategorizedAddGump: Corrupted Data/objects.xml file detected. Not all XmlCAG objects loaded. {0}", ex);
                }


                m_Nodes = (XmlAddCAGNode[])nodes.ToArray(typeof(XmlAddCAGNode));
            }
        }
Exemplo n.º 2
0
        public XmlCategorizedAddGump(Mobile owner, XmlAddCAGCategory category, int page, int index, Gump gump) : base(GumpOffsetX, GumpOffsetY)
        {
            if (category == null)
            {
                category = XmlAddCAGCategory.Root;
                page     = 0;
            }

            owner.CloseGump(typeof(WhoGump));

            m_Owner    = owner;
            m_Category = category;

            m_Index = index;
            m_Gump  = gump;
            if (gump is XmlAddGump)
            {
                XmlAddGump xmladdgump = (XmlAddGump)gump;

                if (xmladdgump != null && xmladdgump.defs != null)
                {
                    xmladdgump.defs.CurrentCategory     = category;
                    xmladdgump.defs.CurrentCategoryPage = page;
                }
            }
            else
            if (gump is XmlSpawnerGump)
            {
                m_Spawner = ((XmlSpawnerGump)gump).m_Spawner;
            }

            Initialize(page);
        }
Exemplo n.º 3
0
        public XmlAddCAGObject(XmlAddCAGCategory parent, XmlTextReader xml)
        {
            this.m_Parent = parent;

            if (xml.MoveToAttribute("type"))
                this.m_Type = ScriptCompiler.FindTypeByFullName(xml.Value, false);

            if (xml.MoveToAttribute("gfx"))
                this.m_ItemID = XmlConvert.ToInt32(xml.Value);

            if (xml.MoveToAttribute("hue"))
                this.m_Hue = XmlConvert.ToInt32(xml.Value);
        }
        public XmlAddCAGCategory( XmlAddCAGCategory parent, XmlTextReader xml )
        {
            m_Parent = parent;

            if ( xml.MoveToAttribute( "title" ) )
            {
                if(xml.Value == "Add Menu")
                    m_Title = "XmlAdd Menu";
                else
                    m_Title = xml.Value;

            }
            else
                m_Title = "empty";

            if ( m_Title == "Docked" )
                m_Title = "Docked 2";

            if ( xml.IsEmptyElement )
            {
                m_Nodes = new XmlAddCAGNode[0];
            }
            else
            {
                ArrayList nodes = new ArrayList();

                try{
                while ( xml.Read() && xml.NodeType != XmlNodeType.EndElement )
                {

                    if ( xml.NodeType == XmlNodeType.Element && xml.Name == "object" )
                        nodes.Add( new XmlAddCAGObject( this, xml ) );
                    else if ( xml.NodeType == XmlNodeType.Element && xml.Name == "category" )
                        nodes.Add( new XmlAddCAGCategory( this, xml ) );
                    else
                        xml.Skip();

                }
                } catch (Exception ex){
                    Console.WriteLine("XmlCategorizedAddGump: Corrupted Data/objects.xml file detected. Not all XmlCAG objects loaded. {0}", ex);
                }

                m_Nodes = (XmlAddCAGNode[])nodes.ToArray( typeof( XmlAddCAGNode ) );

            }
        }
Exemplo n.º 5
0
        public XmlAddCAGObject(XmlAddCAGCategory parent, XmlTextReader xml)
        {
            m_Parent = parent;

            if (xml.MoveToAttribute("type"))
            {
                m_Type = ScriptCompiler.FindTypeByFullName(xml.Value, false);
            }

            if (xml.MoveToAttribute("gfx"))
            {
                m_ItemID = XmlConvert.ToInt32(xml.Value);
            }

            if (xml.MoveToAttribute("hue"))
            {
                m_Hue = XmlConvert.ToInt32(xml.Value);
            }
        }
Exemplo n.º 6
0
        public static XmlAddCAGCategory Load(string path)
        {
            if (File.Exists(path))
            {
                XmlTextReader xml = new XmlTextReader(path);

                xml.WhitespaceHandling = WhitespaceHandling.None;

                while (xml.Read())
                {
                    if (xml.Name == "category" && xml.NodeType == XmlNodeType.Element)
                    {
                        XmlAddCAGCategory cat = new XmlAddCAGCategory(null, xml);

                        xml.Close();

                        return(cat);
                    }
                }
            }

            return(new XmlAddCAGCategory());
        }
Exemplo n.º 7
0
        public XmlCategorizedAddGump(Mobile owner, XmlAddCAGCategory category, int page, int index, Gump gump)
            : base(GumpOffsetX, GumpOffsetY)
        {
            if (category == null)
            {
                category = XmlAddCAGCategory.Root;
                page = 0;
            }

            owner.CloseGump(typeof(WhoGump));

            this.m_Owner = owner;
            this.m_Category = category;
			
            this.m_Index = index;
            this.m_Gump = gump;
            if (gump is XmlAddGump)
            {
                XmlAddGump xmladdgump = (XmlAddGump)gump;

                if (xmladdgump != null && xmladdgump.defs != null)
                {
                    xmladdgump.defs.CurrentCategory = category;
                    xmladdgump.defs.CurrentCategoryPage = page;
                }
            }
            else if (gump is XmlSpawnerGump)
            {
                this.m_Spawner = ((XmlSpawnerGump)gump).m_Spawner;
            }

            this.Initialize(page);
        }
Exemplo n.º 8
0
        public static XmlAddCAGCategory Load(string path)
        {
            if (File.Exists(path))
            {
                XmlTextReader xml = new XmlTextReader(path);

                xml.WhitespaceHandling = WhitespaceHandling.None;

                while (xml.Read())
                {
                    if (xml.Name == "category" && xml.NodeType == XmlNodeType.Element)
                    {
                        XmlAddCAGCategory cat = new XmlAddCAGCategory(null, xml);

                        xml.Close();

                        return cat;
                    }
                }
            }

            return new XmlAddCAGCategory();
        }