using System; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class DogzNotifyBehaviour : MonoBehaviour { [SerializeField] Text titleText; [SerializeField] Image dogzImg; [SerializeField] Button gotoBtn; [SerializeField] Button closeBtn; DogzModel dogzModel { get { return ModelCenter.Instance.GetModel(); } } private void OnEnable() { closeBtn.AddListener(CloseNotify); gotoBtn.AddListener(ClickGoto); } private void OnDisable() { closeBtn.RemoveAllListeners(); gotoBtn.RemoveAllListeners(); } public void SetDisplay() { DogzConfig dogzConfig = DogzConfig.Get(dogzModel.dogzPutRedId); if(dogzConfig == null) { CloseNotify(); } else { this.gameObject.SetActive(true); dogzImg.SetSprite(dogzConfig.HeadIcon); } } private void ClickGoto() { WindowCenter.Instance.Open(); CloseNotify(); } public void CloseNotify() { dogzModel.dogzPutRedId = 0; this.gameObject.SetActive(false); } } }