CutePet/Assets/Scripts/GameScene/Panel/MailTwoPanel.cs
2024-10-25 11:10:04 +08:00

48 lines
1.3 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
using UnityEngine;
using UnityEngine.UI;
public class MailTwoPanel : BasePanel
{
//关闭
public Button btnClose;
//礼物按钮
public Button btnReward;
//领取按钮
public Button btnGet;
//游戏文字
public Text txtReward;
private MailInfo mailInfo;
//点击领取后,要更新已领取面板
private GameObject go;
public override void Init()
{
btnClose.onClick.AddListener(() =>
{
UIManager.Instance.HidePanel<MailTwoPanel>(false);
});
btnGet.onClick.AddListener(() =>
{
GameDataMgr.Instance.player.gold += mailInfo.mailData.gold;
StartCoroutine(NetMgr.Instance.ChangeDataPost(GameDataMgr.Instance.player));
go.SetActive(true);
UIManager.Instance.GetPanel<GamePanel>().UpdateGold();
UIManager.Instance.GetPanel<MailPanel>().ClaimMail(mailInfo.mailData.id);
UIManager.Instance.HidePanel<MailTwoPanel>(false);
});
}
public void UpedatePanel(MailInfo info,GameObject obj)
{
go = obj;
mailInfo = info;
txtReward.text = "亲爱的玩家您好,恭喜您在本周的荣耀排行榜中获\n得排名第"+info.mailData.rank+"的成绩!\n现在为您发放对应的排名奖励请查收!";
}
}