public virtual void OnUpdate(GTAnimator animator) { if (animator == null) { return; } if (OnUpdateDelegate != null) { OnUpdateDelegate(this); } if (ActiveActions != null && ActiveActions.Count > 0) { for (int i = 0; i < ActiveActions.Count; i++) { ClipAction action = ActiveActions[i]; if (action == null) { ActiveActions.RemoveAt(i); i--; continue; } if (action.EndTime <= animator.CurrentTime) { action.OnEnd(this); ActiveActions.Remove(action); i--; } else if (action.m_Status == ClipAction.Status.Error || action.m_Status == ClipAction.Status.StopOnNextFrame) { action.OnEnd(this); ActiveActions.Remove(action); i--; } else { action.OnUpdate(this); } } } if (WaittingProcessActions != null && WaittingProcessActions.Count > 0) { for (int i = 0; i < WaittingProcessActions.Count; i++) { ClipAction action = WaittingProcessActions[i]; if (action == null) { WaittingProcessActions.RemoveAt(i); i--; continue; } if (action.BeginTime <= animator.CurrentTime && action.m_Status == ClipAction.Status.UnAction) { action.OnBegin(this); ActiveActions.Add(action); WaittingProcessActions.Remove(action); i--; } } } }
public void OnAnimatorUpdate(GTAnimator animator) { if (Callback != null) { Callback(MsgType.OnAnimatorUpdate, animator); } }
public void OnAnimatorUpdatePercentage(GTAnimator animator, float currentPercentage, float currentPlayTime) { if (Callback != null) { Callback(MsgType.OnAnimatorUpdatePercentage, animator, currentPercentage, currentPlayTime); } }
public void OnAnimatorUnPause(GTAnimator animator, float currentTime, float pauseTime) { if (Callback != null) { Callback(MsgType.OnAnimatorUnPause, animator, currentTime, pauseTime); } }
public void OnAnimatorPreBegin(GTAnimator animator, PlayTask task) { if (Callback != null) { Callback(MsgType.OnAnimatorPreBegin, animator); } }
public void OnAnimatorStop(GTAnimator animator) { if (Callback != null) { Callback(MsgType.OnAnimatorStop, animator); } }
public virtual void OnBegin(GTAnimator animator) { GetAllAction(); WaittingProcessActions = new List <ClipAction>(Actions); switch (ActiveObjOperation) { case GameObjectActiveOperation.AlwaysChangeStatus: if (AnimateObj.activeSelf == false) { AnimateObj.SetActive(true); } break; case GameObjectActiveOperation.OnlyActiveOnBegin: if (AnimateObj.activeSelf == false) { AnimateObj.SetActive(true); } break; case GameObjectActiveOperation.DontOperate: break; default: break; } if (OnBeginDelegate != null) { OnBeginDelegate(this); } }
public void OnAnimatorBegin(GTAnimator animator) { if (Callback != null) { Callback(MsgType.OnAnimatorBegin, animator); } }
private void OnDestroy() { Playlist = null; ListenEnd = null; LastAnimator = null; CurrentAnimator = null; }
public void OnAnimatorCannotPlay(GTAnimator animator) { if (Callback != null) { Callback(MsgType.OnAnimatorCannotPlay, animator); } ClearListen(animator); }
public void OnAnimatorEnd(GTAnimator animator) { if (Callback != null) { Callback(MsgType.OnAnimatorEnd, animator); } ClearListen(animator); }
public static GTAnimator Get(string name) { if (string.IsNullOrEmpty(name)) { return(null); } if (AllAnimator == null || AllAnimator.Count == 0) { return(null); } GTAnimator animator = null; AllAnimator.TryGetValue(name, out animator); return(animator); }
/// <summary> /// add listen when attach to an animator /// </summary> /// <param name="animator"></param> private void AddListen(GTAnimator animator) { if (animator != null) { animator.CannotPlayDelegate += OnAnimatorCannotPlay; animator.PreBeginDelegate += OnAnimatorPreBegin; animator.BeginDelegate += OnAnimatorBegin; animator.UpdateDelegate += OnAnimatorUpdate; animator.UpdatePercentageDelegate += OnAnimatorUpdatePercentage; animator.EndDelegate += OnAnimatorEnd; animator.PauseDelegate += OnAnimatorPause; animator.UnPauseDelegate += OnAnimatorUnPause; animator.StopDelegate += OnAnimatorStop; } }
public virtual void OnAnimatorInited(GTAnimator animator) { GetAllAction(); if (Actions != null && Actions.Count > 0) { for (int i = 0; i < Actions.Count; i++) { ClipAction action = Actions[i]; if (action == null) { continue; } action.OnClipInited(this); } } }
public static void Add(string name, GTAnimator animator) { if (animator == null) { return; } GTAnimator o = null; if (AllAnimator.TryGetValue(name, out o)) { return; } else { AllAnimator.Add(name, animator); } }
public virtual void OnEnd(GTAnimator animator) { if (ActiveActions != null || ActiveActions.Count > 0) { for (int i = 0; i < ActiveActions.Count; i++) { ClipAction action = ActiveActions[i]; if (action == null) { continue; } action.OnEnd(this); } } if (AnimateObj != null) { switch (ActiveObjOperation) { case GameObjectActiveOperation.AlwaysChangeStatus: if (AnimateObj.activeSelf == true) { AnimateObj.SetActive(false); } break; case GameObjectActiveOperation.OnlyActiveOnBegin: break; case GameObjectActiveOperation.DontOperate: break; default: break; } } if (OnEndDelegate != null) { OnEndDelegate(this); } m_Status = Status.UnAction; }
private void OnOneAnimatorUpdate(GTAnimator animator) { if (animator == null) { return; } if (Adapter != null) { MethodInfo info = Adapter.GetType().GetMethod("OnAnimatorUpdate"); if (info != null) { Adapter.GetType().InvokeMember("OnAnimatorUpdate", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, Adapter, new object[] { animator }); } else { //Utility.LogError("FixedPlaylist: can not callback your adapter caused by null method named 'OnAnimatorUpdate(void)'"); } } Description des = GetDescription(animator); if (des == null || des.Animator == null) { return; } if (des.Adapter != null) { MethodInfo info = des.Adapter.GetType().GetMethod("OnAnimatorUpdate"); if (info != null) { des.Adapter.GetType().InvokeMember("OnAnimatorUpdate", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, des.Adapter, new object[] { animator }); } else { Utility.LogError("FixedPlaylist: can not callback your adapter caused by null method named 'OnAnimatorUpdate(void)'"); } } }
public Description GetDescription(GTAnimator animator) { if (animator == null) { return(null); } if (Playlist == null || Playlist.Count == 0) { return(null); } for (int i = 0; i < Playlist.Count; i++) { Description des = Playlist[i]; if (des == null) { continue; } if (des.Animator == animator) { return(des); } } return(null); }
private void OnOneAnimatorEnd(GTAnimator animator) { if (animator != null) { animator.PreBeginDelegate -= OnOneAnimatorPreStart; animator.BeginDelegate -= OnOneAnimatorStart; animator.UpdateDelegate -= OnOneAnimatorUpdate; animator.EndDelegate -= OnOneAnimatorEnd; } if (Adapter != null) { MethodInfo info = Adapter.GetType().GetMethod("OnAnimatorEnd"); if (info != null) { Adapter.GetType().InvokeMember("OnAnimatorEnd", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, Adapter, new object[] { animator }); } else { Utility.LogError("FixedPlaylist: can not callback your adapter caused by null method named 'OnAnimatorEnd(void)'"); } } Description des = GetDescription(animator); if (des == null) { return; } ActiveAnimators.Remove(des); if (des.Adapter != null) { MethodInfo info = des.Adapter.GetType().GetMethod("OnAnimatorEnd"); if (info != null) { des.Adapter.GetType().InvokeMember("OnAnimatorEnd", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, des.Adapter, new object[] { animator }); } else { Utility.LogError("FixedPlaylist: can not callback your adapter caused by null method named 'OnAnimatorEnd(void)'"); } if (des.CallbackOnEnd) { if (ListenEnd != null) { ListenEnd(this); } } } if (WaittingProcessAnimators != null && WaittingProcessAnimators.Count > 0) { for (int i = 0; i < WaittingProcessAnimators.Count; i++) { Description tempDes = WaittingProcessAnimators[i]; if (tempDes == null || tempDes.Animator == null) { continue; } if (tempDes.RelyOn == animator && tempDes.Time == -1 && tempDes.Animator.m_Status == GTAnimator.Status.UnAction) { GTAnimator.PlayTask task = new GTAnimator.PlayTask(); task.PlayAllClip = true; task.PlayMode = GTAnimator.PlayMode.DontPlayWhenBusying; tempDes.Animator.PreBeginDelegate += OnOneAnimatorPreStart; tempDes.Animator.BeginDelegate += OnOneAnimatorStart; tempDes.Animator.UpdateDelegate += OnOneAnimatorUpdate; tempDes.Animator.EndDelegate += OnOneAnimatorEnd; tempDes.Animator.Play(task); WaittingProcessAnimators.Remove(tempDes); ActiveAnimators.Add(tempDes); } } } }
private void OnEnable() { Instance = target as GTAnimator; }
public virtual void OnAnimatorEnd(GTAnimator animator) { }
private void Awake() { if (Playlist != null && Playlist.Count > 0) { for (int i = 0; i < Playlist.Count; i++) { Description des = Playlist[i]; if (des == null) { continue; } if (string.IsNullOrEmpty(des.IdentifyName) == false) { des.Animator = GTAnimator.Get(des.IdentifyName); } if (string.IsNullOrEmpty(des.RelyOnAnimatorName) == false) { des.RelyOn = GTAnimator.Get(des.RelyOnAnimatorName); } if (des.AdapterType != null && des.Animator != null) { Component com = null; if (des.AdapterObj != null) { com = des.AdapterObj.GetComponent(des.AdapterType.name); } else { com = des.Animator.GetComponent(des.AdapterType.name); } if (des.DriveOnStart == false) { if (com != null) { MethodInfo info = com.GetType().GetMethod("Drive"); if (info != null) { com.GetType().InvokeMember("Drive", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, com, new object[] { }); } else { Utility.LogError("FixedPlaylist: can not drive your adapter caused by null method named 'Drive(void)'"); } } } des.Adapter = com; } } } if (AdapterType != null) { if (AdapterObj != null) { Adapter = AdapterObj.GetComponent(AdapterType.name); } else { Adapter = GetComponent(AdapterType.name); } if (Adapter != null) { MethodInfo info = Adapter.GetType().GetMethod("Drive"); if (info != null) { Adapter.GetType().InvokeMember("Drive", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, Adapter, new object[] { }); } else { //Utility.LogError("FixedPlaylist: can not drive your adapter caused by null method named 'Drive(void)'"); } } } }
public virtual void OnAnimatorBegin(GTAnimator animator) { }