我想在Cocos2d屏幕上禁用触摸。我想触控禁用4-5 second.any one帮助我。谢谢
发布于 2012-03-03 06:32:51
您还可以设置自定义计时器:
static Integer time = 100;在你需要的时候倒数:
time--;
...
if (time <= 0) {
setTouchEnabled = false;
//you can also reset time here: time = 100;
} else {
setTouchEnabled = true;
}发布于 2012-01-12 05:19:03
使用布尔值打开/关闭触摸代码。
if (touchEnabled)
{
// do touch code
}
else
{
// not …
}在其他地方,暂时禁用触摸:
// accept no touches from now on
touchEnabled = false;我将重新启用触摸屏的任务留给您。
发布于 2012-08-03 13:47:02
定义一个时间变量
static float time;当你想要禁用触摸屏时,写下下面的代码
this.schedule("touchdiablefor5sec",1f);现在编写下面的方法
public void touchdiablefor5sec(float dt) {
//first disable screen touch
this.setIsTouchEnabled(false);
time= time+1;
// if 5 second done then enable touch
if(time==5)
{
this.setIsTouchEnabled(true);
//unschedule the touchdiablefor5sec scheduler
this.unschedule("touchdiablefor5sec");
}
}https://stackoverflow.com/questions/8786682
复制相似问题