本文整理汇总了C#中FairyGUI.Utils.XML.GetAttributeInt方法的典型用法代码示例。如果您正苦于以下问题:C# XML.GetAttributeInt方法的具体用法?C# XML.GetAttributeInt怎么用?C# XML.GetAttributeInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FairyGUI.Utils.XML
的用法示例。
在下文中一共展示了XML.GetAttributeInt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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++;
}
}
示例2: 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];
XMLList frameNodes = xml.GetNode("frames").Elements();
int i = 0;
foreach (XML frameNode in frameNodes)
{
MovieClip.Frame 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;
AtlasSprite sprite;
if (_sprites.TryGetValue(item.id + "_" + i, 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++;
}
}
示例3: Setup_BeforeAdd
public override void Setup_BeforeAdd(XML xml)
{
base.Setup_BeforeAdd(xml);
string str;
str = xml.GetAttribute("color");
if (str != null)
this.color = ToolSet.ConvertFromHtmlColor(str);
str = xml.GetAttribute("flip");
if (str != null)
_content.flip = FieldTypes.ParseFlipType(str);
str = xml.GetAttribute("fillMethod");
if (str != null)
_content.fillMethod = FieldTypes.ParseFillMethod(str);
if (_content.fillMethod != FillMethod.None)
{
_content.fillOrigin = xml.GetAttributeInt("fillOrigin");
_content.fillClockwise = xml.GetAttributeBool("fillClockwise", true);
_content.fillAmount = (float)xml.GetAttributeInt("fillAmount", 100) / 100;
}
}
示例4: 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");
//.........这里部分代码省略.........
示例5: Setup_BeforeAdd
public override void Setup_BeforeAdd(XML xml)
{
base.Setup_BeforeAdd(xml);
string str;
string[] arr;
str = xml.GetAttribute("layout");
if (str != null)
_layout = FieldTypes.ParseListLayoutType(str);
else
_layout = ListLayoutType.SingleColumn;
str = xml.GetAttribute("selectionMode");
if (str != null)
selectionMode = FieldTypes.ParseListSelectionMode(str);
else
selectionMode = ListSelectionMode.Single;
OverflowType overflow;
str = xml.GetAttribute("overflow");
if (str != null)
overflow = FieldTypes.ParseOverflowType(str);
else
overflow = OverflowType.Visible;
str = xml.GetAttribute("margin");
if (str != null)
_margin.Parse(str);
str = xml.GetAttribute("align");
if (str != null)
_align = FieldTypes.ParseAlign(str);
str = xml.GetAttribute("vAlign");
if (str != null)
_verticalAlign = FieldTypes.ParseVerticalAlign(str);
if (overflow == OverflowType.Scroll)
{
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);
string vtScrollBarRes = null;
string hzScrollBarRes = null;
arr = xml.GetAttributeArray("scrollBarRes");
if (arr != null)
{
vtScrollBarRes = arr[0];
hzScrollBarRes = arr[1];
}
SetupScroll(scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags, vtScrollBarRes, hzScrollBarRes);
}
else
{
SetupOverflow(overflow);
}
arr = xml.GetAttributeArray("clipSoftness");
if (arr != null)
this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1]));
_lineGap = xml.GetAttributeInt("lineGap");
_columnGap = xml.GetAttributeInt("colGap");
_lineItemCount = xml.GetAttributeInt("lineItemCount");
defaultItem = xml.GetAttribute("defaultItem");
autoResizeItem = xml.GetAttributeBool("autoItemSize", true);
XMLList.Enumerator et = xml.GetEnumerator("item");
while (et.MoveNext())
{
XML ix = et.Current;
string url = ix.GetAttribute("url");
if (string.IsNullOrEmpty(url))
{
url = defaultItem;
if (string.IsNullOrEmpty(url))
continue;
}
//.........这里部分代码省略.........
示例6: Setup_BeforeAdd
public override void Setup_BeforeAdd(XML xml)
{
base.Setup_BeforeAdd(xml);
string str;
str = xml.GetAttribute("url");
if (str != null)
_url = str;
str = xml.GetAttribute("align");
if (str != null)
_align = FieldTypes.ParseAlign(str);
str = xml.GetAttribute("vAlign");
if (str != null)
_verticalAlign = FieldTypes.ParseVerticalAlign(str);
str = xml.GetAttribute("fill");
if (str != null)
_fill = FieldTypes.ParseFillType(str);
_autoSize = xml.GetAttributeBool("autoSize", false);
str = xml.GetAttribute("errorSign");
if (str != null)
showErrorSign = str == "true";
_playing = xml.GetAttributeBool("playing", true);
str = xml.GetAttribute("color");
if (str != null)
this.color = ToolSet.ConvertFromHtmlColor(str);
str = xml.GetAttribute("fillMethod");
if (str != null)
_content.fillMethod = FieldTypes.ParseFillMethod(str);
if (_content.fillMethod != FillMethod.None)
{
_content.fillOrigin = xml.GetAttributeInt("fillOrigin");
_content.fillClockwise = xml.GetAttributeBool("fillClockwise", true);
_content.fillAmount = (float)xml.GetAttributeInt("fillAmount", 100) / 100;
}
if (_url != null)
LoadContent();
}
示例7: Setup_BeforeAdd
public override void Setup_BeforeAdd(XML xml)
{
base.Setup_BeforeAdd(xml);
string str;
str = xml.GetAttribute("layout");
if (str != null)
_layout = FieldTypes.ParseListLayoutType(str);
else
_layout = ListLayoutType.SingleColumn;
str = xml.GetAttribute("selectionMode");
if (str != null)
selectionMode = FieldTypes.ParseListSelectionMode(str);
else
selectionMode = ListSelectionMode.Single;
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);
SetupOverflowAndScroll(overflow, scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags);
string[] arr = xml.GetAttributeArray("clipSoftness");
if (arr != null)
this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1]));
_lineGap = xml.GetAttributeInt("lineGap");
_columnGap = xml.GetAttributeInt("colGap");
defaultItem = xml.GetAttribute("defaultItem");
autoResizeItem = xml.GetAttributeBool("autoItemSize", true);
XMLList col = xml.Elements("item");
foreach (XML ix in col)
{
string url = ix.GetAttribute("url");
if (string.IsNullOrEmpty(url))
url = defaultItem;
if (string.IsNullOrEmpty(url))
continue;
GObject obj = AddItemFromPool(url);
if (obj is GButton)
{
((GButton)obj).title = ix.GetAttribute("title");
((GButton)obj).icon = ix.GetAttribute("icon");
}
else if (obj is GLabel)
{
((GLabel)obj).title = ix.GetAttribute("title");
((GLabel)obj).icon = ix.GetAttribute("icon");
}
}
}
示例8: Setup_BeforeAdd
public override void Setup_BeforeAdd(XML xml)
{
base.Setup_BeforeAdd(xml);
string str;
this.displayAsPassword = xml.GetAttributeBool("password", false);
str = xml.GetAttribute("font");
if (str != null)
_textFormat.font = str;
str = xml.GetAttribute("fontSize");
if (str != null)
_textFormat.size = int.Parse(str);
str = xml.GetAttribute("color");
if (str != null)
_textFormat.color = ToolSet.ConvertFromHtmlColor(str);
str = xml.GetAttribute("align");
if (str != null)
_align = FieldTypes.ParseAlign(str);
str = xml.GetAttribute("vAlign");
if (str != null)
_verticalAlign = FieldTypes.ParseVerticalAlign(str);
str = xml.GetAttribute("leading");
if (str != null)
_textFormat.lineSpacing = int.Parse(str);
str = xml.GetAttribute("letterSpacing");
if (str != null)
_textFormat.letterSpacing = int.Parse(str);
_ubbEnabled = xml.GetAttributeBool("ubb", false);
str = xml.GetAttribute("autoSize");
if (str != null)
this.autoSize = FieldTypes.ParseAutoSizeType(str);
_textFormat.underline = xml.GetAttributeBool("underline", false);
_textFormat.italic = xml.GetAttributeBool("italic", false);
_textFormat.bold = xml.GetAttributeBool("bold", false);
_singleLine = xml.GetAttributeBool("singleLine", false);
str = xml.GetAttribute("strokeColor");
if (str != null)
{
_strokeColor = ToolSet.ConvertFromHtmlColor(str);
_stroke = xml.GetAttributeInt("strokeSize", 1);
}
}
示例9: 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;
SetSize(sourceWidth, sourceHeight);
arr = xml.GetAttributeArray("pivot");
if (arr != null)
{
float f1 = float.Parse(arr[0]);
float f2 = float.Parse(arr[1]);
this.SetPivot(f1, f2, xml.GetAttributeBool("anchor"));
}
this.opaque = xml.GetAttributeBool("opaque", true);
arr = xml.GetAttributeArray("hitTest");
if (arr != null)
{
PixelHitTestData hitTestData = _packageItem.owner.GetPixelHitTestData(arr[0]);
if (hitTestData != null)
this.rootContainer.hitArea = new PixelHitTest(hitTestData, int.Parse(arr[1]), int.Parse(arr[2]));
}
OverflowType overflow;
str = xml.GetAttribute("overflow");
if (str != null)
overflow = FieldTypes.ParseOverflowType(str);
else
overflow = OverflowType.Visible;
str = xml.GetAttribute("margin");
if (str != null)
_margin.Parse(str);
if (overflow == OverflowType.Scroll)
{
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);
string vtScrollBarRes = null;
string hzScrollBarRes = null;
arr = xml.GetAttributeArray("scrollBarRes");
if (arr != null)
{
vtScrollBarRes = arr[0];
hzScrollBarRes = arr[1];
}
SetupScroll(scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags, vtScrollBarRes, hzScrollBarRes);
}
else
SetupOverflow(overflow);
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();
//.........这里部分代码省略.........
示例10: 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++;
}
}
示例11: Setup
public void Setup(XML xml)
{
this.name = xml.GetAttribute("name");
_options = xml.GetAttributeInt("options");
this.autoPlay = xml.GetAttributeBool("autoPlay");
if (this.autoPlay)
{
this.autoPlayRepeat = xml.GetAttributeInt("autoPlayRepeat", 1);
this.autoPlayDelay = xml.GetAttributeFloat("autoPlayDelay");
}
XMLList col = xml.Elements("item");
foreach (XML cxml in col)
{
TransitionItem item = new TransitionItem();
_items.Add(item);
item.time = (float)cxml.GetAttributeInt("time") / (float)FRAME_RATE;
item.targetId = cxml.GetAttribute("target", string.Empty);
item.type = FieldTypes.ParseTransitionActionType(cxml.GetAttribute("type"));
item.tween = cxml.GetAttributeBool("tween");
item.label = cxml.GetAttribute("label");
if (item.tween)
{
item.duration = (float)cxml.GetAttributeInt("duration") / FRAME_RATE;
if (item.time + item.duration > _maxTime)
_maxTime = item.time + item.duration;
string ease = cxml.GetAttribute("ease");
if (ease != null)
item.easeType = FieldTypes.ParseEaseType(ease);
item.repeat = cxml.GetAttributeInt("repeat");
item.yoyo = cxml.GetAttributeBool("yoyo");
item.label2 = cxml.GetAttribute("label2");
string v = cxml.GetAttribute("endValue");
if (v != null)
{
DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.startValue);
DecodeValue(item.type, v, item.endValue);
}
else
{
item.tween = false;
DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.value);
}
}
else
{
if (item.time > _maxTime)
_maxTime = item.time;
DecodeValue(item.type, cxml.GetAttribute("value", string.Empty), item.value);
}
}
}