/// <summary> /// 屏幕外滑动进入 /// </summary> /// <param name="control"></param> /// <param name="fTime"></param> /// <param name="stType"></param> /// <param name="ltType"></param> /// <returns></returns> public static CUIControl SlideIn(CUIControl control, Vector3 vIn, DirType stType = DirType.Top, float fTime = 0.25f, LeanTweenType ltType = LeanTweenType.easeOutCirc) { control.show = true; Vector3 vFrom = Vector3.zero; RectTransform rt = control.GetComponent <RectTransform>(); Rect rect = rt.rect; switch (stType) { default: case DirType.Top: vFrom = new Vector3(0, Screen.height * 0.5f + rect.height * 0.5f, 0); break; case DirType.Bottom: vFrom = new Vector3(0, -Screen.height * 0.5f - rect.height * 0.5f, 0); break; case DirType.Right: vFrom = new Vector3(Screen.width * 0.5f + rect.width * 0.5f, 0, 0); break; case DirType.Left: vFrom = new Vector3(-Screen.width * 0.5f - rect.width * 0.5f, 0, 0); break; } CUI.MoveTo(control, vFrom, vIn, fTime, ltType); return(control); }
/// <summary> /// 滑动 /// </summary> /// <param name="control"></param> /// <param name="vIn"></param> /// <param name="stType"></param> /// <param name="fTime"></param> /// <param name="ltType"></param> /// <returns></returns> public static CUIControl Slide(CUIControl control, Vector3 vFrom, Vector3 vTo, float fAlphaForm = 0, float fAlphaTo = 1, float fTime = 0.25f, LeanTweenType ltType = LeanTweenType.easeOutCirc) { control.show = true; CUI.MoveTo(control, vFrom, vTo, fTime, ltType); CUI.Fade(control, fAlphaForm, fAlphaTo, fTime); return(control); }