Esempio n. 1
0
        public override void RegisterWithTouchDispatcher()
        {
            CCTouchDispatcher pDispatcher = CCDirector.SharedDirector.TouchDispatcher;

            /*
             * if (m_pScriptHandlerEntry)
             * {
             *  if (m_pScriptHandlerEntry->isMultiTouches())
             *  {
             *      pDispatcher->addStandardDelegate(this, 0);
             *      LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler());
             *  }
             *  else
             *  {
             *      pDispatcher->addTargetedDelegate(this,
             *                                                           m_pScriptHandlerEntry->getPriority(),
             *                                                           m_pScriptHandlerEntry->getSwallowsTouches());
             *      LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler());
             *  }
             *  return;
             * }
             */
            if (m_bIsSingleTouchEnabled)
            {
                pDispatcher.AddTargetedDelegate(this, 0, true);
            }
            if (m_bIsMultiTouchEnabled)
            {
                pDispatcher.AddStandardDelegate(this, 0);
            }
        }
Esempio n. 2
0
        public virtual void RegisterWithTouchDispatcher()
        {
            CCTouchDispatcher pDispatcher = CCDirector.SharedDirector.TouchDispatcher;

            /*
             * if (m_pScriptHandlerEntry)
             * {
             *  if (m_pScriptHandlerEntry->isMultiTouches())
             *  {
             *      pDispatcher->addStandardDelegate(this, 0);
             *      LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler());
             *  }
             *  else
             *  {
             *      pDispatcher->addTargetedDelegate(this,
             *                                                           m_pScriptHandlerEntry->getPriority(),
             *                                                           m_pScriptHandlerEntry->getSwallowsTouches());
             *      LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler());
             *  }
             *  return;
             * }
             */
            if (m_eTouchMode == CCTouchMode.AllAtOnce)
            {
                pDispatcher.AddStandardDelegate(this, 0);
            }
            else
            {
                pDispatcher.AddTargetedDelegate(this, m_nTouchPriority, true);
            }
        }