| using System;  | 
| using System.Collections;  | 
| using System.Collections.Generic;  | 
| using UnityEngine;  | 
| using UnityEngine.UI;  | 
|   | 
| namespace vnxbqy.UI  | 
| {  | 
|       | 
|     public class MainCollectBehaviour : MonoBehaviour  | 
|     {  | 
|         [SerializeField] RectTransform m_ContainerNormalCollect;  | 
|         [SerializeField] Button m_NormalCollect;  | 
|         [SerializeField] Image m_NormalCollectIcon;  | 
|         [SerializeField] Text m_NormalCollectLabel;  | 
|   | 
|   | 
|         int collectNpcId = 0;  | 
|         uint serverInstanceId = 0;  | 
|   | 
|         DungeonModel dungeonModel  | 
|         {  | 
|             get { return ModelCenter.Instance.GetModel<DungeonModel>(); }  | 
|         }  | 
|   | 
|         private void Awake()  | 
|         {  | 
|             m_NormalCollect.AddListener(NormalCollect);  | 
|         }  | 
|   | 
|         public void Display(int npcId, uint sid)  | 
|         {  | 
|             if (npcId == collectNpcId && sid == serverInstanceId)  | 
|             {  | 
|                 return;  | 
|             }  | 
|   | 
|             collectNpcId = npcId;  | 
|             serverInstanceId = sid;  | 
|             var mapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID);  | 
|             m_ContainerNormalCollect.SetActive(false);  | 
|             switch (mapId)  | 
|             {  | 
|                 default:  | 
|                     m_ContainerNormalCollect.SetActive(true);  | 
|                     DisplayNormalCollect();  | 
|                     break;  | 
|             }  | 
|         }  | 
|   | 
|         public void Dispose()  | 
|         {  | 
|             collectNpcId = 0;  | 
|             serverInstanceId = 0;  | 
|         }  | 
|   | 
|         void DisplayNormalCollect()  | 
|         {  | 
|             var config = CollectNpcConfig.Get(collectNpcId);  | 
|             if (config == null)  | 
|             {  | 
|                 m_NormalCollectIcon.SetSprite("TY_UI_6");  | 
|                 m_NormalCollectLabel.text = Language.Get("Collect_Normal");  | 
|             }  | 
|             else  | 
|             {  | 
|                 m_NormalCollectIcon.SetSprite(config.Icon);  | 
|                 m_NormalCollectLabel.text = config.tip;  | 
|             }  | 
|   | 
|             m_NormalCollectIcon.SetNativeSize();  | 
|         }  | 
|   | 
|         private void NormalCollect()  | 
|         {  | 
|             if (collectNpcId != 0 && serverInstanceId != 0)  | 
|             {  | 
|                 PrepareHandler.Instance.HandleCallback(E_NpcType.Collect, collectNpcId, serverInstanceId);  | 
|                 ClientCollectUtility.HandleCallback(E_NpcType.Collect, collectNpcId, serverInstanceId);  | 
|                 // NPCInteractProcessor.InvokeEvent(E_NpcType.Collect, collectNpcId, serverInstanceId);  | 
|             }  | 
|         }  | 
|     }  | 
| }  | 
|   |