Scheduler

前端之家收集整理的这篇文章主要介绍了Scheduler前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

说明

引擎版本:cocos2d-x 3.4 编译器:visual studio 2013 UI编辑器:Cocos Studio v1.6.0.0

Scheduler(继承于Ref; cocos/base模块下)

调度器的相关操作在Node中也有定义,常用的几个操作如下:
schedule
    
    
/*自定义定时器*///调用成员函数void schedule(SEL_SCHEDULE selector); , float interval);unsigned int repeat delay);//调用lambda函数的定时器多一个string& key 参数

scheduleOnce(一次性定时器)
//调用lambda函数,最后一个参数为key,可以根据该key,停止调用函数scheduleOnce([](float dt){ CCLOG("hi" },1 "aa"//调用类的成员函数schedule_selector(Test2::callback),76)"> );

scheduleUpdate
//调用默认的update类成员方法 scheduleUpdate(void//默认调用的update方法 update(float 其他操作:
  • * Unschedules the "update" method. * @see scheduleUpdate(); */ unscheduleUpdate /** * Unschedules a custom selector. * @see `schedule(SEL_SCHEDULE,float,unsigned int,float)` * * @param selector A function wrapped as a selector * @lua NA unschedule * Unschedules a lambda function * @param key The key of the lambda function to be unscheduledconst stdstring &key * Unschedule all scheduled selectors and lambda functions: custom selectors,and the 'update' selector and lambda functions * Actions are not affected by this method. unscheduleAllCallbacks();
    原文链接:https://www.f2er.com/cocos2dx/339082.html

    猜你在找的Cocos2d-x相关文章