Add close logic for BtnYes and BtnBack on EndPanel
This commit is contained in:
@@ -176,7 +176,23 @@ public class UIManager : MonoBehaviour
|
||||
{
|
||||
_endPanel.SetActive(true);
|
||||
|
||||
// 绑定返回首页按钮
|
||||
// 绑定 BtnYes:关闭 EndPanel
|
||||
var btnYes = _endPanel.transform.Find("BtnYes")?.GetComponent<Button>();
|
||||
if (btnYes != null)
|
||||
{
|
||||
btnYes.onClick.RemoveAllListeners();
|
||||
btnYes.onClick.AddListener(() => { _endPanel.SetActive(false); });
|
||||
}
|
||||
|
||||
// 绑定 BtnBack:关闭 EndPanel(如果你希望点它也是单纯关面板而不是退回到首页的话)
|
||||
var btnBack = _endPanel.transform.Find("BtnBack")?.GetComponent<Button>();
|
||||
if (btnBack != null)
|
||||
{
|
||||
btnBack.onClick.RemoveAllListeners();
|
||||
btnBack.onClick.AddListener(() => { _endPanel.SetActive(false); });
|
||||
}
|
||||
|
||||
// (如果还需要之前的 BtnReturn 点击退回到主页,可以继续绑定)
|
||||
var btnRet = _endPanel.transform.Find("BtnReturn")?.GetComponent<Button>();
|
||||
if (btnRet != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user