Beispiel #1
0
bool CustomInput::onAssignCCBCustomProperty(CCObject* pTarget, const char* pMemberVariableName, const cocos2d::Value& pCCBValue)
{
    CustomInput* target = dynamic_cast<CustomInput*>(pTarget);
    if(pCCBValue.getType() == cocos2d::Value::Type::INTEGER && strcmp(pMemberVariableName, "maxChar") == 0)
    {
        target->setMaxChar(pCCBValue.asInt());
    }
    else if(pCCBValue.getType() == cocos2d::Value::Type::INTEGER && strcmp(pMemberVariableName, "fontSize") == 0)
    {
        target->setFontSize(pCCBValue.asInt());
    }
    else if(pCCBValue.getType() == cocos2d::Value::Type::STRING && strcmp(pMemberVariableName, "placeHolder") == 0)
    {
        target->setPlaceHolder(Screate(pCCBValue.asString()));
    }
    else if(pCCBValue.getType() == cocos2d::Value::Type::STRING && strcmp(pMemberVariableName, "fontName") == 0)
    {
        target->setFontName(Screate(pCCBValue.asString()));
    }
    else if(pCCBValue.getType() == cocos2d::Value::Type::BOOLEAN && strcmp(pMemberVariableName, "numbers") == 0)
    {
        target->setNumbersOnly(pCCBValue.asBool());
    }
    else
    {
        CustomBaseNode::onAssignCCBCustomProperty(pTarget, pMemberVariableName, pCCBValue);
    }
    return false;
}
Beispiel #2
0
void CBird::actionCommand(const cocos2d::Value &value)
{
    switch (value.asInt()) {
        case CMD_MOVE:
        {
            changeState(ST_MOVE, CStateMachine::TR_OVERRIDE);
        }break;
        default:
            break;
    }
}