1.我们准备了一个json文件(test.json),在resource下面:
{
"data": {
"lastArea": {
"areaId": 200,
"label": 1,
"name": "我是区服",
"state": 1
},
"topArea": {
"areaId": 10,
"label": 0,
"name": "我是区服",
"state": 1
},
"total": 2
},
"rc": 0
}
2.我们在onEnter函数中加入如下代码
const char *des = NULL;
std::string jsonpath;
cs::CSJsonDictionary *jsonDict = NULL;
jsonpath = CCFileUtils::sharedFileUtils()->fullPathForFilename("test.json");
unsigned long size = 0;
des = (char*)(CCFileUtils::sharedFileUtils()->getFileData(jsonpath.c_str(),"r" , &size));
if(NULL =&