public async UniTaskVoid HandleRequestDeleteMail(RequestHandlerData requestHandler, RequestDeleteMailMessage request, RequestProceedResultDelegate <ResponseDeleteMailMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            IPlayerCharacterData playerCharacter;
            if (GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                UpdateDeleteMailStateResp resp = await DbServiceClient.UpdateDeleteMailStateAsync(new UpdateDeleteMailStateReq()
                {
                    MailId = request.id,
                    UserId = playerCharacter.UserId,
                });

                UITextKeys message = resp.Error;
                result.Invoke(
                    message == UITextKeys.NONE ? AckResponseCode.Success : AckResponseCode.Error,
                    new ResponseDeleteMailMessage()
                {
                    message = message,
                });
            }
            else
            {
                result.Invoke(AckResponseCode.Error, new ResponseDeleteMailMessage()
                {
                    message = UITextKeys.UI_ERROR_SERVICE_NOT_AVAILABLE,
                });
            }
#endif
        }
Exemplo n.º 2
0
        public async UniTaskVoid HandleRequestDeleteMail(RequestHandlerData requestHandler, RequestDeleteMailMessage request, RequestProceedResultDelegate <ResponseDeleteMailMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            string userId;
            if (!GameInstance.ServerUserHandlers.TryGetUserId(requestHandler.ConnectionId, out userId))
            {
                result.Invoke(AckResponseCode.Error, new ResponseDeleteMailMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            UITextKeys message = await DeleteMail(request.id, userId);

            if (message != UITextKeys.NONE)
            {
                result.Invoke(AckResponseCode.Error, new ResponseDeleteMailMessage()
                {
                    message = message,
                });
                return;
            }
            result.Invoke(AckResponseCode.Success, new ResponseDeleteMailMessage());
#endif
        }