소스 검색

个人信息

zhaoyang 2 년 전
부모
커밋
c877ea14a5

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -89,5 +89,7 @@ namespace GFGGame
 
         public const string GALLERY_DATA_CHANGE = "GALLERY_DATA_CHANGE";//画廊数据变化
         public const string GALLERY_RANK_DATA_CHANGE = "GALLERY_RANK_DATA_CHANGE";//画廊排行榜数据变化
+
+        public const string DOWNLOAD_FINISH = "DOWNLOAD_FINISH";//下载完成
     }
 }

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Data/RoleDataManager.cs

@@ -22,6 +22,7 @@ namespace GFGGame
 
         public static int headBorderId = ConstItemID.BORDERID;
 
+        public static List<long> photoDatas { get; set; }
 
         public static int power
         {

+ 1 - 12
GameClient/Assets/Game/HotUpdate/Data/RoleInfoManager.cs

@@ -33,18 +33,7 @@ namespace GFGGame
             }
         }
 
-        private List<long> _photoDatas = new List<long>() { 0, 0, 0, 0 };
-        public List<long> photoDatas
-        {
-            get
-            {
-                return _photoDatas;
-            }
-            set
-            {
-                _photoDatas = value;
-            }
-        }
+
 
 
         public void Add(int itemId)

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/VO/RoleInfoData.cs

@@ -19,6 +19,6 @@ namespace GFGGame
         public string slogan;//个性签名
         public CustomSuitData customSuitData; //当前搭配套装
         public int RoleLvl = 1; //玩家等级
-        public List<long> showPhotoList = new List<long>();
+        public List<PoemPhotoData> showPhotoList = new List<PoemPhotoData>();//会返回固定四个图片信息,未展示则为null
     }
 }

+ 71 - 10
GameClient/Assets/Game/HotUpdate/ServerProxy/RoleInfoSProxy.cs

@@ -1,5 +1,9 @@
+using System.Collections;
 using System.Collections.Generic;
 using ET;
+using FairyGUI;
+using UnityEngine;
+using UnityEngine.Networking;
 
 namespace GFGGame
 {
@@ -15,9 +19,9 @@ namespace GFGGame
                 if (response.Error == ErrorCode.ERR_Success)
                 {
                     RoleDataManager.slogan = response.Signature;
-                    RoleDataManager.headId = response.HeadPortraitItemId;
-                    RoleDataManager.headBorderId = response.HeadPortraitBoxItemId;
-                    // RoleInfoManager.Instance.photoDatas=response.OpenAlbumList;
+                    RoleDataManager.headId = response.HeadItemId;
+                    RoleDataManager.headBorderId = response.HeadBorderItemId;
+                    RoleDataManager.photoDatas = response.PictureIds;
                     return true;
                 }
             }
@@ -35,6 +39,24 @@ namespace GFGGame
                     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);
@@ -49,6 +71,31 @@ namespace GFGGame
             }
             return null;
         }
+        public static IEnumerator Download(List<PoemPhotoData> 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<string> ReqModifySlogan(string slogan)
         {
@@ -85,13 +132,13 @@ namespace GFGGame
         //修改角色头像
         public static async ETTask<bool> ReqModifyRoleHead(int headId)
         {
-            S2C_ModifyRoleName response = null;
-            response = (S2C_ModifyRoleName)await MessageHelper.SendToServer(new C2S_ModifyRoleName() { });
+            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.roleName = response.Name;
+                    RoleDataManager.headId = response.HeadItemId;
                     EventAgent.DispatchEvent(ConstMessage.CHANGE_ROLE_NAME);
                     return true;
                 }
@@ -101,13 +148,13 @@ namespace GFGGame
         //修改角色头像框
         public static async ETTask<bool> ReqModifyRoleHeadBorder(int HeadBorder)
         {
-            S2C_ModifyRoleName response = null;
-            response = (S2C_ModifyRoleName)await MessageHelper.SendToServer(new C2S_ModifyRoleName() { });
+            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.roleName = response.Name;
+                    RoleDataManager.headBorderId = response.HeadBorderItemId;
                     EventAgent.DispatchEvent(ConstMessage.CHANGE_ROLE_NAME);
                     return true;
                 }
@@ -115,6 +162,20 @@ namespace GFGGame
             return false;
         }
 
-
+        //修改展示图片
+        public static async ETTask<bool> ReqModifyShowPhoto(List<int> 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;
+        }
     }
 }

+ 9 - 9
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/PersonalPhotoView.cs

@@ -40,7 +40,7 @@ namespace GFGGame
         {
             base.OnShown();
             _showIndex = (int)this.viewData;
-            _showPictureId = RoleInfoManager.Instance.photoDatas[_showIndex];
+            _showPictureId = RoleDataManager.photoDatas[_showIndex];
             _ui.m_list.numItems = PoemPhotoDataManager.Instance.PersonalPhotoInfos.Count;
         }
 
@@ -55,7 +55,7 @@ namespace GFGGame
             UI_ListPhotoItem1 item = UI_ListPhotoItem1.Proxy(obj);
             item.m_comIcon.m_loaIcon.texture = photoData.Ntexture;
             bool curSelect = photoData.PictureId == _showPictureId;
-            bool otherSelect = !curSelect && RoleInfoManager.Instance.photoDatas.IndexOf(photoData.PictureId) >= 0;
+            bool otherSelect = !curSelect && RoleDataManager.photoDatas.IndexOf(photoData.PictureId) >= 0;
             item.m_imgSelect.visible = curSelect;
             item.m_imgOtherSelect.visible = otherSelect;
 
@@ -69,26 +69,26 @@ namespace GFGGame
             long selectPictureId = (long)obj.data;
             if (selectPictureId == _showPictureId)//删除:点击相同id照片
             {
-                RoleInfoManager.Instance.photoDatas[_showIndex] = 0;
+                RoleDataManager.photoDatas[_showIndex] = 0;
             }
             else
             {
                 if (_showPictureId == 0)//添加:原来未展示图片
                 {
-                    RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
+                    RoleDataManager.photoDatas[_showIndex] = selectPictureId;
                 }
                 else//原来有展示图片
                 {
-                    if (RoleInfoManager.Instance.photoDatas.IndexOf(selectPictureId) < 0)//更换:选中的图片未被选中
+                    if (RoleDataManager.photoDatas.IndexOf(selectPictureId) < 0)//更换:选中的图片未被选中
                     {
-                        RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
+                        RoleDataManager.photoDatas[_showIndex] = selectPictureId;
                     }
                     else
                     {
-                        int selectPictureIndex = RoleInfoManager.Instance.photoDatas.IndexOf(selectPictureId);
+                        int selectPictureIndex = RoleDataManager.photoDatas.IndexOf(selectPictureId);
 
-                        RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
-                        RoleInfoManager.Instance.photoDatas[selectPictureIndex] = _showPictureId;
+                        RoleDataManager.photoDatas[_showIndex] = selectPictureId;
+                        RoleDataManager.photoDatas[selectPictureIndex] = _showPictureId;
                     }
                 }
             }

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/RoleInfoView.cs

@@ -68,7 +68,7 @@ namespace GFGGame
 
             _ui.m_txtSlogan.text = RoleDataManager.slogan;
             _ui.m_btnFieldGuide.title = string.Format("收集度:{0}%", RoleInfoManager.Instance.GetGuideProgress());
-            _ui.m_list.numItems = RoleInfoManager.Instance.photoDatas.Count;
+            _ui.m_list.numItems = RoleDataManager.photoDatas.Count;
             UpdateHead();
         }
 
@@ -102,7 +102,7 @@ namespace GFGGame
         }
         private void RenderListItem(int index, GObject obj)
         {
-            long pictureId = RoleInfoManager.Instance.photoDatas[index];
+            long pictureId = RoleDataManager.photoDatas[index];
             PoemPhotoData poemPhotoData = pictureId == 0 ? null : PoemPhotoDataManager.Instance.GetPersonalPhotoDataById(pictureId);
             UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);