private IEnumerator IEPlayAnimation(string sn, AnimType animType, NoParamCallback callback = null) { SSMotion an = m_Dict[sn].GetComponentInChildren <SSMotion>(); if (an != null && animType != AnimType.NO_ANIM) { yield return(null); NoParamCallback play = null; float time = 0; switch (animType) { case AnimType.SHOW: play = an.PlayShow; time = an.TimeShow(); break; case AnimType.SHOW_BACK: play = an.PlayShowBack; time = an.TimeShowBack(); break; case AnimType.HIDE: play = an.PlayHide; time = an.TimeHide(); break; case AnimType.HIDE_BACK: play = an.PlayHideBack; time = an.TimeHideBack(); break; } if (play != null) { play(); } yield return(StartCoroutine(Pause(time))); if (callback != null) { callback(); } } else { if (animType == AnimType.NO_ANIM) { an.transform.localPosition = Vector3.zero; } if (callback != null) { callback(); } } }
private void ActiveScene(string sn) { m_Dict[sn].SetActive(true); // Animation SSMotion an = m_Dict[sn].GetComponentInChildren <SSMotion>(); if (an != null) { // We should bring this scene to somewhere far when re-active it. // Then the animation will automatically bring it back at next frame. // This trick remove flicker at the first frame. an.transform.localPosition = new Vector3(99999, 0, 0); an.transform.localScale = Vector3.one; } }
private void MoveAnimTransformPosition(SSMotion an, float x) { switch (m_UIType) { case UIType.uGUI: an.GetComponent<RectTransform>().anchoredPosition = new Vector2(x, 0); break; case UIType.nGUI: an.transform.localPosition = new Vector3(x, 0, 0); break; default: break; } }