コード例 #1
0
void UIActionManager::initWithDictionary(cs::CSJsonDictionary *dic,UIWidget* root)
{
    int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist");
    for (int i=0; i<actionCount; i++) {
        UIAction* action = new UIAction();
        cs::CSJsonDictionary* actionDic = DICTOOL->getDictionaryFromArray_json(dic, "actionlist", i);
        action->initWithDictionary(actionDic,root);
        this->m_ActionList->addObject(action);
    }
}
コード例 #2
0
void UIActionManager::initWithDictionary(const char* jsonName,cs::CSJsonDictionary *dic,UIWidget* root)
{
    std::string path = jsonName;
    int pos = path.find_last_of("/");
    std::string fileName = path.substr(pos+1,path.length());
    CCLOG("filename == %s",fileName.c_str());
    CCArray* actionList = CCArray::create();
    int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist");
    for (int i=0; i<actionCount; i++)
    {
        UIAction* action = new UIAction();
        action->autorelease();
        cs::CSJsonDictionary* actionDic = DICTOOL->getDictionaryFromArray_json(dic, "actionlist", i);
        action->initWithDictionary(actionDic,root);
        actionList->addObject(action);
		CC_SAFE_DELETE(actionDic);
    }
    m_pActionDic->setObject(actionList, fileName);
}