static IEnumerator DealTicketResult(long num, float showTime = 3f) { ticketResultObj.SetActive(true); Transform tfm = ticketResultObj.transform.Find("ImageBG/Image_TicketFrame/Text_Ticket"); tfm.GetComponent <Text>().text = "x" + num.ToString(); tfm = ticketResultObj.transform.Find("ImageBG/Text/Anime_Ticket_1"); tfm.gameObject.SetActive(true); Transform tfm1 = ticketResultObj.transform.Find("ImageBG/Text/Anime_Ticket_2"); tfm1.gameObject.SetActive(false); DragonBones.Animation anim = tfm.GetComponent <DragonBones.UnityArmatureComponent>().animation; anim.Play(); yield return(new WaitUntil(() => anim.isCompleted)); tfm.gameObject.SetActive(false); tfm1.gameObject.SetActive(true); anim = tfm1.GetComponent <DragonBones.UnityArmatureComponent>().animation; anim.Play(); yield return(new WaitForSecondsRealtime(showTime)); ticketResultObj.SetActive(false); }
private IEnumerator Animate(KeyFrame frame) { float elapsed = 0; GameObject go = gos[frame.name]; RectTransform rectTransform = dialogs[frame.name].GetComponent <RectTransform>(); if (IS_3D_MODE) { // 改变动画状态机的状态 Animator animator = go.GetComponent <Animator>(); animator.SetTrigger(frame.name); } else { // 播放 DrangonBones 动画 UnityArmatureComponent armatureComp = go.GetComponent <UnityArmatureComponent>(); DragonBones.Animation animation = armatureComp.animation; Dictionary <string, AnimationData> animations = animation.animations; float length = animations[frame.content].duration; if (frame.loop > 0) { animation.timeScale = length / (frame.duration / frame.loop); } else { animation.timeScale = 1; } animation.Play(frame.content, frame.loop); } // 插值改变物体 transform UnityEngine.Transform transform = go.transform; transform.SetPositionAndRotation(frame.StartPosition, frame.StartRotation); transform.localScale = frame.StartScale; while (elapsed < frame.duration) { transform.SetPositionAndRotation( LerpUtility.Linear(frame.StartPosition, frame.EndPosition, elapsed / frame.duration), LerpUtility.Linear(frame.StartRotation, frame.EndRotation, elapsed / frame.duration) ); transform.localScale = LerpUtility.Linear(frame.StartScale, frame.EndScale, elapsed / frame.duration); if (!IS_3D_MODE) { UpdateDialogPos(transform.position, rectTransform); } elapsed += Time.deltaTime; yield return(new WaitForEndOfFrame()); } }
static int Play(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); DragonBones.Animation obj = (DragonBones.Animation)ToLua.CheckObject(L, 1, typeof(DragonBones.Animation)); string arg0 = ToLua.CheckString(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); DragonBones.AnimationState o = obj.Play(arg0, arg1); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Play(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { DragonBones.Animation obj = (DragonBones.Animation)ToLua.CheckObject <DragonBones.Animation>(L, 1); DragonBones.AnimationState o = obj.Play(); ToLua.PushObject(L, o); return(1); } else if (count == 2) { DragonBones.Animation obj = (DragonBones.Animation)ToLua.CheckObject <DragonBones.Animation>(L, 1); string arg0 = ToLua.CheckString(L, 2); DragonBones.AnimationState o = obj.Play(arg0); ToLua.PushObject(L, o); return(1); } else if (count == 3) { DragonBones.Animation obj = (DragonBones.Animation)ToLua.CheckObject <DragonBones.Animation>(L, 1); string arg0 = ToLua.CheckString(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); DragonBones.AnimationState o = obj.Play(arg0, arg1); ToLua.PushObject(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: DragonBones.Animation.Play")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
// ================================================== private void SwitchState(BossState s) { state = s; //animator.SetInteger("AnimationClip", (int)state); animation.Play(SCR_Sameer.Boss[(int)state]); }
// ================================================== private void SwitchState(PlayerState s) { state = s; animation.Play(SCR_Sameer.Player[(int)state]); }
// ================================================== private void SwitchState(SecurityState s) { state = s; animation.Play(SCR_Sameer.Security[(int)state]); }