在Cocos2d-X3.1中重新安排相同的方法
我在Cocos2d-x v3.1中有以下代码:在Cocos2d-X3.1中重新安排相同的方法,cocos2d-x,scheduler,cocos2d-x-3.0,Cocos2d X,Scheduler,Cocos2d X 3.0,我在Cocos2d-x v3.1中有以下代码: void Board::createNewRandomBottomRow() { //eventHappening is a variable modified in other parts of the code //I don't want that while eventHappening is true, this method does anything if ( eventHappening ) {
void Board::createNewRandomBottomRow()
{
//eventHappening is a variable modified in other parts of the code
//I don't want that while eventHappening is true, this method does anything
if ( eventHappening ) {
this -> scheduleOnce( SEL_SCHEDULE( &Board::createNewRandomBottomRow ), 0.3f );
}
else
{
//actual logic
}
}
但是,我向调试器检查该方法是否没有被重新调度。难道不能从同一个方法内部重新调度一个方法吗?好吧,我在另一个更简单的场景中也做了同样的事情,重新调度工作正常,所以我想我在代码的另一部分中弄错了逻辑 因此,总结一下:从方法本身内部重新调度一个方法效果很好