void OnDragEnd() { endpos = Input.mousePosition; float delta = endpos.x - startpos.x; if (delta >= 0) { switch (num) { case 0: spriteAni.resetFrame(24); spriteAni.PlayTo(7); tweens[2].Play(false); tweens[0].Play(true); num++; break; case 1: spriteAni.PlayTo(13); tweens[0].PlayReverse(); tweens[1].Play(true); num++; break; case 2: spriteAni.PlayTo(19); tweens[1].PlayReverse(); num++; break; case 3: spriteAni.PlayTo(25); num++; break; case 4: tweens[2].Play(true); spriteAni.resetFrame(8); spriteAni.PlayTo(35); spriteAni.RebuildSpriteList(); spriteAni.PlayTo(0); num = 0; break; } } else if (delta < 0) { switch (num) { case 0: spriteAni.resetFrame(24); spriteAni.PlayTo(7); tweens[2].Play(false); tweens[0].Play(true); num++; break; case 1: spriteAni.PlayToReverse(0); tweens[0].PlayReverse(); num--; break; case 2: spriteAni.PlayToReverse(5); tweens[1].PlayReverse(); tweens[0].Play(true); num--; break; case 3: spriteAni.PlayToReverse(11); num--; break; case 4: spriteAni.PlayToReverse(17); num--; break; } } }
void OnDragEnd() { endpos = Input.mousePosition; float delta = endpos.x - startpos.x; //向右滑 if (delta > 0) { switch (num) { case 0: //播放第一个text tweens [0].Play(true); tweens [10].Play(false); spriteAni.resetFrame(24); spriteAni.RebuildSpriteList(); spriteAni.PlayTo(7); num++; break; case 1: tweens [0].PlayReverse(); tweens [1].Play(true); spriteAni.PlayTo(13); num++; break; case 2: spriteAni.PlayTo(19); tweens [1].PlayReverse(); tweens [2].Play(true); EventDelegate.Add(tweens [2].onFinished, addcircle); num++; break; case 3: spriteAni.PlayTo(25); tweens [2].Play(false); tweens [3].Play(false); tweens [4].Play(false); tweens [8].Play(true); EventDelegate.Add(tweens [8].onFinished, addTweens9); //case 2 's delete //////////////////////////////////// EventDelegate.Remove(tweens [2].onFinished, addcircle); EventDelegate.Remove(tweens [3].onFinished, addtext); PrepareToBtn = false; tweenBtn [0].Play(false); tweenBtn [1].Play(false); tweenBtn [2].Play(false); tweens [7].Play(false); tweens [5].Play(false); tweens [6].Play(false); ///////////////////////////////// num++; break; case 4: EventDelegate.Remove(tweens [8].onFinished, addTweens9); tweens [9].PlayReverse(); tweens [8].PlayReverse(); spriteAni.resetFrame(8); spriteAni.PlayTo(35); spriteAni.RebuildSpriteList(); spriteAni.PlayTo(0); tweens [10].Play(true); num = 0; break; } } //向左滑 else if (delta < 0) { for (int i = 0; i < tweens.Count; i++) { tweens[i].Play(false); } switch (num) { case 0: tweens[0].Play(true); spriteAni.resetFrame(24); spriteAni.RebuildSpriteList(); spriteAni.PlayTo(7); num++; break; case 1: spriteAni.PlayToReverse(0); num--; break; case 2: spriteAni.PlayToReverse(5); tweens[0].Play(true); num--; break; case 3: EventDelegate.Remove(tweens[2].onFinished, addcircle); EventDelegate.Remove(tweens[3].onFinished, addtext); PrepareToBtn = false; tweenBtn[0].Play(false); tweenBtn[1].Play(false); tweenBtn[2].Play(false); spriteAni.PlayToReverse(11); tweens[1].Play(true); num--; break; case 4: spriteAni.PlayToReverse(17); EventDelegate.Add(tweens[2].onFinished, addcircle); tweens[2].Play(true); num--; break; } } }