/// <summary> /// Removes the listener. /// </summary> /// <param name="eventCode">The event code.</param> /// <param name="socketListener">The socket listener.</param> public void RemoveListener(EventCode eventCode, IGSocketListener socketListener) { if (mSocketDictionary.TryGetValue(eventCode, out var eventHandler)) { eventHandler.RemoveListener(socketListener); } }
/// <summary> /// Removes the listener. /// </summary> /// <param name="socketListener">The socket listener.</param> public void RemoveListener(IGSocketListener socketListener) { bool isSuccess = _listenerList.Remove(socketListener); if (!isSuccess) { Console.WriteLine("移除IGSocketListener失敗"); } }
/// <summary> /// Adds the listener. /// </summary> /// <param name="eventCode">The event code.</param> /// <param name="socketListener">The socket listener.</param> public void AddListener(EventCode eventCode, IGSocketListener socketListener) { if (mSocketDictionary.TryGetValue(eventCode, out var eventHandler)) { eventHandler.AddListener(socketListener); } else { Console.WriteLine("於GSocket中並未定義該Event:" + eventCode); } }
/// <summary> /// Adds the listener. /// </summary> /// <param name="socketListener">The socket listener.</param> public void AddListener(IGSocketListener socketListener) { _listenerList.Add(socketListener); }