Modernization Fixes & Updates to Default Values (#3)
This commit is contained in:
parent
445eddff68
commit
dcf64091b1
768 changed files with 10507 additions and 14196 deletions
|
|
@ -2,7 +2,7 @@ using System.Xml;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ChildNode
|
||||
public class ChildNode : IGoNode
|
||||
{
|
||||
public ChildNode(XmlTextReader xml, ParentNode parent)
|
||||
{
|
||||
|
|
@ -19,10 +19,7 @@ namespace Server.Gumps
|
|||
|
||||
private void Parse(XmlTextReader xml)
|
||||
{
|
||||
if (xml.MoveToAttribute("name"))
|
||||
Name = xml.Value;
|
||||
else
|
||||
Name = "empty";
|
||||
Name = xml.MoveToAttribute("name") ? xml.Value : "empty";
|
||||
|
||||
int x = 0, y = 0, z = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Gumps
|
|||
|
||||
private GoGump(int page, Mobile from, LocationTree tree, ParentNode node) : base(50, 50)
|
||||
{
|
||||
from.CloseGump(typeof(GoGump));
|
||||
from.CloseGump<GoGump>();
|
||||
|
||||
tree.LastBranch[from] = node;
|
||||
|
||||
|
|
@ -151,13 +151,8 @@ namespace Server.Gumps
|
|||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
object child = node.Children[index];
|
||||
string name = "";
|
||||
|
||||
if (child is ParentNode parentNode)
|
||||
name = parentNode.Name;
|
||||
else if (child is ChildNode childNode)
|
||||
name = childNode.Name;
|
||||
IGoNode child = node.Children[index];
|
||||
string name = child.Name;
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, name);
|
||||
|
|
@ -228,7 +223,7 @@ namespace Server.Gumps
|
|||
|
||||
if (index >= 0 && index < m_Node.Children.Length)
|
||||
{
|
||||
object o = m_Node.Children[index];
|
||||
IGoNode o = m_Node.Children[index];
|
||||
|
||||
if (o is ParentNode node)
|
||||
from.SendGump(new GoGump(0, from, m_Tree, node));
|
||||
|
|
|
|||
|
|
@ -1,37 +1,38 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ParentNode
|
||||
public interface IGoNode
|
||||
{
|
||||
ParentNode Parent{ get; }
|
||||
string Name{ get; }
|
||||
}
|
||||
|
||||
public class ParentNode : IGoNode
|
||||
{
|
||||
public ParentNode(XmlTextReader xml, ParentNode parent)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
|
||||
Parse(xml);
|
||||
}
|
||||
|
||||
public ParentNode Parent{ get; }
|
||||
|
||||
public object[] Children{ get; private set; }
|
||||
public IGoNode[] Children{ get; private set; }
|
||||
|
||||
public string Name{ get; private set; }
|
||||
|
||||
private void Parse(XmlTextReader xml)
|
||||
{
|
||||
if (xml.MoveToAttribute("name"))
|
||||
Name = xml.Value;
|
||||
else
|
||||
Name = "empty";
|
||||
Name = xml.MoveToAttribute("name") ? xml.Value : "empty";
|
||||
|
||||
if (xml.IsEmptyElement)
|
||||
{
|
||||
Children = new object[0];
|
||||
}
|
||||
Children = new IGoNode[0];
|
||||
else
|
||||
{
|
||||
ArrayList children = new ArrayList();
|
||||
List<IGoNode> children = new List<IGoNode>();
|
||||
|
||||
while (xml.Read() && (xml.NodeType == XmlNodeType.Element || xml.NodeType == XmlNodeType.Comment))
|
||||
{
|
||||
|
|
@ -39,15 +40,9 @@ namespace Server.Gumps
|
|||
continue;
|
||||
|
||||
if (xml.Name == "child")
|
||||
{
|
||||
ChildNode n = new ChildNode(xml, this);
|
||||
|
||||
children.Add(n);
|
||||
}
|
||||
children.Add(new ChildNode(xml, this));
|
||||
else
|
||||
{
|
||||
children.Add(new ParentNode(xml, this));
|
||||
}
|
||||
}
|
||||
|
||||
Children = children.ToArray();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue