virtual public 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); OverflowType overflow; str = (string)xml.GetAttribute("overflow"); if (str != null) { overflow = FieldTypes.parseOverflowType(str); } else { overflow = OverflowType.Visible; } str = (string)xml.GetAttribute("margin"); if (str != null) { _margin.Parse(str); } ScrollType scroll; str = (string)xml.GetAttribute("scroll"); if (str != null) { scroll = FieldTypes.parseScrollType(str); } else { scroll = ScrollType.Vertical; } str = (string)xml.GetAttribute("scrollSpeed"); int scrollSpeed = 0; if (str != null) { scrollSpeed = int.Parse(str); } ScrollBarDisplayType scrollBarDisplay; str = (string)xml.GetAttribute("scrollBar"); if (str != null) { scrollBarDisplay = FieldTypes.parseScrollBarDisplayType(str); } else { scrollBarDisplay = ScrollBarDisplayType.Default; } //_instNextId = uint.Parse( ( string )xml.GetAttribute("idnum"));//旧格式定义 _buildingDisplayList = true; XMLList col = xml.Elements("controller"); Controller controller; if (col != null) { foreach (XML cxml in col) { controller = new Controller(); _controllers.Add(controller); controller._parent = this; controller.Setup(cxml); } } XML listNode = xml.GetNode("displayList"); col = listNode.Elements(); GObject u; ArrayList tmp = new ArrayList(); if (col != null) { foreach (XML cxml in col) { u = ConstructChild(cxml); if (u == null) { continue; } u.Setup_BeforeAdd(cxml); AddChild(u); tmp.Add(u); tmp.Add(cxml); } } this.relations.Setup(xml); int cnt = tmp.Count; for (int i = 0; i < cnt; i += 2) { u = ( GObject )tmp[i]; u.Setup_AfterAdd(( XML )tmp[i + 1]); } ApplyAllControllers(); _buildingDisplayList = false; underConstruct = false; //build real display list foreach (GObject child in _children) { if (child.displayObject != null && child.finalVisible) { container.AddChild(child.displayObject); } } SetupOverflowAndScroll(overflow, _margin, scroll, scrollSpeed, scrollBarDisplay); }
override public void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; str = (string)xml.GetAttribute("url"); if (str != null) { url = str; } else { url = ""; } str = (string)xml.GetAttribute("align"); if (str != null) { _align = FieldTypes.parseAlign(str); } str = (string)xml.GetAttribute("vAlign"); if (str != null) { _verticalAlign = FieldTypes.parseVerticalAlign(str); } str = (string)xml.GetAttribute("overflow"); if (str != null) { _overflow = FieldTypes.parseOverflowType(str); } else { _overflow = OverflowType.Visible; } _autoSize = (string)xml.GetAttribute("autoSize") == "true"; str = (string)xml.GetAttribute("errorSign"); _showErrorSign = str == "true"; str = (string)xml.GetAttribute("jtaAction"); if (str != null) { _jtaAction = int.Parse(str); } else { _jtaAction = 0; } str = (string)xml.GetAttribute("jtaDir"); if (str != null) { _jtaDir = int.Parse(str); if (_jtaDir == 0) { _jtaDir = 1; } } else { _jtaDir = 1; } _playing = (string)xml.GetAttribute("playing") != "false"; if (_url != null) { LoadContent(); } }
public void Setup(XML xml) { string str; _controller = _owner.parent.GetController(xml.GetAttribute("controller")); if (_controller == null) { return; } Init(); string[] pages = xml.GetAttributeArray("pages"); if (pages != null) { foreach (string s in pages) { _pageSet.AddById(s); } } str = xml.GetAttribute("tween"); if (str != null) { _tween = str; if (_tween == "ease") { _tween = UIConfig.defaultGearTweenFunction; easeType = FieldTypes.ParseEaseType(str); } } else { _tween = null; } str = xml.GetAttribute("duration"); if (str != null) { tweenTime = float.Parse(str); } str = xml.GetAttribute("values"); string[] values = null; if (str != null) { values = str.Split(jointChar1); } int i; _storage = new Dictionary <string, object>(); if (values != null) { for (i = 0; i < values.Length; i++) { str = values[i]; if (str != "-") { _storage[pages[i]] = ReadValue(str); AddStatus(pages[i], str); } } } str = (string)xml.GetAttribute("default"); if (str != null) { _default = ReadValue(str); AddStatus(null, str); } else { _default = null; } }
override public void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; str = (string)xml.GetAttribute("layout"); if (str != null) { _layoutObsolete = str; } else { _layoutObsolete = SINGLE_COLUMN; } str = (string)xml.GetAttribute("margin"); _margin.Parse(str); OverflowType overflow; str = (string)xml.GetAttribute("overflow"); if (str != null) { overflow = FieldTypes.parseOverflowType(str); } else { overflow = OverflowType.Visible; } ScrollType scroll; str = (string)xml.GetAttribute("scroll"); if (str != null) { scroll = FieldTypes.parseScrollType(str); } else { scroll = ScrollType.Vertical; } str = (string)xml.GetAttribute("scrollSpeed"); int scrollSpeed = 0; if (str != null) { scrollSpeed = int.Parse(str); } ScrollBarDisplayType scrollBarDisplay; str = (string)xml.GetAttribute("scrollBar"); if (str != null) { scrollBarDisplay = FieldTypes.parseScrollBarDisplayType(str); } else { scrollBarDisplay = ScrollBarDisplayType.Default; } str = (string)xml.GetAttribute("lineGap"); if (str != null) { _lineGap = int.Parse(str); } else { _lineGap = 0; } str = (string)xml.GetAttribute("colGap"); if (str != null) { _columnGap = int.Parse(str); } else { _columnGap = 0; } str = (string)xml.GetAttribute("defaultItem"); if (str != null) { _defaultItem = str; } SetupOverflowAndScroll(overflow, _margin, scroll, scrollSpeed, scrollBarDisplay); str = (string)xml.GetAttribute("items"); if (str != null) { string[] items = str.Split(new char[] { ',' }); int cnt = items.Length; for (int i = 0; i < cnt; i++) { string s = items[i]; if (s != null) { AddChild(GetFromPool(s)); } } } }
override public void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; this.displayAsPassword = (string)xml.GetAttribute("password") == "true"; str = (string)xml.GetAttribute("font"); if (str != null) { _font = str; } str = (string)xml.GetAttribute("fontSize"); if (str != null) { _fontSize = int.Parse(str); } str = (string)xml.GetAttribute("color"); if (str != null) { _textFormat.color = ToolSet.ConvertFromHtmlColor(str); } str = (string)xml.GetAttribute("align"); if (str != null) { _align = FieldTypes.parseAlign(str); } str = (string)xml.GetAttribute("vAlign"); if (str != null) { _verticalAlign = FieldTypes.parseVerticalAlign(str); } str = (string)xml.GetAttribute("leading"); if (str != null) { _leading = int.Parse(str); } else { _leading = 3; } str = (string)xml.GetAttribute("letterSpacing"); if (str != null) { _letterSpacing = int.Parse(str); } _ubbEnabled = (string)xml.GetAttribute("ubb") == "true"; this.displayAsPassword = (string)xml.GetAttribute("password") == "true"; str = (string)xml.GetAttribute("autoSize"); _updatingSize = true; if (str != null) { this.autoSize = FieldTypes.parseAutoSizeType(str); } UpdateTextFormat(); _updatingSize = false; str = (string)xml.GetAttribute("text"); if (str != null && str.Length > 0) { this.text = (string)xml.GetAttribute("text"); } else { this.text = (string)xml.GetAttribute("demoText"); } }