Exemplo n.º 1
0
bool CSpriteObject::init(CCDictionary* pObjectDict)
{
    do {
        CC_BREAK_IF(!CObjectBase::init(pObjectDict));
        CCString* fileType = getFileTypeFromDict();
        CC_BREAK_IF(NULL == fileType);
        CCString* fileName = getFileNameFromDict();
        CC_BREAK_IF(NULL == fileName);
        
        if (getMaxLevelFromDict() > 0)
        {
            fileName = CCString::createWithFormat("%s%d", fileName->getCString(), getLevel() - 1);
        }
        
        if (fileType->compare("ccbi") == 0)
        {
            fileName = CCString::createWithFormat("%s.ccbi", fileName->getCString());
            CC_BREAK_IF(!setSpriteFromCcbi(fileName->getCString()));
        }
        else
        {
            CC_BREAK_IF(!setSprite(fileName->getCString()));
        }
        
        return true;
    } while (false);
    
    return false;
}
Exemplo n.º 2
0
bool CGameEffect::init(const string& ccbi_name)
{
    do
    {
        BREAK_IF_FAILED(CSpriteObject::init());
        BREAK_IF_FAILED(setSpriteFromCcbi(ccbi_name.c_str()));
        enableAlphaTest(0.5f);
        return true;
    } while (false);
    
	return false;
}