using System.Collections; using System.Collections.Generic; using ET; using FairyGUI; using UnityEngine; using UnityEngine.Networking; namespace GFGGame { public static class RoleInfoSProxy { //请求个人信息 public static async ETTask ReqPersonalInfo() { S2C_GetPersonalInfo response = null; response = (S2C_GetPersonalInfo)await MessageHelper.SendToServer(new C2S_GetPersonalInfo()); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { RoleDataManager.slogan = response.Signature; RoleDataManager.headId = response.HeadItemId; RoleDataManager.headBorderId = response.HeadBorderItemId; RoleDataManager.photoDatas = response.PictureIds; return true; } } return false; } //请求其他玩家详细信息 public static async ETTask ReqOtherRoleDetailInfo(long friendId) { S2C_GetOtherRoleDetailInfo response = null; response = (S2C_GetOtherRoleDetailInfo)await MessageHelper.SendToServer(new C2S_GetOtherRoleDetailInfo() { RoleId = friendId }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { OtherRoleInfoDetailData roleInfoDetail = new OtherRoleInfoDetailData(); roleInfoDetail.slogan = response.Signature; roleInfoDetail.RoleLvl = response.RoleLvl; for (int i = 0; i < response.PictureInfoList.Count; i++) { if (roleInfoDetail.showPhotoList.Count == i) { roleInfoDetail.showPhotoList.Add(new PoemPhotoData()); } if (response.PictureInfoList[i].PictureId == 0) { roleInfoDetail.showPhotoList[i] = null; } else { roleInfoDetail.showPhotoList[i].PictureId = response.PictureInfoList[i].PictureId; roleInfoDetail.showPhotoList[i].PictureTempUrl = response.PictureInfoList[i].PictureTempUrl; } } if (response.CustomSuit != null) { roleInfoDetail.customSuitData = new CustomSuitData(response.CustomSuit.Pos); roleInfoDetail.customSuitData.bg = response.CustomSuit.BgId; roleInfoDetail.customSuitData.suitId = response.CustomSuit.SuitId; roleInfoDetail.customSuitData.equipDatas = response.CustomSuit.EquipIds; roleInfoDetail.customSuitData.pic = response.CustomSuit.Pic; } return roleInfoDetail; } } return null; } public static IEnumerator Download(List list) { for (int i = 0; i < list.Count; i++) { PoemPhotoData data = list[i]; if (data == null || data.Ntexture != null) continue; using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(data.PictureTempUrl)) { yield return request.SendWebRequest(); if (request.result == UnityWebRequest.Result.ProtocolError || request.result == UnityWebRequest.Result.ConnectionError) { PromptController.Instance.ShowFloatTextPrompt("下载失败"); yield return null; } else { Texture2D texture = (request.downloadHandler as DownloadHandlerTexture).texture; data.Ntexture = new NTexture(texture); } } } ET.Log.Debug("Download finish!!!"); EventAgent.DispatchEvent(ConstMessage.DOWNLOAD_FINISH); } //修改个人签名 public static async ETTask ReqModifySlogan(string slogan) { S2C_ModifySignature response = null; response = (S2C_ModifySignature)await MessageHelper.SendToServer(new C2S_ModifySignature() { Signature = slogan }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { RoleDataManager.slogan = response.Signature; return RoleDataManager.slogan; } } return RoleDataManager.slogan; } //修改角色名称 public static async ETTask ReqModifyRoleName(string name) { S2C_ModifyRoleName response = null; response = (S2C_ModifyRoleName)await MessageHelper.SendToServer(new C2S_ModifyRoleName() { Name = name }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { RoleDataManager.roleName = response.Name; EventAgent.DispatchEvent(ConstMessage.CHANGE_ROLE_NAME); return true; } } return false; } //修改角色头像 public static async ETTask ReqModifyRoleHead(int headId) { S2C_AuHeadPortrait response = null; response = (S2C_AuHeadPortrait)await MessageHelper.SendToServer(new C2S_AuHeadPortrait() { HeadItemId = headId }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { RoleDataManager.headId = response.HeadItemId; EventAgent.DispatchEvent(ConstMessage.CHANGE_ROLE_NAME); return true; } } return false; } //修改角色头像框 public static async ETTask ReqModifyRoleHeadBorder(int HeadBorder) { S2C_AuHeadPortraitBox response = null; response = (S2C_AuHeadPortraitBox)await MessageHelper.SendToServer(new C2S_AuHeadPortraitBox() { HeadBorderItemId = HeadBorder }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { RoleDataManager.headBorderId = response.HeadBorderItemId; EventAgent.DispatchEvent(ConstMessage.CHANGE_ROLE_NAME); return true; } } return false; } //修改展示图片 public static async ETTask ReqModifyShowPhoto(List photoDatas) { S2C_AddOpenAlbumInfo response = null; response = (S2C_AddOpenAlbumInfo)await MessageHelper.SendToServer(new C2S_AddOpenAlbumInfo() { PictureIds = photoDatas }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { EventAgent.DispatchEvent(ConstMessage.CHANGE_ROLE_NAME); return true; } } return false; } } }