| using System;  | 
| using System.Collections;  | 
| using System.Collections.Generic;  | 
| using UnityEngine;  | 
| using UnityEngine.UI;  | 
|   | 
| namespace vnxbqy.UI  | 
| {  | 
|     public class AncientKingBehaviour : MonoBehaviour  | 
|     {  | 
|         [SerializeField] RectTransform m_ContainerBottom;  | 
|         [SerializeField] Text m_AncientKingName;  | 
|         [SerializeField] Text m_AncientKingPoint;  | 
|         [SerializeField] Button m_Func;  | 
|   | 
|         DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }  | 
|   | 
|         private void Awake()  | 
|         {  | 
|             m_Func.onClick.AddListener(OnFunc);  | 
|         }  | 
|   | 
|         public void Init()  | 
|         {  | 
|             model.updateMissionEvent += Display;  | 
|             Display();  | 
|         }  | 
|   | 
|         public void UnInit()  | 
|         {  | 
|             model.updateMissionEvent -= Display;  | 
|         }  | 
|   | 
|         void Display()  | 
|         {  | 
|             var _help = model.mission;  | 
|             m_ContainerBottom.SetActive(!string.IsNullOrEmpty(_help.topName));  | 
|             m_AncientKingName.text = _help.topName;  | 
|             m_AncientKingPoint.text = UIHelper.ReplaceLargeNum(_help.topScore);  | 
|         }  | 
|   | 
|         private void OnFunc()  | 
|         {  | 
|             if (WindowCenter.Instance.IsOpen<DungeonAncientKingWin>())  | 
|             {  | 
|                 WindowCenter.Instance.Close<DungeonAncientKingWin>();  | 
|             }  | 
|             else  | 
|             {  | 
|                 WindowCenter.Instance.Open<DungeonAncientKingWin>();  | 
|             }  | 
|         }  | 
|     }  | 
| }  | 
|   |