Browse Source

清除提示

lvjincheng 4 years ago
parent
commit
d3ba249c6f

+ 10 - 0
Assets/BowArrow/Scripts/Manager/PopupMgr.cs

@@ -25,6 +25,7 @@ public class PopupMgr : MonoBehaviour
     
     public void ShowTip(string text) {
         Transform tipGroup = popupRoot.Find("TipGroup");
+        ClearAllTip();
         GameObject tipPrefab = tipGroup.Find("Tip").gameObject;
         GameObject tipObj = GameObject.Instantiate(tipPrefab, tipGroup);
         tipObj.GetComponentInChildren<Text>().text = text;
@@ -40,6 +41,15 @@ public class PopupMgr : MonoBehaviour
             FadeOutTip(tipObj);
         });
     }
+    public void ClearAllTip() {
+        Transform tipGroup = popupRoot.Find("TipGroup");
+        for (int i = 0; i < tipGroup.childCount; i++) {
+            GameObject o = tipGroup.GetChild(i).gameObject;
+            if (o.name.EndsWith("(Clone)")) {
+                if (o) Destroy(o);
+            }
+        }
+    }
     private void HideTip(GameObject tipObj) {
         tipObj.GetComponent<Button>().enabled = false;
         tipObj.GetComponent<Image>().enabled = false;

+ 3 - 0
Assets/BowArrow/Scripts/View/FriendView.cs

@@ -71,6 +71,7 @@ public class FriendView : MonoBehaviour
                 }
             };
             UserPlayer.ins.call("friendComp.getMyFriends", null, cb);
+            PopupMgr.ins.ClearAllTip();
         }
     #endregion
 
@@ -123,6 +124,7 @@ public class FriendView : MonoBehaviour
                 }
             };
             UserPlayer.ins.call("friendComp.getFriendRequestList", null, cb);
+            PopupMgr.ins.ClearAllTip();
         }
     #endregion
 
@@ -139,6 +141,7 @@ public class FriendView : MonoBehaviour
         }
         void EnterSearchPlayerBox() {
             searchPlayerBox.SetActive(true);
+            PopupMgr.ins.ClearAllTip();
         }
         InputField GetSearchInputField() {
             return searchPlayerBox.transform.Find("SearchBox/InputField").GetComponent<InputField>();