public void play(string animSet, bool loop, float animSpeed, bool forcePlay = false) { // 如果动作名相同,并且不是强制重新播放,则不播放动作 if (mCloth.getTextureSet() == animSet && mCloth.getPlayState() == PLAY_STATE.PS_PLAY && !forcePlay) { return; } mCloth.setTextureSet(animSet); mWeapon.setTextureSet(animSet); mCloth.stop(true, false); mCloth.play(); setLoop(loop); setPlaySpeed(animSpeed); mCloth.addPlayingCallback(onAnimationPlaying); // 当方向大于4时,需要将武器深度设置到角色下面 int direction = getLastNumber(animSet); if (direction <= 4 && direction > 0) { mCloth.setDepth(1); mWeapon.setDepth(2); } else { mCloth.setDepth(2); mWeapon.setDepth(1); } }