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 }
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, }); }
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) { #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 }