FairyGUI.GObject.Setup_AfterAdd C# (CSharp) 메소드

Setup_AfterAdd() 공개 메소드

public Setup_AfterAdd ( XML xml ) : void
xml FairyGUI.Utils.XML
리턴 void
        public virtual void Setup_AfterAdd(XML xml)
        {
            string str;

            str = xml.GetAttribute("group");
            if (str != null)
                group = parent.GetChildById(str) as GGroup;

            XMLList.Enumerator et = xml.GetEnumerator();
            XML cxml;
            int index;
            while (et.MoveNext())
            {
                cxml = et.Current;
                if (GearXMLKeys.TryGetValue(cxml.name, out index))
                    GetGear(index).Setup(cxml);
            }
        }

Usage Example

예제 #1
0
        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);

            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();
                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;
            }

            str = xml.GetAttribute("mask");
            if (str != null)
            {
                this.mask = GetChildById(str).displayObject;
            }

            XMLList transCol = xml.Elements("transition");

            foreach (XML cxml in transCol)
            {
                Transition trans = new Transition(this);
                trans.Setup(cxml);
                _transitions.Add(trans);
            }

            if (_transitions.Count > 0)
            {
                this.onAddedToStage.Add(__addedToStage);
                this.onRemovedFromStage.Add(__removedFromStage);
            }

            ApplyAllControllers();

            _buildingDisplayList = false;
            underConstruct       = false;

            BuildNativeDisplayList();
        }
All Usage Examples Of FairyGUI.GObject::Setup_AfterAdd