AkiraPixelWind/Assets/Scripts/Main/UI/UIMgr/Tips/TipChoiceUnit.cs
2022-12-29 18:20:40 +08:00

70 lines
1.2 KiB
C#

// Author: whc
// Desc:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TipChoiceUnit : TipDialogUnit
{
//public Button m_BtnYes;
public new ChoiceData m_Data;
public override void Awake()
{
base.Awake();
}
public new void OnEnable()
{
base.OnEnable();
m_BtnYes.onClick.AddListener(OnBtnYesClick);
}
public new void OnDisable()
{
base.OnDisable();
m_BtnYes.onClick.RemoveAllListeners();
}
public override void Refresh(TipData _Data)
{
base.Refresh(_Data);
m_Data = (_Data as ChoiceData);
}
public override void OnBtnYesClick()
{
base.OnBtnYesClick();
if (m_Data == null)
{
Debug.LogError("OnBtnYesClick Error, m_Data == null");
return;
}
if (m_Data.m_YesCall == null)
{
Debug.LogWarning("OnBtnYesClick Warn, m_Data.m_Call == null");
return;
}
m_Data.m_YesCall();
}
public override void OnBtnCloseClick()
{
base.OnBtnCloseClick();
if (m_Data.m_NoCall != null)
m_Data.m_NoCall();
}
}