Example #1
0
        protected override void OnNodeSet()
        {
            base.OnNodeSet();

            // we must register this document and get an id for it
            DomNode node   = this.DomNode;
            var     tag    = node.Type.GetTag(NativeAnnotations.NativeDocumentType);
            var     typeId = (tag != null) ? (uint)tag : 0;

            m_nativeDocId = GameEngine.CreateDocument(typeId);

            ManageNativeObjectLifeTime = true;
            foreach (var subnode in node.Subtree)
            {
                var childObject = subnode.As <XLEBridgeUtils.INativeObjectAdapter>();
                if (childObject != null)
                {
                    childObject.OnAddToDocument(this);

                    var parentObject = subnode.Parent.As <XLEBridgeUtils.INativeObjectAdapter>();
                    if (parentObject != null)
                    {
                        childObject.OnSetParent(parentObject, -1);
                    }
                }
            }

            node.ChildInserted += node_ChildInserted;
            node.ChildRemoved  += node_ChildRemoved;
        }