加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Scheduler

发布时间:2020-12-14 17:14:28 所属栏目:百科 来源:网络整理
导读:说明 引擎版本:cocos2d-x 3.4 编译器:visual studio 2013 UI编辑器:Cocos Studio v1.6.0.0 Scheduler(继承于Ref; cocos/base模块下) 调度器的相关操作在Node中也有定义,常用的几个操作如下: schedule /* 自定义定时器 */ //调用成员函数 void schedul

说明

引擎版本: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();

    (编辑:李大同)

    【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

      推荐文章
        热点阅读