private IEnumerator HandleRequestDeleteCharacterRoutine(LiteNetLibMessageHandler messageHandler) { long connectionId = messageHandler.connectionId; RequestDeleteCharacterMessage message = messageHandler.ReadMessage <RequestDeleteCharacterMessage>(); ResponseDeleteCharacterMessage.Error error = ResponseDeleteCharacterMessage.Error.None; CentralUserPeerInfo userPeerInfo; if (!userPeers.TryGetValue(connectionId, out userPeerInfo)) { error = ResponseDeleteCharacterMessage.Error.NotLoggedin; } else { DeleteCharactersJob job = new DeleteCharactersJob(Database, userPeerInfo.userId, message.characterId); job.Start(); yield return(StartCoroutine(job.WaitFor())); } ResponseDeleteCharacterMessage responseMessage = new ResponseDeleteCharacterMessage(); responseMessage.ackId = message.ackId; responseMessage.responseCode = error == ResponseDeleteCharacterMessage.Error.None ? AckResponseCode.Success : AckResponseCode.Error; responseMessage.error = error; ServerSendPacket(connectionId, DeliveryMethod.ReliableOrdered, MMOMessageTypes.ResponseDeleteCharacter, responseMessage); }
public uint RequestDeleteCharacter(string characterId, AckMessageCallback callback) { var message = new RequestDeleteCharacterMessage(); message.characterId = characterId; return(Client.ClientSendAckPacket(SendOptions.ReliableOrdered, MMOMessageTypes.RequestDeleteCharacter, message, callback)); }
protected async UniTaskVoid HandleRequestDeleteCharacter( RequestHandlerData requestHandler, RequestDeleteCharacterMessage request, RequestProceedResultDelegate <ResponseDeleteCharacterMessage> result) { #if UNITY_STANDALONE && !CLIENT_BUILD long connectionId = requestHandler.ConnectionId; UITextKeys message = UITextKeys.NONE; CentralUserPeerInfo userPeerInfo; if (!userPeers.TryGetValue(connectionId, out userPeerInfo)) { message = UITextKeys.UI_ERROR_NOT_LOGGED_IN; } else { await DbServiceClient.DeleteCharacterAsync(new DeleteCharacterReq() { UserId = userPeerInfo.userId, CharacterId = request.characterId }); } // Response result.Invoke( message == UITextKeys.NONE ? AckResponseCode.Success : AckResponseCode.Error, new ResponseDeleteCharacterMessage() { message = message, }); #endif }
public uint RequestDeleteCharacter(string characterId, AckMessageCallback callback) { RequestDeleteCharacterMessage message = new RequestDeleteCharacterMessage(); message.characterId = characterId; return(ClientSendRequest(MMOMessageTypes.RequestDeleteCharacter, message, callback)); }
private async UniTaskVoid HandleRequestDeleteCharacterRoutine(LiteNetLibMessageHandler messageHandler) { long connectionId = messageHandler.connectionId; RequestDeleteCharacterMessage message = messageHandler.ReadMessage <RequestDeleteCharacterMessage>(); ResponseDeleteCharacterMessage.Error error = ResponseDeleteCharacterMessage.Error.None; CentralUserPeerInfo userPeerInfo; if (!userPeers.TryGetValue(connectionId, out userPeerInfo)) { error = ResponseDeleteCharacterMessage.Error.NotLoggedin; } else { await DbServiceClient.DeleteCharacterAsync(new DeleteCharacterReq() { UserId = userPeerInfo.userId, CharacterId = message.characterId }); } ResponseDeleteCharacterMessage responseMessage = new ResponseDeleteCharacterMessage(); responseMessage.ackId = message.ackId; responseMessage.responseCode = error == ResponseDeleteCharacterMessage.Error.None ? AckResponseCode.Success : AckResponseCode.Error; responseMessage.error = error; ServerSendResponse(connectionId, MMOMessageTypes.ResponseDeleteCharacter, responseMessage); }
protected async UniTaskVoid HandleRequestDeleteCharacter( RequestHandlerData requestHandler, RequestDeleteCharacterMessage request, RequestProceedResultDelegate <ResponseDeleteCharacterMessage> result) { long connectionId = requestHandler.ConnectionId; ResponseDeleteCharacterMessage.Error error = ResponseDeleteCharacterMessage.Error.None; CentralUserPeerInfo userPeerInfo; if (!userPeers.TryGetValue(connectionId, out userPeerInfo)) { error = ResponseDeleteCharacterMessage.Error.NotLoggedin; } else { await DbServiceClient.DeleteCharacterAsync(new DeleteCharacterReq() { UserId = userPeerInfo.userId, CharacterId = request.characterId }); } // Response result.Invoke( error == ResponseDeleteCharacterMessage.Error.None ? AckResponseCode.Success : AckResponseCode.Error, new ResponseDeleteCharacterMessage() { error = error, }); }
protected async UniTaskVoid HandleRequestDeleteCharacter( RequestHandlerData requestHandler, RequestDeleteCharacterMessage request, RequestProceedResultDelegate <ResponseDeleteCharacterMessage> result) { #if UNITY_STANDALONE && !CLIENT_BUILD long connectionId = requestHandler.ConnectionId; CentralUserPeerInfo userPeerInfo; if (!userPeers.TryGetValue(connectionId, out userPeerInfo)) { result.InvokeError(new ResponseDeleteCharacterMessage() { message = UITextKeys.UI_ERROR_NOT_LOGGED_IN, }); return; } AsyncResponseData <EmptyMessage> deleteResp = await DbServiceClient.DeleteCharacterAsync(new DeleteCharacterReq() { UserId = userPeerInfo.userId, CharacterId = request.characterId }); if (!deleteResp.IsSuccess) { result.InvokeError(new ResponseDeleteCharacterMessage() { message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR, }); return; } // Response result.InvokeSuccess(new ResponseDeleteCharacterMessage()); #endif }