コード例 #1
0
static void editBoxCallbackFunc(const char* pText, void* ctx)
{
    CCEditBoxImplAndroid* thiz = (CCEditBoxImplAndroid*)ctx;
    thiz->setText(pText);

    if (thiz->getDelegate() != NULL)
    {
        thiz->getDelegate()->editBoxTextChanged(thiz->getCCEditBox(), thiz->getText());
        thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox());
        thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox());
    }
}
コード例 #2
0
static void editBoxCallbackFunc(const char* pText, void* ctx)
{
    CCEditBoxImplAndroid* thiz = (CCEditBoxImplAndroid*)ctx;
    thiz->setText(pText);
	
    if (thiz->getDelegate() != NULL)
    {
        thiz->getDelegate()->editBoxTextChanged(thiz->getCCEditBox(), thiz->getText());
        thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox());
        thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox());
    }
    
    CCEditBox* pEditBox = thiz->getCCEditBox();
    if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
    {
        cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();

        cocos2d::extension::KeyboardReturnType returnType = pEditBox->getReturnType();
        int handler = pEditBox->getScriptEditBoxHandler();
        pEngine->executeEvent(handler, "changed",pEditBox);

        if (returnType == cocos2d::extension::kKeyboardReturnTypeDone)
        {
            pEngine->executeEvent(handler, "returnDone", pEditBox);
    }
        else if (returnType == cocos2d::extension::kKeyboardReturnTypeSend)
        {
            pEngine->executeEvent(handler, "returnSend", pEditBox);
}
        else if (returnType == cocos2d::extension::kKeyboardReturnTypeSearch)
        {
            pEngine->executeEvent(handler, "returnSearch", pEditBox);
        }
        else if (returnType == cocos2d::extension::kKeyboardReturnTypeGo)
        {
            pEngine->executeEvent(handler, "returnGo", pEditBox);
        }
        else
        {
            pEngine->executeEvent(handler, "return", pEditBox);
        }
        pEngine->executeEvent(handler, "ended",pEditBox);
    }
}
コード例 #3
0
static void editBoxCallbackFunc(const char* pText, void* ctx)
{
    CCEditBoxImplAndroid* thiz = (CCEditBoxImplAndroid*)ctx;
    thiz->setText(pText);

    if (thiz->getDelegate() != NULL)
    {
        thiz->getDelegate()->editBoxTextChanged(thiz->getCCEditBox(), thiz->getText());
        thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox());
        thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox());
    }

    int handler = thiz->getScriptEditBoxHandler();
    if (handler)
    {
        cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
        pEngine->executeEvent(handler, "changed");
        pEngine->executeEvent(handler, "ended");
        pEngine->executeEvent(handler, "return");
    }
}