|
|
@@ -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;
|