Browse Source

个人信息

zhaoyang 2 years ago
parent
commit
ce146857e6

+ 4 - 3
FGUIProject/assets/RoleInfo/components/ListPhotoItem1.xml

@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="512,740">
   <displayList>
-    <component id="n1_r9ri" name="comIcon" src="r9ri1q" fileName="componentsPhoto/ComIcon.xml" xy="0,0"/>
-    <image id="n2_r9ri" name="n2" src="r9ri1t" fileName="imagesPhoto/xc_kuangdi.png" xy="0,0"/>
+    <component id="n1_r9ri" name="comIcon" src="r9ri1q" fileName="components/ComIcon.xml" xy="0,0"/>
+    <image id="n2_r9ri" name="n2" src="r9ri1t" fileName="images/xc_kuangdi.png" xy="0,0"/>
     <text id="n3_r9ri" name="txtTime" xy="88,691" pivot="0.5,0" size="335,49" fontSize="36" color="#aa8c61" align="center" text="2022-1-8 17:14:30"/>
-    <image id="n4_r9ri" name="imgSelect" src="r9ri1s" fileName="imagesPhoto/xc_xzxd.png" xy="0,0"/>
+    <image id="n4_r9ri" name="imgOtherSelect" src="r9ri1s" fileName="images/xc_xzxd.png" xy="0,0"/>
+    <image id="n5_oqa1" name="imgSelect" src="oqa1g1" fileName="images/xc_qxxzxd.png" xy="0,0"/>
   </displayList>
 </component>

BIN
FGUIProject/assets/RoleInfo/images/xc_qxxzxd.png


+ 1 - 0
FGUIProject/assets/RoleInfo/package.xml

@@ -78,6 +78,7 @@
     <component id="r9ri22" name="ListHeadBorderItem.xml" path="/components/"/>
     <image id="r9ri23" name="grxx_xtkk_2.png" path="/images/"/>
     <image id="r9ri24" name="zjm_dj_1.png" path="/images/"/>
+    <image id="oqa1g1" name="xc_qxxzxd.png" path="/images/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\RoleInfo" packageCount="2" genCode="true"/>
 </packageDescription>

+ 11 - 2
GameClient/Assets/Game/HotUpdate/Data/PoemPhotoDataManager.cs

@@ -9,7 +9,6 @@ namespace GFGGame
 {
     public class PoemPhotoDataManager : SingletonBase<PoemPhotoDataManager>
     {
-
         /// <summary>
         /// 个人相册
         /// </summary>
@@ -131,7 +130,17 @@ namespace GFGGame
 
             return photoInfos;
         }
-
+        public PoemPhotoData GetPersonalPhotoDataById(long pictureId)
+        {
+            for (int i = 0; i < PersonalPhotoInfos.Count; i++)
+            {
+                if (pictureId == PersonalPhotoInfos[i].PictureId)
+                {
+                    return PersonalPhotoInfos[i];
+                }
+            }
+            return null;
+        }
 
         public NTexture BytesToTexture2D(byte[] bytes)
         {

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

@@ -27,7 +27,19 @@ namespace GFGGame
                 return _headBorderDatas;
             }
         }
-        public List<long> photoDatas = new List<long>() { 0, 0, 0, 0 };
+
+        private List<long> _photoDatas = new List<long>() { 0, 0, 0, 0 };
+        public List<long> photoDatas
+        {
+            get
+            {
+                return _photoDatas;
+            }
+            set
+            {
+                _photoDatas = value;
+            }
+        }
 
         public void Clear()
         {

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/RoleInfo/UI_ListPhotoItem1.cs

@@ -9,6 +9,7 @@ namespace UI.RoleInfo
         public GComponent target;
         public UI_ComIcon m_comIcon;
         public GTextField m_txtTime;
+        public GImage m_imgOtherSelect;
         public GImage m_imgSelect;
         public const string URL = "ui://374k3dwvr9ri1v";
         public const string PACKAGE_NAME = "RoleInfo";
@@ -59,6 +60,7 @@ namespace UI.RoleInfo
         {
             m_comIcon = (UI_ComIcon)UI_ComIcon.Create(comp.GetChild("comIcon"));
             m_txtTime = (GTextField)comp.GetChild("txtTime");
+            m_imgOtherSelect = (GImage)comp.GetChild("imgOtherSelect");
             m_imgSelect = (GImage)comp.GetChild("imgSelect");
         }
         public void Dispose(bool disposeTarget = false)
@@ -66,6 +68,7 @@ namespace UI.RoleInfo
             m_comIcon.Dispose();
             m_comIcon = null;
             m_txtTime = null;
+            m_imgOtherSelect = null;
             m_imgSelect = null;
             if(disposeTarget && target != null)
             {

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

@@ -7,6 +7,9 @@ namespace GFGGame
     {
         private UI_PersonalPhotoUI _ui;
 
+        private int _showIndex = 0;
+        private long _showPictureId = 0;
+
         public override void Dispose()
         {
             if (_ui != null)
@@ -26,13 +29,19 @@ namespace GFGGame
             this.viewCom.Center();
             this.modal = true;
 
+            _ui.m_list.SetVirtual();
             _ui.m_list.itemRenderer = RenderListItem;
+            _ui.m_list.onClickItem.Add(OnListItemClick);
+
+            _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
         }
 
         protected override void OnShown()
         {
             base.OnShown();
-            _ui.m_list.numItems = RoleSkillCfgArray.Instance.dataArray.Length;
+            _showIndex = (int)this.viewData;
+            _showPictureId = RoleInfoManager.Instance.photoDatas[_showIndex];
+            _ui.m_list.numItems = PoemPhotoDataManager.Instance.PersonalPhotoInfos.Count;
         }
 
         protected override void OnHide()
@@ -42,14 +51,49 @@ namespace GFGGame
 
         private void RenderListItem(int index, GObject obj)
         {
-            RoleSkillCfg cfg = RoleSkillCfgArray.Instance.dataArray[index];
-            UI_ListSkillItem item = UI_ListSkillItem.Proxy(obj);
+            PoemPhotoData photoData = PoemPhotoDataManager.Instance.PersonalPhotoInfos[index];
+            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;
+            item.m_imgSelect.visible = curSelect;
+            item.m_imgOtherSelect.visible = otherSelect;
+
+            item.target.data = photoData.PictureId;
+            UI_ListPhotoItem1.ProxyEnd();
+
+        }
+        private void OnListItemClick(EventContext context)
+        {
+            GObject obj = context.data as GObject;
+            long selectPictureId = (long)obj.data;
+            if (selectPictureId == _showPictureId)//删除:点击相同id照片
+            {
+                RoleInfoManager.Instance.photoDatas[_showIndex] = 0;
+            }
+            else
+            {
+                if (_showPictureId == 0)//添加:原来未展示图片
+                {
+                    RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
+                }
+                else//原来有展示图片
+                {
+                    if (RoleInfoManager.Instance.photoDatas.IndexOf(selectPictureId) < 0)//更换:选中的图片未被选中
+                    {
+                        RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
+                    }
+                    else
+                    {
+                        int selectPictureIndex = RoleInfoManager.Instance.photoDatas.IndexOf(selectPictureId);
 
-            item.m_loaIcon.url = string.Format("ui://Main/{0}", cfg.res);
-            item.m_txtname.text = cfg.name;
-            item.m_txtDesc.text = cfg.desc;
-            UI_ListSkillItem.ProxyEnd();
+                        RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
+                        RoleInfoManager.Instance.photoDatas[selectPictureIndex] = _showPictureId;
+                    }
+                }
+            }
 
+            ViewManager.GoBackFrom(typeof(PersonalPhotoView).FullName);
         }
     }
 }

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

@@ -1,4 +1,5 @@
 using ET;
+using FairyGUI;
 using UI.RoleInfo;
 
 namespace GFGGame
@@ -38,6 +39,9 @@ namespace GFGGame
             _ui.m_btnSetting.onClick.Add(OnBtnSettingClick);
             _ui.m_comHead.target.onClick.Add(OnComHeadClick);
 
+
+            _ui.m_list.itemRenderer = RenderListItem;
+            _ui.m_list.onClickItem.Add(OnListItemClick);
             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
         }
 
@@ -64,6 +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;
             UpdateHead();
         }
 
@@ -95,7 +100,24 @@ namespace GFGGame
             ItemCfg headBorderCfg = ItemCfgArray.Instance.GetCfg(RoleDataManager.headBorderId);
             _ui.m_comHead.m_loaBorder.url = ResPathUtil.GetHeadBorderPath(headBorderCfg.res);
         }
+        private void RenderListItem(int index, GObject obj)
+        {
+            long pictureId = RoleInfoManager.Instance.photoDatas[index];
+            PoemPhotoData poemPhotoData = pictureId == 0 ? null : PoemPhotoDataManager.Instance.GetPersonalPhotoDataById(pictureId);
+            UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
+
+            item.m_comPhoto.m_loaPhoto.texture = poemPhotoData == null ? null : poemPhotoData.Ntexture;
+            item.target.data = index;
+            UI_ListPhotoItem.ProxyEnd();
+        }
 
+        private void OnListItemClick(EventContext context)
+        {
+            GObject obj = context.data as GObject;
+            int index = (int)obj.data;
+            ViewManager.Show<PersonalPhotoView>(null, new object[] { typeof(RoleInfoView).FullName, index });
+            this.Hide();
+        }
 
         private void OnClickBtnHelp()
         {

BIN
GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes


BIN
GameClient/Assets/ResIn/UI/RoleInfo/RoleInfo_atlas0.png


BIN
GameClient/Assets/ResIn/UI/RoleInfo/RoleInfo_fui.bytes