本文整理汇总了C#中FairyGUI.Utils.XML.GetNode方法的典型用法代码示例。如果您正苦于以下问题:C# XML.GetNode方法的具体用法?C# XML.GetNode怎么用?C# XML.GetNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FairyGUI.Utils.XML
的用法示例。
在下文中一共展示了XML.GetNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup_AfterAdd
public override void Setup_AfterAdd(XML xml)
{
base.Setup_AfterAdd(xml);
XML cxml = xml.GetNode("gearColor");
if (cxml != null)
gearColor.Setup(cxml);
}
示例2: ConstructFromXML
public override void ConstructFromXML(XML cxml)
{
base.ConstructFromXML(cxml);
XML xml = cxml.GetNode("ProgressBar");
string str;
str = xml.GetAttribute("titleType");
if (str != null)
_titleType = FieldTypes.ParseProgressTitleType(str);
else
_titleType = ProgressTitleType.Percent;
_reverse = xml.GetAttributeBool("reverse", false);
_titleObject = GetChild("title") as GTextField;
_barObjectH = GetChild("bar");
_barObjectV = GetChild("bar_v");
_aniObject = GetChild("ani") as GMovieClip;
if (_barObjectH != null)
{
_barMaxWidth = _barObjectH.width;
_barMaxWidthDelta = this.width - _barMaxWidth;
_barStartX = _barObjectH.x;
}
if (_barObjectV != null)
{
_barMaxHeight = _barObjectV.height;
_barMaxHeightDelta = this.height - _barMaxHeight;
_barStartY = _barObjectV.y;
}
}
示例3: ConstructFromXML
public virtual void ConstructFromXML(XML xml)
{
string str;
string[] arr;
underConstruct = true;
arr = xml.GetAttributeArray("size");
sourceWidth = int.Parse(arr[0]);
sourceHeight = int.Parse(arr[1]);
initWidth = sourceWidth;
initHeight = sourceHeight;
OverflowType overflow;
str = xml.GetAttribute("overflow");
if (str != null)
overflow = FieldTypes.ParseOverflowType(str);
else
overflow = OverflowType.Visible;
ScrollType scroll;
str = xml.GetAttribute("scroll");
if (str != null)
scroll = FieldTypes.ParseScrollType(str);
else
scroll = ScrollType.Vertical;
ScrollBarDisplayType scrollBarDisplay;
str = xml.GetAttribute("scrollBar");
if (str != null)
scrollBarDisplay = FieldTypes.ParseScrollBarDisplayType(str);
else
scrollBarDisplay = ScrollBarDisplayType.Default;
int scrollBarFlags = xml.GetAttributeInt("scrollBarFlags");
Margin scrollBarMargin = new Margin();
str = xml.GetAttribute("scrollBarMargin");
if (str != null)
scrollBarMargin.Parse(str);
str = xml.GetAttribute("margin");
if (str != null)
_margin.Parse(str);
SetSize(sourceWidth, sourceHeight);
SetupOverflowAndScroll(overflow, scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags);
arr = xml.GetAttributeArray("clipSoftness");
if (arr != null)
this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1]));
_buildingDisplayList = true;
XMLList col = xml.Elements("controller");
Controller controller;
foreach (XML cxml in col)
{
controller = new Controller();
_controllers.Add(controller);
controller.parent = this;
controller.Setup(cxml);
}
XML listNode = xml.GetNode("displayList");
if (listNode != null)
{
col = listNode.Elements();
GObject u;
foreach (XML cxml in col)
{
u = ConstructChild(cxml);
if (u == null)
continue;
u.underConstruct = true;
u.constructingData = cxml;
u.Setup_BeforeAdd(cxml);
AddChild(u);
}
}
this.relations.Setup(xml);
int cnt = _children.Count;
for (int i = 0; i < cnt; i++)
{
GObject u = _children[i];
u.relations.Setup(u.constructingData);
}
for (int i = 0; i < cnt; i++)
{
GObject u = _children[i];
u.Setup_AfterAdd(u.constructingData);
u.underConstruct = false;
u.constructingData = null;
}
XMLList transCol = xml.Elements("transition");
//.........这里部分代码省略.........
示例4: Setup_AfterAdd
public override void Setup_AfterAdd(XML xml)
{
base.Setup_AfterAdd(xml);
XML cxml = xml.GetNode("gearColor");
if (cxml != null)
gearColor.Setup(cxml);
UpdateTextFormat();
string str = xml.GetAttribute("text");
if (str != null && str.Length > 0)
this.text = str;
}
示例5: Setup_AfterAdd
public override void Setup_AfterAdd(XML cxml)
{
base.Setup_AfterAdd(cxml);
XML xml = cxml.GetNode("Slider");
if (xml == null)
return;
_value = xml.GetAttributeInt("value");
_max = xml.GetAttributeInt("max");
Update();
}
示例6: TranslateComponent
void TranslateComponent(XML xml, Dictionary<string, string> strings)
{
XML listNode = xml.GetNode("displayList");
if (listNode == null)
return;
XMLList col = listNode.Elements();
string ename, elementId, value;
foreach (XML cxml in col)
{
ename = cxml.name;
elementId = cxml.GetAttribute("id");
if (cxml.HasAttribute("tooltips"))
{
if (strings.TryGetValue(elementId + "-tips", out value))
cxml.SetAttribute("tooltips", value);
}
if (ename == "text" || ename == "richtext")
{
if (strings.TryGetValue(elementId, out value))
cxml.SetAttribute("text", value);
}
else if (ename == "list")
{
XMLList items = cxml.Elements("item");
int j = 0;
foreach (XML exml in items)
{
if (strings.TryGetValue(elementId + "-" + j, out value))
exml.SetAttribute("title", value);
j++;
}
}
else if (ename == "component")
{
XML dxml = cxml.GetNode("Button");
if (dxml != null)
{
if (strings.TryGetValue(elementId, out value))
dxml.SetAttribute("title", value);
if (strings.TryGetValue(elementId + "-0", out value))
dxml.SetAttribute("selectedTitle", value);
}
else
{
dxml = cxml.GetNode("Label");
if (dxml != null)
{
if (strings.TryGetValue(elementId, out value))
dxml.SetAttribute("title", value);
}
else
{
dxml = cxml.GetNode("ComboBox");
if (dxml != null)
{
if (strings.TryGetValue(elementId, out value))
dxml.SetAttribute("title", value);
XMLList items = dxml.Elements("item");
int j = 0;
foreach (XML exml in items)
{
if (strings.TryGetValue(elementId + "-" + j, out value))
exml.SetAttribute("title", value);
j++;
}
}
}
}
}
}
}
示例7: Setup_AfterAdd
public override void Setup_AfterAdd(XML cxml)
{
base.Setup_AfterAdd(cxml);
XML xml = cxml.GetNode("ComboBox");
if (xml == null)
return;
string str;
str = xml.GetAttribute("titleColor");
if (str != null)
this.titleColor = ToolSet.ConvertFromHtmlColor(str);
visibleItemCount = xml.GetAttributeInt("visibleItemCount", visibleItemCount);
_popupDirection = xml.GetAttribute("direction", _popupDirection);
XMLList col = xml.Elements("item");
_items = new string[col.Count];
_values = new string[col.Count];
int i = 0;
foreach (XML ix in col)
{
_items[i] = ix.GetAttribute("title");
_values[i] = ix.GetAttribute("value");
i++;
}
str = xml.GetAttribute("title");
if (str != null && str.Length > 0)
{
this.text = str;
_selectedIndex = Array.IndexOf(_items, str);
}
else if (_items.Length > 0)
{
_selectedIndex = 0;
this.text = _items[0];
}
else
_selectedIndex = -1;
}
示例8: LoadMovieClip
void LoadMovieClip(PackageItem item)
{
string str = GetDesc(item.id + ".xml");
XML xml = new XML(str);
string[] arr = null;
arr = xml.GetAttributeArray("pivot");
if (arr != null)
{
item.pivot.x = int.Parse(arr[0]);
item.pivot.y = int.Parse(arr[1]);
}
str = xml.GetAttribute("interval");
if (str != null)
item.interval = float.Parse(str) / 1000f;
item.swing = xml.GetAttributeBool("swing", false);
str = xml.GetAttribute("repeatDelay");
if (str != null)
item.repeatDelay = float.Parse(str) / 1000f;
int frameCount = xml.GetAttributeInt("frameCount");
item.frames = new Frame[frameCount];
XMLList frameNodes = xml.GetNode("frames").Elements();
int i = 0;
foreach (XML frameNode in frameNodes)
{
Frame frame = new Frame();
arr = frameNode.GetAttributeArray("rect");
frame.rect = new Rect(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]), int.Parse(arr[3]));
str = frameNode.GetAttribute("addDelay");
if (str != null)
frame.addDelay = float.Parse(str) / 1000f;
AtlasSprite sprite;
if (_sprites.TryGetValue(item.id + "_" + i, out sprite))
frame.texture = CreateSpriteTexture(sprite);
item.frames[i] = frame;
i++;
}
}
示例9: ConstructFromXML
public override void ConstructFromXML(XML cxml)
{
base.ConstructFromXML(cxml);
XML xml = cxml.GetNode("ScrollBar");
if (xml != null)
_fixedGripSize = xml.GetAttributeBool("fixedGripSize");
_grip = GetChild("grip");
if (_grip == null)
{
Debug.LogWarning("FairyGUI: " + this.resourceURL + " should define grip");
return;
}
_bar = GetChild("bar");
if (_bar == null)
{
Debug.LogWarning("FairyGUI: " + this.resourceURL + " should define bar");
return;
}
_arrowButton1 = GetChild("arrow1");
_arrowButton2 = GetChild("arrow2");
_grip.onTouchBegin.Add(__gripTouchBegin);
_grip.onTouchEnd.Add(__gripTouchEnd);
this.onTouchBegin.Add(__touchBegin);
if (_arrowButton1 != null)
_arrowButton1.onTouchBegin.Add(__arrowButton1Click);
if (_arrowButton2 != null)
_arrowButton2.onTouchBegin.Add(__arrowButton2Click);
}
示例10: Setup_AfterAdd
public virtual void Setup_AfterAdd(XML xml)
{
XML cxml = null;
string str;
str = xml.GetAttribute("group");
if (str != null)
group = parent.GetChildById(str) as GGroup;
cxml = xml.GetNode("gearDisplay");
if (cxml != null)
gearDisplay.Setup(cxml);
cxml = xml.GetNode("gearXY");
if (cxml != null)
gearXY.Setup(cxml);
cxml = xml.GetNode("gearSize");
if (cxml != null)
gearSize.Setup(cxml);
cxml = xml.GetNode("gearLook");
if (cxml != null)
gearLook.Setup(cxml);
}
示例11: Setup_AfterAdd
public override void Setup_AfterAdd(XML cxml)
{
base.Setup_AfterAdd(cxml);
XML xml = cxml.GetNode("Label");
if (xml == null)
{
this.title = string.Empty;
this.icon = null;
return;
}
this.title = xml.GetAttribute("title");
this.icon = xml.GetAttribute("icon");
string str = xml.GetAttribute("titleColor");
if (str != null)
this.titleColor = ToolSet.ConvertFromHtmlColor(str);
}
示例12: ConstructFromXML
public override void ConstructFromXML(XML cxml)
{
base.ConstructFromXML(cxml);
XML xml = cxml.GetNode("Slider");
string str;
str = xml.GetAttribute("titleType");
if (str != null)
_titleType = FieldTypes.ParseProgressTitleType(str);
else
_titleType = ProgressTitleType.Percent;
_titleObject = GetChild("title") as GTextField;
_barObjectH = GetChild("bar");
_barObjectV = GetChild("bar_v");
_aniObject = GetChild("ani") as GMovieClip;
_gripObject = GetChild("grip");
if (_barObjectH != null)
{
_barMaxWidth = _barObjectH.width;
_barMaxWidthDelta = this.width - _barMaxWidth;
}
if (_barObjectV != null)
{
_barMaxHeight = _barObjectV.height;
_barMaxHeightDelta = this.height - _barMaxHeight;
}
if (_gripObject != null)
{
_gripObject.onTouchBegin.Add(__gripTouchBegin);
_gripObject.onTouchEnd.Add(__gripTouchEnd);
}
}
示例13: LoadMovieClip
void LoadMovieClip(PackageItem item)
{
string str = _descPack[item.id + ".xml"];
XML xml = new XML(str);
string[] arr = null;
str = xml.GetAttribute("interval");
if (str != null)
item.interval = float.Parse(str) / 1000f;
item.swing = xml.GetAttributeBool("swing", false);
str = xml.GetAttribute("repeatDelay");
if (str != null)
item.repeatDelay = float.Parse(str) / 1000f;
int frameCount = xml.GetAttributeInt("frameCount");
item.frames = new MovieClip.Frame[frameCount];
int i = 0;
string spriteId;
XML frameNode;
MovieClip.Frame frame;
AtlasSprite sprite;
XMLList.Enumerator et = xml.GetNode("frames").GetEnumerator();
while (et.MoveNext())
{
frameNode = et.Current;
frame = new MovieClip.Frame();
arr = frameNode.GetAttributeArray("rect");
frame.rect = new Rect(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]), int.Parse(arr[3]));
str = frameNode.GetAttribute("addDelay");
if (str != null)
frame.addDelay = float.Parse(str) / 1000f;
str = frameNode.GetAttribute("sprite");
if (str != null)
spriteId = item.id + "_" + str;
else if (frame.rect.width != 0)
spriteId = item.id + "_" + i;
else
spriteId = null;
if (spriteId != null && _sprites.TryGetValue(spriteId, out sprite))
{
PackageItem atlasItem = _itemsById[sprite.atlas];
if (atlasItem != null)
{
if (item.texture == null)
item.texture = (NTexture)GetItemAsset(atlasItem);
frame.uvRect = new Rect(sprite.rect.x / item.texture.width * item.texture.uvRect.width,
1 - sprite.rect.yMax * item.texture.uvRect.height / item.texture.height,
sprite.rect.width * item.texture.uvRect.width / item.texture.width,
sprite.rect.height * item.texture.uvRect.height / item.texture.height);
}
}
item.frames[i] = frame;
i++;
}
}
示例14: Setup_AfterAdd
public override void Setup_AfterAdd(XML cxml)
{
base.Setup_AfterAdd(cxml);
XML xml = cxml.GetNode("Label");
if (xml == null)
return;
string str;
str = xml.GetAttribute("title");
if (str != null)
this.title = str;
str = xml.GetAttribute("icon");
if (str != null)
this.icon = str;
str = xml.GetAttribute("titleColor");
if (str != null)
this.titleColor = ToolSet.ConvertFromHtmlColor(str);
if (_titleObject is GTextInput)
{
str = xml.GetAttribute("promptText");
if (str != null)
((GTextInput)_titleObject).promptText = str;
}
}
示例15: Setup_AfterAdd
public override void Setup_AfterAdd(XML cxml)
{
base.Setup_AfterAdd(cxml);
XML xml = cxml.GetNode("ProgressBar");
if (xml != null)
{
_value = xml.GetAttributeInt("value");
_max = xml.GetAttributeInt("max");
}
Update(_value);
}