增加编号,loading页提示,延迟毫秒
This commit is contained in:
1 parent
b9aa0131cc
commit
558fb16160
62 files changed
+7533
-2804
No files matched your search
@@ -36,11 +36,11 @@ public class Toast : MonoBehaviour
|
||||
{
|
||||
json.func = () => false;
|
||||
}
|
||||
StartCoroutine(showToastCOR(json.text, json.duration,json.func,json.showSeconds));
|
||||
StartCoroutine(showToastCOR(json.text, json.duration,json.func,json.showSeconds,json.endCallback));
|
||||
}
|
||||
|
||||
private IEnumerator showToastCOR(string text,
|
||||
int duration, Func<bool> action,bool showSeconds)
|
||||
int duration, Func<bool> action,bool showSeconds,Action endCallback)
|
||||
{
|
||||
|
||||
gameObject.SetActive(true);
|
||||
@@ -72,10 +72,13 @@ public class Toast : MonoBehaviour
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (endCallback != null)
|
||||
{
|
||||
endCallback.Invoke();
|
||||
}
|
||||
//Fade out
|
||||
yield return fadeInAndOut(txt, false, 0.5f);
|
||||
|
||||
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -143,11 +143,12 @@ namespace Assets.Scripts
|
||||
_deviceDict = value;
|
||||
}
|
||||
}
|
||||
public static void showToast(GameObject game, string text, int duration = 2, int type = 0, Func<bool> stopFunc = null, bool isLowest = false,bool showSeconds = false)
|
||||
public static void showToast(GameObject game, string text, int duration = 2, int type = 0, Func<bool> stopFunc = null, bool isLowest = false,bool showSeconds = false,Action endCallback = null)
|
||||
{
|
||||
//type 0错误 1正确
|
||||
var parent = UIManager.Instance.ModalsPanel;
|
||||
if (parent == null) return;
|
||||
if (!parent.gameObject.activeInHierarchy) parent.gameObject.SetActive(true);
|
||||
var toast = parent.transform.Find("ToastContainer");
|
||||
if (toast != null)
|
||||
{
|
||||
@@ -178,7 +179,8 @@ namespace Assets.Scripts
|
||||
text = text,
|
||||
duration = duration,
|
||||
func = stopFunc,
|
||||
showSeconds = showSeconds
|
||||
showSeconds = showSeconds,
|
||||
endCallback = endCallback
|
||||
});
|
||||
}
|
||||
public class ToastParams
|
||||
@@ -187,6 +189,7 @@ namespace Assets.Scripts
|
||||
public string text { get; set; }
|
||||
public int duration { get; set; }
|
||||
public Func<bool> func { get; set; }
|
||||
public Action endCallback { get; set; }
|
||||
}
|
||||
/*显示简略提示,需要拖Toast的预制件,且保证其他组件名字不是Toast,ToastContainer*/
|
||||
public static void showLoading(this GameObject game)
|
||||
|
||||
Reference in new issue
Block a user