示例#1
0
    public static void AddListener(NetEventType type, UnityAction <NetEventArgs> listener)
    {
        NetworkEvent e = null;

        if (instance.events.TryGetValue(type, out e))
        {
            e.AddListener(listener);
        }
        else
        {
            e = new NetworkEvent();
            e.AddListener(listener);
            instance.events.Add(type, e);
        }
    }
示例#2
0
 public void Awake()
 {
     instance = this;
     onDataReceive.AddListener(OnDataReceived);
 }