按钮长按
2019獨角獸企業重金招聘Python工程師標準>>>
用update來實現定時
//長按處理update: function (delta) {cc.log("update + "+delta);this.totalTime+=delta;if(this.totalTime>=TOUCH_LONG_TIMER_INVOKE){this.stopTimer();this.invokeTouchLong();}},stopTimer: function () {this.unscheduleUpdate ();this.totalTime=0;},startTimer: function () {this.isTouchLong=false;this.scheduleUpdate ();},invokeTouchLong: function () {cc.log("長按")this.isTouchLong=true;},ctor: function (id) {this._super();btn.addTouchEventListener (function (a1,type) {if(type ==0){//按下self.startTimer ();}if(type==1){ /移動move=true; self.stopTimer ();}if(type==2){ // 結束self.stopTimer ();if(!move && ! self.isTouchLong){cc.log("click ");}move=false;}})?
轉載于:https://my.oschina.net/kkkkkkkkkkkkk/blog/716782
總結
- 上一篇: android 双向滑动 seekbar
- 下一篇: ggplot2 theme相关设置—文