FairyGUI.Relations.Setup C# (CSharp) Method

Setup() public method

public Setup ( XML xml ) : void
xml FairyGUI.Utils.XML
return void
        public void Setup(XML xml)
        {
            XMLList.Enumerator et = xml.GetEnumerator("relation");

            string targetId;
            GObject target;
            while (et.MoveNext())
            {
                XML cxml = et.Current;
                targetId = cxml.GetAttribute("target");
                if (_owner.parent != null)
                {
                    if (targetId != null && targetId != "")
                        target = _owner.parent.GetChildById(targetId);
                    else
                        target = _owner.parent;
                }
                else
                {
                    //call from component construction
                    target = ((GComponent)_owner).GetChildById(targetId);
                }
                if (target != null)
                    AddItems(target, cxml.GetAttribute("sidePair"));
            }
        }

Usage Example

 static public int Setup(IntPtr l)
 {
     try {
         FairyGUI.Relations self = (FairyGUI.Relations)checkSelf(l);
         FairyGUI.Utils.XML a1;
         checkType(l, 2, out a1);
         self.Setup(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
All Usage Examples Of FairyGUI.Relations::Setup