|
|
@@ -82,31 +82,13 @@ public class PopupMgr : MonoBehaviour
|
|
|
System.Action cbYes, System.Action cbNo, System.Action cbAutoCancel
|
|
|
) {
|
|
|
GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Popups/PKInviteNotice"));
|
|
|
- Transform item = o.transform.Find("Item");
|
|
|
- RectTransform itemRTF = item.GetComponent<RectTransform>();
|
|
|
- item.Find("Avatar/Sprite").GetComponent<Image>().sprite = RoleMgr.GetAvatar(avatarID);
|
|
|
- item.Find("Name").GetComponent<Text>().text = nickname;
|
|
|
- item.Find("Tip").GetComponent<Text>().text = tip;
|
|
|
- item.Find("BtnYes").GetComponent<Button>().onClick.AddListener(() => {
|
|
|
- AudioMgr.ins.PlayBtn();
|
|
|
- Destroy(o);
|
|
|
- if (cbYes != null) cbYes();
|
|
|
- });
|
|
|
- item.Find("BtnNo").GetComponent<Button>().onClick.AddListener(() => {
|
|
|
- AudioMgr.ins.PlayBtn();
|
|
|
- Destroy(o);
|
|
|
- if (cbNo != null) cbNo();
|
|
|
- });
|
|
|
- Sequence seq = DOTween.Sequence();
|
|
|
- seq.Append(itemRTF.DOLocalMoveX(itemRTF.localPosition.x + itemRTF.sizeDelta.x, 0.6f));
|
|
|
- seq.AppendInterval(10f);
|
|
|
- seq.AppendCallback(() => {
|
|
|
- if (o) {
|
|
|
- Destroy(o);
|
|
|
- if (cbAutoCancel != null) cbAutoCancel();
|
|
|
- }
|
|
|
- });
|
|
|
- seq.SetUpdate(true);
|
|
|
+ PKInviteNotice script = o.AddComponent<PKInviteNotice>();
|
|
|
+ script.SetAvatarSprite(RoleMgr.GetAvatar(avatarID));
|
|
|
+ script.SetNameText(nickname);
|
|
|
+ script.SetTipText(tip);
|
|
|
+ script.eventOnAgree += cbYes;
|
|
|
+ script.eventOnReject += cbNo;
|
|
|
+ script.eventOnAutoDestroy += cbAutoCancel;
|
|
|
}
|
|
|
|
|
|
public void ShowTipTop(string text) {
|