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); } }
public void Awake() { instance = this; onDataReceive.AddListener(OnDataReceived); }