/// <summary> /// Notifies master server that a user with a given peer id has left the room /// </summary> /// <param name="roomId"></param> /// <param name="peerId"></param> /// <param name="callback"></param> public void NotifyPlayerLeft(int roomId, int peerId, SuccessCallback callback, ErrorCallback errorCallback) { if (!Client.IsConnected) { errorCallback.Invoke("NotConnected"); return; } var packet = new PlayerLeftRoomPacket { PeerId = peerId, RoomId = roomId }; Client.SendMessage((ushort)OpCodes.PlayerLeftRoom, packet, (status, response) => { if (status == ResponseStatus.Success) { callback.Invoke(); } else { errorCallback.Invoke(response.AsString("Unknown Error")); } }); }
/// <summary> /// Notifies master server that a user with a given peer id has left the room /// </summary> public void NotifyPlayerLeft(int roomId, int peerId, SuccessCallback callback, IClientSocket connection) { if (!connection.IsConnected) { callback.Invoke(false, null); return; } var packet = new PlayerLeftRoomPacket() { PeerId = peerId, RoomId = roomId }; connection.SendMessage((short)OpCodes.PlayerLeftRoom, packet, (status, response) => { callback.Invoke(status == ResponseStatus.Success, null); }); }