public async UniTaskVoid HandleRequestMailList(RequestHandlerData requestHandler, RequestMailListMessage request, RequestProceedResultDelegate <ResponseMailListMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            List <MailListEntry> mails = new List <MailListEntry>();
            IPlayerCharacterData playerCharacter;
            if (GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                MailListResp resp = await DbServiceClient.MailListAsync(new MailListReq()
                {
                    UserId       = playerCharacter.UserId,
                    OnlyNewMails = request.onlyNewMails,
                });

                mails.AddRange(resp.List);
            }
            result.Invoke(AckResponseCode.Success, new ResponseMailListMessage()
            {
                onlyNewMails = request.onlyNewMails,
                mails        = mails.ToArray(),
            });
#endif
        }
Exemple #2
0
        public async UniTaskVoid HandleRequestMailList(RequestHandlerData requestHandler, RequestMailListMessage request, RequestProceedResultDelegate <ResponseMailListMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            List <MailListEntry> mails = new List <MailListEntry>();
            string userId;
            if (GameInstance.ServerUserHandlers.TryGetUserId(requestHandler.ConnectionId, out userId))
            {
                AsyncResponseData <MailListResp> resp = await DbServiceClient.MailListAsync(new MailListReq()
                {
                    UserId       = userId,
                    OnlyNewMails = request.onlyNewMails,
                });

                if (resp.IsSuccess)
                {
                    mails.AddRange(resp.Response.List);
                }
            }
            result.Invoke(AckResponseCode.Success, new ResponseMailListMessage()
            {
                onlyNewMails = request.onlyNewMails,
                mails        = mails,
            });
#endif
        }