/// <summary> /// 跳转到主界面场景 /// </summary> /// <returns></returns> public async CTask GoHomeScene() { //await Mgr.UI.Show<HomeUI>().Await(); if (SceneManager.GetActiveScene().name != "Home") { await CSF.Mgr.Assetbundle.LoadScene("Home"); } await CTask.WaitForSeconds(0.25f); }
private static async CTask showAnim(string content) { Tips tips; if (cacheTipsList.Count < 1) { tips = new Tips(); await tips._openUI(content); } else { tips = cacheTipsList.Dequeue(); tips.transform.SetParent(tips.transform.parent); tips.ResetTipsAnim(content); } await CTask.WaitForSeconds(0.3f); }
public static async CTask ObjectAnim(GameObject target, EUIAnim anim, float time = 0.5f) { if (anim == EUIAnim.None || target == null) { return; } //UI淡入淡出效果 if (anim == EUIAnim.FadeIn || anim == EUIAnim.FadeOut) { Graphic[] comps = target.GetComponentsInChildren <Graphic>(); for (int i = comps.Length; --i >= 0;) { if (anim == EUIAnim.FadeIn) { comps[i].DOFade(0, time).From(); } else { comps[i].DOFade(0, time); } } await CTask.WaitForSeconds(time); } else if (anim == EUIAnim.ScaleIn || anim == EUIAnim.ScaleOut) { if (anim == EUIAnim.ScaleIn) { target.transform.DOScale(0, time).SetEase(Ease.OutBack).From(); await CTask.WaitForSeconds(time); } else { target.transform.DOScale(0, time).SetEase(Ease.InBack); await CTask.WaitForSeconds(time); } } }
/// <summary> /// 延时执行方法 /// </summary> /// <param name="sec"></param> /// <param name="act"></param> public static async CTask Delay(float sec, Action act) { await CTask.WaitForSeconds(sec); act(); }