少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using UnityEngine;
using UnityEngine.EventSystems;
using System;
using vnxbqy.UI;
 
public class NPCInteractProcessor : MonoBehaviour, IPointerClickHandler
{
    public static event Action<E_NpcType, int, uint> s_NpcInteractEvent;
    public event Action npcIntergactEvent;
 
    E_NpcType m_NPCType = E_NpcType.Func;
    public E_NpcType npcType {
        get { return m_NPCType; }
        set {
            m_NPCType = value;
        }
    }
 
    int m_NPCId = 0;
    public int npcId {
        get { return m_NPCId; }
        set {
            m_NPCId = value;
        }
    }
 
    uint m_NPCInstanceId = 0;
    public uint npcInstanceId {
        get { return m_NPCInstanceId; }
        set {
            m_NPCInstanceId = value;
        }
    }
 
    public void OnPointerClick(PointerEventData eventData)
    {
        if (npcIntergactEvent != null)
        {
            npcIntergactEvent();
        }
    }
 
    public static void InvokeEvent(E_NpcType _type, int npcID, uint instanceID)
    {
        if (s_NpcInteractEvent == null)
        {
            return;
        }
        s_NpcInteractEvent(_type, npcID, instanceID);
    }
}