cocos2d-android-1动作结束监听 20
privatevoidcardMoveTo(intfromRow,inttoRow,intfromCol,inttoCol){//获得坐标CGPointtoPositio...
private void cardMoveTo(int fromRow,int toRow, int fromCol,int toCol){
//获得坐标
CGPoint toPosition = CGPoint.ccp(MainActivity.cardWidth* (toCol - fromCol) + (toCol - fromCol) * 6,MainActivity.cardWidth * (toRow - fromRow) + (toRow - fromRow)* 6);
//添加动画 并 通过应用反射机制添加动画结束监听
CCCallFuncND isOver = CCCallFuncND.action(this,"moveToIsOver",toRow*4+toCol);
CCSequence moveTo= CCSequence.actions(CCMoveTo.action(0.05f*(Math.abs(fromRow-toRow)+Math.abs(fromCol-toCol)), toPosition),isOver);
cards[fromRow][fromCol].runAction(moveTo);
// cards[toRow][toCol] = cards[fromRow][fromCol];
// cards[fromRow][fromCol] = null;
// if (cards[toRow][toCol] != null) {
// cards[toRow][toCol].setNum(cards[toRow][toCol].getNum() * 2);
// }
// for (int i = 0; i < vacancy.size(); i++) {
// if (vacancy.get(i) == (toRow * 4 + toCol)) {
// vacancy.remove(i);
// break;
// }
// }
// vacancy.add(fromRow*4+fromCol);
}
public void moveToIsOver() {
// TODO Auto-generated method stub
System.out.println();
}
}现在moveToIsOver()方法中执行注释掉的部分,可是参数怎么传过来呢,求大神解答啊,可愁死我了。 展开
//获得坐标
CGPoint toPosition = CGPoint.ccp(MainActivity.cardWidth* (toCol - fromCol) + (toCol - fromCol) * 6,MainActivity.cardWidth * (toRow - fromRow) + (toRow - fromRow)* 6);
//添加动画 并 通过应用反射机制添加动画结束监听
CCCallFuncND isOver = CCCallFuncND.action(this,"moveToIsOver",toRow*4+toCol);
CCSequence moveTo= CCSequence.actions(CCMoveTo.action(0.05f*(Math.abs(fromRow-toRow)+Math.abs(fromCol-toCol)), toPosition),isOver);
cards[fromRow][fromCol].runAction(moveTo);
// cards[toRow][toCol] = cards[fromRow][fromCol];
// cards[fromRow][fromCol] = null;
// if (cards[toRow][toCol] != null) {
// cards[toRow][toCol].setNum(cards[toRow][toCol].getNum() * 2);
// }
// for (int i = 0; i < vacancy.size(); i++) {
// if (vacancy.get(i) == (toRow * 4 + toCol)) {
// vacancy.remove(i);
// break;
// }
// }
// vacancy.add(fromRow*4+fromCol);
}
public void moveToIsOver() {
// TODO Auto-generated method stub
System.out.println();
}
}现在moveToIsOver()方法中执行注释掉的部分,可是参数怎么传过来呢,求大神解答啊,可愁死我了。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询