Пример #1
0
        /// <summary>
        /// Bind a GameObject to a C++ ObjectScriptable through its node name.
        /// </summary>
        /// <param name="nodeName">Name of the Node to bind.</param>
        public void bind(String nodeName)
        {
            if (nodeName == null)
            {
                throw new CKLBException("Impossible to bind with a null name.");
            }
            if (m_cppObject != IntPtr.Zero)
            {
                throw new CKLBException("This GameObject is already binded.");
            }

            NodeIterator nodeIterator = new NodeIterator(NativeManagement.getContextCounter(), NodeIterator.getRoot());

            if (nodeIterator.find(nodeName))
            {
                IntPtr cppObj       = nodeIterator.getAsUITask().CppObject;
                uint   nativeHandle = CKLBObjectScriptable_getScriptContext(cppObj);

                if (nativeHandle == NULLHANDLER)
                {
                    NativeManagement.registerWrapper(cppObj, m_handle);
                    m_cppObject = cppObj;
                    doSetupCallbacks();
                }
                else
                {
                    throw new CKLBException("This C++ object is already wrapped.");
                }
            }
            else
            {
                throw new CKLBException("There is not any Node with this name.");
            }
        }
Пример #2
0
 /// <summary>
 /// Get a node iterator already positionned on a node named "name".
 /// </summary>
 /// <param name="name">iterator default position, if name is null or not found, ?</param>
 /// <param name="nodeIterator">returned iterator</param>
 /// <returns>? not void</returns>
 public NodeIterator getIteratorFromName(String name, out NodeIterator nodeIterator)
 {
     nodeIterator = getIterator(out nodeIterator);
     if (!nodeIterator.find(name))
     {
         nodeIterator = null;
     }
     return(nodeIterator);
 }
Пример #3
0
 /// <summary>
 /// Get a node iterator already positionned on a node named "name".
 /// </summary>
 /// <param name="name">iterator default position, if name is null or not found, ?</param>
 /// <param name="nodeIterator">returned iterator</param>
 /// <returns>? not void</returns>
 public NodeIterator getIteratorFromName(String name, out NodeIterator nodeIterator)
 {
     nodeIterator = getIterator(out nodeIterator);
     if(!nodeIterator.find(name)) {
         nodeIterator = null;
     }
     return nodeIterator;
 }
Пример #4
0
        /// <summary>
        /// Bind a GameObject to a C++ ObjectScriptable through its node name.
        /// </summary>
        /// <param name="nodeName">Name of the Node to bind.</param>
        public void bind(String nodeName)
        {
            if(nodeName == null)            { throw new CKLBException("Impossible to bind with a null name.");  }
            if(m_cppObject != IntPtr.Zero)  { throw new CKLBException("This GameObject is already binded.");    }

            NodeIterator nodeIterator = new NodeIterator(NativeManagement.getContextCounter(), NodeIterator.getRoot());
            if(nodeIterator.find(nodeName)) {
                IntPtr cppObj       = nodeIterator.getAsUITask().CppObject;
                uint nativeHandle   = CKLBObjectScriptable_getScriptContext(cppObj);

                if(nativeHandle == NULLHANDLER) {
                    NativeManagement.registerWrapper(cppObj, m_handle);
                    m_cppObject = cppObj;
                    doSetupCallbacks();
                } else {
					throw new CKLBException("This C++ object is already wrapped.");
				}
            } else {
                throw new CKLBException("There is not any Node with this name.");
            }
        }