看了很久的源码,看到AppBase.lua里面有onEnterBackground和onEnterForeground的方法,
在lua里面也有发送事件,但是真机/模拟器调试的时候依然没有反应,
请教下大大这个是怎么用的
感谢~~~
:904: :904: :904: :904: :904: :904:
最后在这里找到解决方法
自己在AppDelegate的enterbackground /enterforeground 方法里面dispatch通知,然后在lua里面用下面地址的方法接收
看了很久的源码,看到AppBase.lua里面有onEnterBackground和onEnterForeground的方法,
在lua里面也有发送事件,但是真机/模拟器调试的时候依然没有反应,
请教下大大这个是怎么用的
感谢~~~
:904: :904: :904: :904: :904: :904:
最后在这里找到解决方法
自己在AppDelegate的enterbackground /enterforeground 方法里面dispatch通知,然后在lua里面用下面地址的方法接收
我也想知道帮顶顶
128的查看居然都没有人回答…给点提示好么


app里重载onEnterBackground不可以吗
引擎底层的代码里没有发出消息,所以在lua层收不到。需要在真机的appdelegate.cpp里自己加入发出消息的代码。
— Begin quote from ____
引用第4楼阳光七月于2014-11-05 10:48发表的 :
引擎底层的代码里没有发出消息,所以在lua层收不到。需要在真机的appdelegate.cpp里自己加入发出消息的代码。 http://www.cocoachina.com/bbs/job.php?action=topost&tid=237849&pid=1090916
— End quote
能告诉下C++发出和lua接收怎么写吗?我发现addEventCustomListener不能用阿
继续顶顶顶顶顶




还是没有人么,一整天了
在AppDelegate::applicationDidEnterBackground()里加上:
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(“APP_ENTER_BACKGROUND_EVENT”);
在AppDelegate::applicationWillEnterForeground()里加上:
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(“APP_ENTER_FOREGROUND_EVENT”);
谢谢!!!!!