void LuaArmatureWrapper::addArmatureFileInfoAsyncCallback(float percent) { if (0 != m_lHandler) { CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); CCLuaStack* pStack = pEngine->getLuaStack(); pStack->pushFloat(percent); pStack->executeFunctionByHandler(m_lHandler, 1); pStack->clean(); } }
void CWidgetLayout::executeTouchCancelledAfterLongClickHandler(CCObject* pSender, CCTouch *pTouch, float fDuration) { if( m_pTouchCancelledAfterLongClickListener && m_pTouchCancelledAfterLongClickHandler ) { (m_pTouchCancelledAfterLongClickListener->*m_pTouchCancelledAfterLongClickHandler)(pSender, pTouch, fDuration); } #if USING_LUA else if( m_pTouchCancelledAfterLongClickScriptHandler != 0 ) { CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); CCLuaStack* pStack = pEngine->getLuaStack(); pStack->pushCCObject(pSender, "CCObject"); pStack->pushCCObject(pTouch, "CCTouch"); pStack->pushFloat(fDuration); int nRet = pStack->executeFunctionByHandler(m_pTouchCancelledAfterLongClickScriptHandler, 3); pStack->clean(); } #endif }
void CWidget::executeTouchCancelledHandler(CCTouch* pTouch, float fDuration) { if( m_pTouchCancelledListener && m_pTouchCancelledHandler ) { if( !(m_pTouchCancelledListener->*m_pTouchCancelledHandler)(m_pThisObject, pTouch, fDuration) ) { return; } } #if USING_LUA else if( m_nTouchCancelledScriptHandler != 0 ) { CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); CCLuaStack* pStack = pEngine->getLuaStack(); pStack->pushCCObject(m_pThisObject, "CCObject"); pStack->pushCCObject(pTouch, "CCTouch"); pStack->pushFloat(fDuration); CCArray* pRetArray = new CCArray(); pRetArray->initWithCapacity(1); int nRet = pStack->executeFunctionReturnArray(m_nTouchCancelledScriptHandler, 3, 1, pRetArray); CCAssert(pRetArray->count() > 0, "return count = 0"); CCBool* pBool = (CCBool*) pRetArray->objectAtIndex(0); bool bContinue = pBool->getValue(); delete pRetArray; pStack->clean(); if(!bContinue) { return; } } #endif this->onTouchCancelled(pTouch, fDuration); return; }