修改细节

This commit is contained in:
Caiyanpeng committed 2021-04-28 15:22:04 +08:00
1 parent 5080503ebd
commit c8111d7db3
25 files changed
+1677 -7833

No files matched your search

+4 -3
View File
@@ -123,8 +123,9 @@ namespace Assets.Scripts
public static void showToast(GameObject game,string text,int duration = 1,int type = 0)
{
//type 0错误 1正确
var parent = Utils.FindUpParent(game.transform);
var toast = parent.Find("ToastContainer");
var parent = UIManager.Instance.ModalsPanel;
if (parent == null) return;
var toast = parent.transform.Find("ToastContainer");
if (toast != null)
{
MonoBehaviour.DestroyImmediate(toast.gameObject);
@@ -132,7 +133,7 @@ namespace Assets.Scripts
var newToast = MonoBehaviour.Instantiate(Resources.Load<GameObject>("UI/Prefab/ToastContainer"));
newToast.name = "ToastContainer";
newToast.GetComponent<RectTransform>().position = new Vector3(Screen.width / 2, Screen.height / 2, 0);
newToast.transform.parent = parent;
newToast.transform.parent = parent.transform;
toast = newToast.transform;
var toastStyle = toastDict[type].Split('|');
toast.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>(toastStyle[0]);