public void SetNativeObject(DisplayObject obj) { if (_displayObject == obj) { return; } if (_displayObject != null) { obj.internalId = _displayObject.internalId; _displayObject.Dispose(); _shape = null; _displayObject = null; } _displayObject = obj; _displayObject.alpha = _alpha; _displayObject.rotation = _rotation; _displayObject.visible = _visible; _displayObject.mouseEnabled = _touchable; _displayObject.gOwner = this; if (_parent != null) { _parent.ChildStateChanged(this); } HandlePositionChanged();//只重设位置 //所以原生GUI方式是否应确立范围区域 HandleSizeChanged(); }
override public void Setup_BeforeAdd(XML xml) { string str; string type = (string)xml.GetAttribute("type"); if (type != null && type != "empty") { _shape = new UIShape(this); _shape.gOwner = this; _displayObject = _shape; } base.Setup_BeforeAdd(xml); if (_shape != null) { int lineSize; str = (string)xml.GetAttribute("lineSize"); if (str != null) { lineSize = int.Parse(str); } else { lineSize = 1; } uint lineColor; str = (string)xml.GetAttribute("lineColor"); if (str != null) { lineColor = UtilsStr.ConvertFromHtmlColor(str, true); } else { lineColor = 0xFF000000; } uint fillColor; str = (string)xml.GetAttribute("fillColor"); if (str != null) { fillColor = UtilsStr.ConvertFromHtmlColor(str, true); } else { fillColor = 0xFFFFFFFF; } string corner; str = (string)xml.GetAttribute("corner"); if (str != null) { corner = str; } _shape.DrawRect(this.width, this.height, lineSize, lineColor, fillColor); } }