コード例 #1
0
        public void OnDocumentRemoved()
        {
            // We need to call OnRemoveFromDocument on all children
            // NativeObjectAdapter.OnRemoveFromDocument is now non-hierarchical.
            // It will only have an effect on that particular object, not it's children.
            // As a result, we must iterate through the entire subtree
            DomNode node = this.DomNode;

            if (node != null)
            {
                foreach (var subnode in node.Subtree)
                {
                    var childObject = subnode.AsAll <XLEBridgeUtils.INativeObjectAdapter>();
                    foreach (var c in childObject)
                    {
                        c.OnRemoveFromDocument(this);
                    }
                }
            }

            // destroy the document on the native side, as well
            var tag    = node.Type.GetTag(NativeAnnotations.NativeDocumentType);
            var typeId = (tag != null) ? (uint)tag : 0;

            GameEngine.DeleteDocument(m_nativeDocId, typeId);
        }
コード例 #2
0
        public void OnDocumentRemoved()
        {
            // we need to call OnRemoveFromDocument on all children
            // NativeObjectAdapter.OnRemoveFromDocument is hierarchical,
            // so we only need to call on the top level children
            DomNode node = this.DomNode;

            if (node != null)
            {
                foreach (var subnode in node.Children)
                {
                    NativeObjectAdapter childObject = subnode.As <NativeObjectAdapter>();
                    if (childObject != null)
                    {
                        childObject.OnRemoveFromDocument(this);
                    }
                }
            }

            // destroy the document on the native side, as well
            var tag    = node.Type.GetTag(NativeAnnotations.NativeDocumentType);
            var typeId = (tag != null) ? (uint)tag : 0;

            GameEngine.DeleteDocument(m_nativeDocId, typeId);
        }