Example #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.");
            }
        }
Example #2
0
        /// <summary>
        /// Get a node iterator, allowing to navigate through the scenegraph and manipulate nodes inside a task.
        /// Return the node passed as parameter.
        /// </summary>
        /// <param name="nodeIterator">Return a </param>
        /// <returns></returns>
        public NodeIterator getIterator(out NodeIterator nodeIterator)
        {
            uint   counter = NativeManagement.getContextCounter();
            IntPtr node    = NodeIterator.getNodeFromTask(this);

            nodeIterator = new NodeIterator(counter, node);
            return(nodeIterator);
        }
Example #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);
 }
Example #4
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;
 }
Example #5
0
        /// <summary>
        /// Get a node iterator, allowing to navigate through the scenegraph and manipulate nodes inside a task.
		/// Return the node passed as parameter.
        /// </summary>
        /// <param name="nodeIterator">Return a </param>
        /// <returns></returns>
        public NodeIterator getIterator(out NodeIterator nodeIterator)
        {
            uint counter    = NativeManagement.getContextCounter();
            IntPtr node     = NodeIterator.getNodeFromTask(this);

            nodeIterator = new NodeIterator(counter, node);
            return nodeIterator;
        }
Example #6
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.");
            }
        }