[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter

FileUtils

[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter
//文件管理工具
FileUtils::getInstance()
std::string getStringFromFile(const std::string& filename);//读取文件中的字符串
Data getDataFromFile(const std::string& filename);//获取文件数据
void setSearchPaths(const std::vector<std::string>& searchPaths);//设置搜索路径
void addSearchPath(const std::string & path);//增加搜索路径
bool isFileExist(const std::string& filePath);//判断文件是否存在
[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter

 

NotificationCenter

 

[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter
//发送事件
CCNotificationCenter::sharedNotificationCenter()->postNotification(CLICK_TEST_MSG, (CCObject*)data);

//监听事件
void GameManager::initListener()
{
    CCNotificationCenter::sharedNotificationCenter()->addObserver(this, callfuncO_selector(GameManager::onClickTest), CLICK_TEST_MSG, NULL);
}

//处理事件
void GameManager::onClickTest(CCObject* obj)
{
    CCMessageBox("onClickTest", "Title");

    //移除监听事件
    CCNotificationCenter::sharedNotificationCenter()->removeObserver(this, CLICK_TEST_MSG);
}
[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter

 

[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter
typedef void (CCObject::*SEL_SCHEDULE)(float);// 用来调update  
typedef void (CCObject::*SEL_CallFunc)();// 用来自定义无参回调  
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);// 带执行者回调  
typedef void (CCObject::*SEL_CallFuncND)(CCNode*, void*); // 带一个自定参数的回调  
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);  
typedef void (CCObject::*SEL_MenuHandler)(CCObject*);  
typedef void (CCObject::*SEL_EventHandler)(CCEvent*);  
typedef int (CCObject::*SEL_Compare)(CCObject*); 
[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter

 

 

 

 

[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter,布布扣,bubuko.com

[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter

上一篇:C#各种同步方法 lock, Monitor,Mutex, Semaphore, Interlocked, ReaderWriterLock,AutoResetEvent, ManualResetEvent


下一篇:Android Compatibility package 兼容性开发套件