zhaoyang 2 years ago
parent
commit
ffa3307ab8

+ 13 - 8
FGUIProject/assets/poem/PoemPhotoPreviewUI.xml

@@ -4,22 +4,27 @@
     <graph id="n14_uyux" name="grhBg" xy="0,0" size="1080,1920" alpha="0.5" type="rect" lineSize="0" fillColor="#ff000000">
       <relation target="" sidePair="width-width,height-height"/>
     </graph>
-    <image id="n15_uyux" name="n15" src="uyuxzn" fileName="photImages/xc_bkuangdi.png" xy="0,1775"/>
-    <list id="n4_v482" name="list" xy="40,158" size="1000,1604" layout="pagination" overflow="scroll" scroll="horizontal" scrollBarFlags="10" defaultItem="ui://iyz778gkv482b">
+    <list id="n4_v482" name="list" xy="40,150" size="1000,1620" layout="pagination" overflow="scroll" scroll="horizontal" scrollBarFlags="138" defaultItem="ui://iyz778gkv482b">
       <item/>
       <item/>
       <item/>
       <item/>
     </list>
-    <component id="n12_11rzz" name="btnLeft" src="uyux10d" fileName="components/Button8.xml" xy="106,913" pivot="0.5,0.5" anchor="true" rotation="180">
+    <component id="n12_11rzz" name="btnLeft" src="uyux10d" fileName="components/Button8.xml" xy="106,960" pivot="0.5,0.5" anchor="true" rotation="180">
+      <relation target="" sidePair="middle-middle"/>
       <Button icon="ui://eg2y0ldpuyuxtj3"/>
     </component>
-    <component id="n13_11rzz" name="btnRight" src="uyux10d" fileName="components/Button8.xml" xy="971,913" pivot="0.5,0.5" anchor="true">
+    <component id="n13_11rzz" name="btnRight" src="uyux10d" fileName="components/Button8.xml" xy="971,960" pivot="0.5,0.5" anchor="true">
+      <relation target="" sidePair="middle-middle"/>
       <Button icon="ui://eg2y0ldpuyuxtj3"/>
     </component>
-    <component id="n6_v482" name="btnLock" src="v4826" fileName="components/Button1.xml" xy="57,1813"/>
-    <component id="n7_v482" name="btnUp" src="v4827" fileName="components/Button2.xml" xy="865,1813"/>
-    <component id="n9_v482" name="btnShare" src="v482c" fileName="components/Button4.xml" xy="964,1813"/>
-    <text id="n8_v482" name="txtTime" xy="346,1821" pivot="0.5,0" size="387,56" fontSize="42" color="#aa8c61" align="center" text="2022-1-8 17:14:30"/>
+    <image id="n15_uyux" name="n15" src="uyuxzn" fileName="photImages/xc_bkuangdi.png" xy="0,1775" group="n16_mdd9"/>
+    <component id="n6_v482" name="btnLock" src="v4826" fileName="components/Button1.xml" xy="57,1813" group="n16_mdd9"/>
+    <component id="n7_v482" name="btnUp" src="v4827" fileName="components/Button2.xml" xy="865,1813" group="n16_mdd9"/>
+    <component id="n9_v482" name="btnShare" src="v482c" fileName="components/Button4.xml" xy="964,1813" group="n16_mdd9"/>
+    <text id="n8_v482" name="txtTime" xy="344,1821" pivot="0.5,0" size="390,56" group="n16_mdd9" fontSize="42" color="#aa8c61" align="center" text="2022-1-8 17:14:30"/>
+    <group id="n16_mdd9" name="n16" xy="0,1775" size="1080,145" advanced="true">
+      <relation target="" sidePair="bottom-bottom"/>
+    </group>
   </displayList>
 </component>

+ 8 - 5
FGUIProject/assets/poem/PoemPhotoShareUI.xml

@@ -1,16 +1,19 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="1080,1920">
   <displayList>
-    <loader id="n0_v482" name="loaBg" xy="540,960" pivot="0.5,0.5" anchor="true" size="1080,1920" fill="scaleMatchHeight">
-      <relation target="" sidePair="width-width,height-height,center-center,middle-middle"/>
+    <loader id="n0_v482" name="loaBg" xy="540,960" pivot="0.5,0.5" anchor="true" size="1080,1920" fill="scaleMatchWidth">
+      <relation target="" sidePair="center-center,middle-middle"/>
     </loader>
-    <component id="n1_v482" name="btnback" src="9xlo8" fileName="components/ButtonBack1.xml" pkg="eg2y0ldp" xy="34,17">
+    <component id="n1_v482" name="btnback" src="9xlo8" fileName="components/ButtonBack1.xml" pkg="eg2y0ldp" xy="34,60">
       <relation target="" sidePair="left-left,top-top"/>
       <Button icon="ui://eg2y0ldpuyuxtj4"/>
     </component>
-    <component id="n2_v482" name="btnSave" src="v482e" fileName="components/Button5.xml" xy="699,1756"/>
-    <component id="n3_v482" name="btnShare" src="v482e" fileName="components/Button5.xml" xy="879,1756">
+    <component id="n2_v482" name="btnSave" src="v482e" fileName="components/Button5.xml" xy="699,1756" group="n4_mdd9"/>
+    <component id="n3_v482" name="btnShare" src="v482e" fileName="components/Button5.xml" xy="879,1756" group="n4_mdd9">
       <Button icon="ui://iyz778gkuyuxzk"/>
     </component>
+    <group id="n4_mdd9" name="n4" xy="699,1756" size="320,116" advanced="true" layout="hz" colGap="40" excludeInvisibles="true">
+      <relation target="" sidePair="right-right,bottom-bottom"/>
+    </group>
   </displayList>
 </component>

+ 1 - 1
FGUIProject/assets/poem/PoemPhotoUI.xml

@@ -14,7 +14,7 @@
       <Button icon="ui://iyz778gkuyux109" selectedIcon="ui://iyz778gkuyuxzw" controller="c1" page="1"/>
     </component>
     <group id="n14_uyux" name="n14" xy="263,210" size="553,82"/>
-    <list id="n8_v482" name="list" xy="0,338" size="1080,1434" layout="flow_hz" overflow="scroll" lineGap="16" colGap="15" defaultItem="ui://iyz778gkv4828" align="center">
+    <list id="n8_v482" name="list" xy="36,338" size="1008,1434" layout="flow_hz" overflow="scroll" lineGap="16" colGap="15" defaultItem="ui://iyz778gkv4828">
       <relation target="" sidePair="bottomext-bottom"/>
       <item/>
       <item/>

+ 1 - 1
FGUIProject/assets/poem/components/ComIcon.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="465,655" mask="n13_uyux">
   <displayList>
-    <loader id="n4_v482" name="loaIcon" xy="0,0" pivot="0.5,0.5" size="465,655" url="ui://iyz778gkuyux102" fill="scaleMatchWidth"/>
+    <loader id="n4_v482" name="loaIcon" xy="0,-85" pivot="0.5,0.5" size="465,826" aspect="true" url="ui://iyz778gkuyux102" fill="scaleMatchWidth"/>
     <image id="n13_uyux" name="n13" src="uyux107" fileName="photImages/xc_xzxd.png" xy="0,0"/>
   </displayList>
 </component>

+ 4 - 2
FGUIProject/assets/poem/components/ComPhoto.xml

@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="994,1600" overflow="hidden" mask="n7_uyux" reversedMask="true">
   <displayList>
-    <loader id="n5_v482" name="loaPhoto" xy="-3,-2" size="1000,1605" url="ui://iyz778gkuyux102" fill="scaleMatchWidth"/>
-    <image id="n7_uyux" name="n7" src="uyux100" fileName="photImages/xc_dakuang.png" xy="-3,-2" size="1000,1607"/>
+    <loader id="n5_v482" name="loaPhoto" xy="497,800" pivot="0.5,0.5" anchor="true" size="1000,1777" aspect="true" url="ui://iyz778gkuyux102" fill="scaleMatchWidth"/>
+    <image id="n7_uyux" name="n7" src="uyux100" fileName="photImages/xc_dakuang.png" xy="-3,-2" size="1000,1607">
+      <relation target="" sidePair="width-width,height-height"/>
+    </image>
   </displayList>
 </component>

+ 7 - 3
FGUIProject/assets/poem/components/ListPhotoPreviewItem.xml

@@ -1,7 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="1000,1065">
+<component size="1000,1605">
   <displayList>
-    <component id="n5_v482" name="comPhoto" src="uyux105" fileName="components/ComPhoto.xml" xy="3,2"/>
-    <image id="n8_uyux" name="n8" src="uyux100" fileName="photImages/xc_dakuang.png" xy="0,0"/>
+    <component id="n5_v482" name="comPhoto" src="uyux105" fileName="components/ComPhoto.xml" xy="3,2" size="994,1605">
+      <relation target="" sidePair="width-width,height-height"/>
+    </component>
+    <image id="n8_uyux" name="n8" src="uyux100" fileName="photImages/xc_dakuang.png" xy="0,0" size="1000,1605">
+      <relation target="" sidePair="width-width,height-height"/>
+    </image>
   </displayList>
 </component>

+ 6 - 12
GameClient/Assets/Game/HotUpdate/Data/PoemPhotoDataManager.cs

@@ -34,18 +34,14 @@ namespace GFGGame
             List<PoemPhotoData> poemPhotoDatas = null;
             if (sourceType == (int)PictureSourceType.PersonalAlbum)
             {
-                // PersonalPhotoInfos.Add(photoData);
-                // PersonalPhotoInfos = SortInfos(PersonalPhotoInfos);
                 poemPhotoDatas = PersonalPhotoInfos;
             }
             else if (sourceType == (int)PictureSourceType.WanShuiQianShan)
             {
-                // WsqsPhotoInfos.Add(photoData);
-                // WsqsPhotoInfos = SortInfos(WsqsPhotoInfos);
                 poemPhotoDatas = WsqsPhotoInfos;
             }
             poemPhotoDatas.Add(photoData);
-            poemPhotoDatas = SortInfos(poemPhotoDatas);
+            SortInfos(poemPhotoDatas);
         }
         public void Remove(List<long> pictureIds, int sourceType)
         {
@@ -71,7 +67,7 @@ namespace GFGGame
                     }
                 }
             }
-            poemPhotoDatas = SortInfos(poemPhotoDatas);
+            SortInfos(poemPhotoDatas);
         }
 
         public void ChangeLockingState(long pictureId, bool state, int sourceType)
@@ -79,7 +75,6 @@ namespace GFGGame
             List<PoemPhotoData> poemPhotoDatas = null;
             if (sourceType == (int)PictureSourceType.PersonalAlbum)
             {
-
                 poemPhotoDatas = PersonalPhotoInfos;
             }
             else if (sourceType == (int)PictureSourceType.WanShuiQianShan)
@@ -94,7 +89,7 @@ namespace GFGGame
                     break;
                 }
             }
-            poemPhotoDatas = SortInfos(poemPhotoDatas);
+            SortInfos(poemPhotoDatas);
 
         }
 
@@ -104,7 +99,6 @@ namespace GFGGame
             List<PoemPhotoData> poemPhotoDatas = null;
             if (sourceType == (int)PictureSourceType.PersonalAlbum)
             {
-
                 poemPhotoDatas = PersonalPhotoInfos;
             }
             else if (sourceType == (int)PictureSourceType.WanShuiQianShan)
@@ -119,15 +113,15 @@ namespace GFGGame
                     break;
                 }
             }
-            poemPhotoDatas = SortInfos(poemPhotoDatas);
+            SortInfos(poemPhotoDatas);
 
         }
         private List<PoemPhotoData> SortInfos(List<PoemPhotoData> photoInfos)
         {
             photoInfos.Sort((PoemPhotoData a, PoemPhotoData b) =>
             {
-                if (a.ToppingStatus) return 1;
-                if (b.ToppingStatus) return -1;
+                if (a.ToppingStatus && !b.ToppingStatus) return -1;
+                if (b.ToppingStatus && !a.ToppingStatus) return 1;
 
                 if (a.CreationTime < b.CreationTime) return 1;
                 if (a.CreationTime > b.CreationTime) return -1;

+ 43 - 36
GameClient/Assets/Game/HotUpdate/ServerProxy/PoemPhotoSProxy.cs

@@ -36,14 +36,14 @@ namespace GFGGame
                     for (int i = 0; i < response.PictureInfosB.Count; i++)
                     {
                         PoemPhotoData photoData = new PoemPhotoData();
-                        photoData.PictureId = response.PictureInfosA[i].PictureId;
-                        photoData.CreationTime = response.PictureInfosA[i].CreationTime;
-                        photoData.ToppingTime = response.PictureInfosA[i].ToppingTime;
-                        photoData.ToppingStatus = response.PictureInfosA[i].ToppingStatus;
-                        photoData.LockingStatus = response.PictureInfosA[i].LockingStatus;
-                        photoData.PictureName = response.PictureInfosA[i].PictureName;
-                        photoData.PictureTempUrl = response.PictureInfosA[i].PictureTempUrl;
-                        byte[] bytes = DownloadFile(response.PictureInfosA[i].PictureTempUrl);
+                        photoData.PictureId = response.PictureInfosB[i].PictureId;
+                        photoData.CreationTime = response.PictureInfosB[i].CreationTime;
+                        photoData.ToppingTime = response.PictureInfosB[i].ToppingTime;
+                        photoData.ToppingStatus = response.PictureInfosB[i].ToppingStatus;
+                        photoData.LockingStatus = response.PictureInfosB[i].LockingStatus;
+                        photoData.PictureName = response.PictureInfosB[i].PictureName;
+                        photoData.PictureTempUrl = response.PictureInfosB[i].PictureTempUrl;
+                        byte[] bytes = DownloadFile(response.PictureInfosB[i].PictureTempUrl);
                         photoData.Bytes = bytes;
 
                         PoemPhotoDataManager.Instance.Add(photoData, (int)PictureSourceType.WanShuiQianShan);
@@ -68,34 +68,7 @@ namespace GFGGame
             }
             return null;
         }
-        public static byte[] DownloadFile(string URL)
-        {
-            try
-            {
-                HttpWebRequest webRequest = HttpWebRequest.Create(URL) as HttpWebRequest;
-                webRequest.Method = "GET";
-                HttpWebResponse webResponse = webRequest.GetResponse() as HttpWebResponse;
-                System.IO.Stream st = webResponse.GetResponseStream();
-
-                byte[] bytes = new byte[st.Length];
-                st.Read(bytes, 0, bytes.Length);
-                // 设置当前流的位置为流的开始
-                st.Seek(0, SeekOrigin.Begin);
-
-                st.Close();
-                webResponse.Close();
-                webRequest.Abort();
-                return bytes;
-            }
-            catch (WebException ex)
-            {
-                //  webResponse = ex.Response as HttpWebResponse;
-                ET.Log.Debug(ex.Response.ToString());
-                return null;
-            }
 
-
-        }
         //将图片上传到华为云
         public static string PushToHWCloud(string signUrl, byte[] buffer)
         {
@@ -151,8 +124,42 @@ namespace GFGGame
             }
             return false;
         }
+        public static byte[] DownloadFile(string URL)
+        {
+            try
+            {
+                HttpWebRequest webRequest = HttpWebRequest.Create(URL) as HttpWebRequest;
+                webRequest.Method = "GET";
+                HttpWebResponse webResponse = webRequest.GetResponse() as HttpWebResponse;
+                System.IO.Stream st = webResponse.GetResponseStream();
+
+                //// 设置当前流的位置为流的开始
+                //st.Seek(0, SeekOrigin.Begin);
+
+                //byte[] bytes = new byte[st.Length];
+                //st.Read(bytes, 0, bytes.Length);
+                //st.Close();
+                byte[] bytes;
+                using (var ms = new MemoryStream())
+                {
+                    st.CopyTo(ms);
+                    bytes = ms.ToArray();
+                }
+                st.Close();
+                webResponse.Close();
+                webRequest.Abort();
+                return bytes;
+            }
+            catch (WebException ex)
+            {
+                //  webResponse = ex.Response as HttpWebResponse;
+                ET.Log.Debug(ex.Response.ToString());
+                return null;
+            }
 
 
+        }
+
         //批量删除玩家相册
         public static async ETTask<bool> ReqRemovedPhoto(List<long> pictureIds, int sourceType)
         {
@@ -199,7 +206,7 @@ namespace GFGGame
                 if (response.Error == ErrorCode.ERR_Success)
                 {
 
-                    PoemPhotoDataManager.Instance.ChangeLockingState(response.PictureId, response.Status, sourceType);
+                    PoemPhotoDataManager.Instance.ChangeToppingState(response.PictureId, response.Status, sourceType);
                     EventAgent.DispatchEvent(ConstMessage.POEM_PHOTO_INFOS_CHANGE);
 
                     return true;

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Utils/TimeUtil.cs

@@ -70,8 +70,8 @@ namespace GFGGame
         /// <param name="timeSec"></param>
         public static string FormattingTime1(long timeSec)
         {
-            DateTime date = TimeInfo.Instance.ToDateTime(timeSec * 1000);
-            string str = date.ToString("yyyy-MM-dd hh-mm-ss");
+            DateTime date = TimeInfo.Instance.ToDateTime(timeSec);
+            string str = date.ToString("yyyy-MM-dd HH:mm:ss");
 
             return str;
         }

+ 6 - 0
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographSaveView.cs

@@ -63,6 +63,12 @@ namespace GFGGame
 
         private async void OnClickBtnSavePhoto()
         {
+            if (PoemPhotoDataManager.Instance.PersonalPhotoInfos.Count >= GlobalCfgArray.globalCfg.maxPhotoCount)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("照片数量已达上限");
+                return;
+            }
+
             Texture2D tex = this.viewData as Texture2D;
             byte[] bytes = tex.EncodeToJPG();//将纹理数据,转化成一个jpg图片
 

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -230,13 +230,16 @@ namespace GFGGame
 
         private void SetPos()
         {
+            GameObject role = _sceneObject.transform.Find("Role").gameObject;
             if (MainDataManager.Instance.ViewType == 0)
             {
+                role.SetActive(true);
                 _ui.m_t1.Stop();
                 _sceneObject.transform.position = Vector2.zero;
             }
             else if (MainDataManager.Instance.ViewType == 1)
             {
+                role.SetActive(false);
                 _ui.m_t2.Stop();
                 _sceneObject.transform.position = new Vector2(-GRoot.inst.width / 100f, 0);
             }

+ 52 - 30
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoPreView.cs

@@ -12,6 +12,7 @@ namespace GFGGame
         private List<PoemPhotoData> _photoInfos;
         private int _curIndex = 0;
         private int _sourceType = 0;
+        private PoemPhotoData _curPhotoData;
 
         public override void Dispose()
         {
@@ -35,6 +36,7 @@ namespace GFGGame
 
             _ui.m_list.SetVirtual();
             _ui.m_list.itemRenderer = RenderListItem;
+            _ui.m_list.scrollPane.onScrollEnd.Add(OnListScrollEnd);
             _ui.m_btnLeft.onClick.Add(OnBtnLeftClick);
             _ui.m_btnRight.onClick.Add(OnBtnRightClick);
             _ui.m_btnLock.target.onClick.Add(OnBtnLockClick);
@@ -51,19 +53,10 @@ namespace GFGGame
         {
             base.OnShown();
             _curIndex = (int)(this.viewData as object[])[0];
-            _sourceType = (int)(this.viewData as object[])[1];
-
-            if (_sourceType == (int)PictureSourceType.PersonalAlbum)
-            {
-                _photoInfos = PoemPhotoDataManager.Instance.PersonalPhotoInfos;
-            }
-            else
-            {
-                _photoInfos = PoemPhotoDataManager.Instance.WsqsPhotoInfos;
-            }
+            _photoInfos = (this.viewData as object[])[1] as List<PoemPhotoData>;
 
             _ui.m_list.numItems = _photoInfos.Count;
-            if (_photoInfos.Count > 0) _ui.m_list.ScrollToView(_curIndex);
+            _ui.m_list.height = _ui.m_list.GetChildAt(0).height;
             UpdateView();
         }
 
@@ -88,8 +81,11 @@ namespace GFGGame
         {
             _ui.m_btnLeft.enabled = _curIndex > 0;
             _ui.m_btnRight.enabled = _curIndex < _ui.m_list.numItems - 1;
-
             _ui.m_txtTime.text = TimeUtil.FormattingTime1(_photoInfos[_curIndex].CreationTime);
+            _ui.m_btnLock.m_c1.selectedIndex = _photoInfos[_curIndex].LockingStatus ? 1 : 0;
+            _ui.m_btnUp.m_c1.selectedIndex = _photoInfos[_curIndex].ToppingStatus ? 1 : 0;
+
+            if (_photoInfos.Count > 0) _ui.m_list.ScrollToView(_curIndex);
 
             if (_ui.m_btnLock.target.data == null)
             {
@@ -101,15 +97,17 @@ namespace GFGGame
             {
                 _ui.m_btnUp.target.onClick.Add(OnBtnUpClick);
             }
-            _ui.m_btnUp.target.data = _curIndex;
+            _curPhotoData = _photoInfos[_curIndex];
 
         }
         private void RenderListItem(int index, GObject obj)
         {
             UI_ListPhotoPreviewItem item = UI_ListPhotoPreviewItem.Proxy(obj);
-
+            GLoader loaIcon = item.m_comPhoto.m_loaPhoto;
             item.m_comPhoto.m_loaPhoto.texture = PoemPhotoDataManager.Instance.BytesToTexture2D(_photoInfos[index].Bytes);
-
+            item.target.SetSize(item.target.width, item.target.initHeight * _ui.target.height / _ui.target.initHeight);
+            loaIcon.SetSize(loaIcon.width, loaIcon.texture.height * loaIcon.width / loaIcon.texture.width);
+            loaIcon.y = item.target.height / 2;
             UI_ListPhotoPreviewItem.ProxyEnd();
         }
 
@@ -117,6 +115,7 @@ namespace GFGGame
         {
             _curIndex--;
             _curIndex = Mathf.Max(0, _curIndex);
+
             UpdateView();
         }
 
@@ -124,58 +123,81 @@ namespace GFGGame
         {
             _curIndex++;
             _curIndex = Mathf.Min(_ui.m_list.numItems - 1, _curIndex);
+
+            UpdateView();
+        }
+        private void OnListScrollEnd()
+        {
+            _curIndex = _ui.m_list.ChildIndexToItemIndex(0);
             UpdateView();
         }
-
         private void OnBtnLockClick()
         {
-            PoemPhotoData photoData = _photoInfos[_curIndex];
-            if (photoData.LockingStatus == false)
+            if (_curPhotoData.LockingStatus == false)
             {
                 AlertUI.Show("是否确认锁定此照片?", "(锁住的照片无法被删除)")
-               .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
+               .SetLeftButton(true, "否").SetRightButton(true, "是", async (object data) =>
                {
-                   PoemPhotoSProxy.ReqChangeLockingState(photoData.PictureId, true, _sourceType).Coroutine();
+                   bool result = await PoemPhotoSProxy.ReqChangeLockingState(_curPhotoData.PictureId, true, _sourceType);
+                   if (result)
+                   {
+                       _photoInfos[_curIndex].LockingStatus = true;
+
+                       UpdateView();
+                   }
 
                });
             }
             else
             {
                 AlertUI.Show("是否确认解锁此照片?", "(解锁后的照片可随意删除)")
-               .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
+               .SetLeftButton(true, "否").SetRightButton(true, "是", async (object data) =>
                {
-                   PoemPhotoSProxy.ReqChangeLockingState(photoData.PictureId, false, _sourceType).Coroutine();
+                   bool result = await PoemPhotoSProxy.ReqChangeLockingState(_curPhotoData.PictureId, false, _sourceType);
 
+                   if (result)
+                   {
+                       _photoInfos[_curIndex].LockingStatus = false;
+                       UpdateView();
+                   }
                });
             }
         }
 
         private void OnBtnUpClick()
         {
-            PoemPhotoData photoData = _photoInfos[_curIndex];
-            if (photoData.ToppingStatus == false)
+            if (_curPhotoData.ToppingStatus == false)
             {
                 AlertUI.Show("是否确认置顶此照片?")
-               .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
+               .SetLeftButton(true, "否").SetRightButton(true, "是", async (object data) =>
                {
-                   PoemPhotoSProxy.ReqChangeToppingState(photoData.PictureId, true, _sourceType).Coroutine();
-
+                   bool result = await PoemPhotoSProxy.ReqChangeToppingState(_curPhotoData.PictureId, true, _sourceType);
+                   if (result)
+                   {
+                       _photoInfos[_curIndex].ToppingStatus = true;
+                       UpdateView();
+                   }
                });
             }
             else
             {
                 AlertUI.Show("是否确认取消置顶此照片?")
-               .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
+               .SetLeftButton(true, "否").SetRightButton(true, "是", async (object data) =>
                {
-                   PoemPhotoSProxy.ReqChangeToppingState(photoData.PictureId, false, _sourceType).Coroutine();
+                   bool result = await PoemPhotoSProxy.ReqChangeToppingState(_curPhotoData.PictureId, false, _sourceType);
 
+                   if (result)
+                   {
+                       _photoInfos[_curIndex].ToppingStatus = false;
+                       UpdateView();
+                   }
                });
             }
         }
 
         private void OnBtnShareClick()
         {
-            ViewManager.Show<PoemPhotoShareView>(new object[] { _curIndex, _sourceType }, new object[] { typeof(PoemPhotoPreView).FullName, _curIndex });
+            ViewManager.Show<PoemPhotoShareView>(_curPhotoData, new object[] { typeof(PoemPhotoPreView).FullName, new object[] { _curIndex, _photoInfos } });
         }
     }
 }

+ 8 - 12
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoShareView.cs

@@ -10,6 +10,8 @@ namespace GFGGame
     {
         private UI_PoemPhotoShareUI _ui;
         private List<PoemPhotoData> _photoInfos;
+        private PoemPhotoData _curPhotoData;
+
         private int _curIndex = 0;
         private int _sourceType = 0;
 
@@ -45,18 +47,12 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            _curIndex = (int)(this.viewData as object[])[0];
-            _sourceType = (int)(this.viewData as object[])[1];
 
-            if (_sourceType == (int)PictureSourceType.PersonalAlbum)
-            {
-                _photoInfos = PoemPhotoDataManager.Instance.PersonalPhotoInfos;
-            }
-            else
-            {
-                _photoInfos = PoemPhotoDataManager.Instance.WsqsPhotoInfos;
-            }
-            _ui.m_loaBg.texture = PoemPhotoDataManager.Instance.BytesToTexture2D(_photoInfos[_curIndex].Bytes);
+            _curPhotoData = this.viewData as PoemPhotoData;
+
+            _ui.m_loaBg.texture = PoemPhotoDataManager.Instance.BytesToTexture2D(_curPhotoData.Bytes);
+            _ui.m_loaBg.SetSize(_ui.m_loaBg.width, _ui.m_loaBg.texture.height * _ui.m_loaBg.width / _ui.m_loaBg.texture.width);
+
         }
 
         protected override void OnHide()
@@ -77,7 +73,7 @@ namespace GFGGame
         private void OnBtnSaveClick()
         {
 
-            byte[] bytes = _photoInfos[_curIndex].Bytes;
+            byte[] bytes = _curPhotoData.Bytes;
             string fileName = "wsj" + TimeHelper.ServerNowSecs + ".jpg";
 
             PhotographDataManager.Instance.SavePicturoToLocal(bytes, fileName);

+ 51 - 18
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoView.cs

@@ -52,7 +52,7 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-
+            OnBtnTabChange();
         }
 
         protected override void OnHide()
@@ -79,7 +79,6 @@ namespace GFGGame
                 _ui.m_c1.selectedIndex = 0;
             }
             _ui.m_c2.selectedIndex = 0;
-            _listDelete.Clear();
 
         }
         private void OnBtnDeleteClick()
@@ -91,14 +90,6 @@ namespace GFGGame
             }
             _ui.m_c2.selectedIndex = 1;
         }
-        private void OnBtnConfirmDeleteClick()
-        {
-            AlertUI.Show("删除后的照片无法恢复,是否确认删除?")
-            .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
-            {
-                PoemPhotoSProxy.ReqRemovedPhoto(_listDelete, _sourceType).Coroutine();
-            });
-        }
 
         private void OnBtnTabChange()
         {
@@ -132,9 +123,13 @@ namespace GFGGame
             UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
 
             item.m_imgSelect.visible = _ui.m_c2.selectedIndex == 1 && _listDelete.IndexOf(_photoInfos[index].PictureId) >= 0;
-            item.m_comIcon.m_loaIcon.texture = PoemPhotoDataManager.Instance.BytesToTexture2D(_photoInfos[index].Bytes);
-            item.m_txtTime.text = TimeUtil.FormattingTime1(_photoInfos[index].CreationTime);
+            GLoader loaIcon = item.m_comIcon.m_loaIcon;
+            loaIcon.texture = PoemPhotoDataManager.Instance.BytesToTexture2D(_photoInfos[index].Bytes);
+            loaIcon.SetSize(loaIcon.width, loaIcon.texture.height * loaIcon.width / loaIcon.texture.width);
 
+            item.m_txtTime.text = TimeUtil.FormattingTime1(_photoInfos[index].CreationTime);
+            item.m_btnLock.m_c1.selectedIndex = _photoInfos[index].LockingStatus ? 1 : 0;
+            item.m_btnUp.m_c1.selectedIndex = _photoInfos[index].ToppingStatus ? 1 : 0;
             if (item.m_btnLock.target.data == null)
             {
                 item.m_btnLock.target.onClick.Add(OnBtnLockClick);
@@ -151,7 +146,7 @@ namespace GFGGame
             {
                 item.m_comIcon.target.onClick.Add(OnLoaIconClick);
             }
-
+            item.m_comIcon.target.data = index;
             UI_ListPhotoItem.ProxyEnd();
         }
 
@@ -162,33 +157,66 @@ namespace GFGGame
             PoemPhotoData photoData = _photoInfos[index];
             if (_ui.m_c2.selectedIndex == 0)
             {
-                ViewManager.Show<PoemPhotoPreView>(new object[] { index, _sourceType }, new object[] { typeof(PoemView).FullName, this.viewData });
+                ViewManager.Show<PoemPhotoPreView>(new object[] { index, _photoInfos }, new object[] { typeof(PoemView).FullName, this.viewData });
             }
             else if (_ui.m_c2.selectedIndex == 1)
             {
-                long id = photoData.PictureId;
+                if (photoData.LockingStatus)
+                {
+                    PromptController.Instance.ShowFloatTextPrompt("锁定的照片无法删除");
+                    return;
+                }
+                if (photoData.ToppingStatus)
+                {
+                    PromptController.Instance.ShowFloatTextPrompt("置顶的照片无法删除");
+                    return;
+                }
                 UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj.parent);
                 item.m_imgSelect.visible = !item.m_imgSelect.visible;
                 if (item.m_imgSelect.visible)
                 {
-                    _listDelete.Add(id);
+                    _listDelete.Add(photoData.PictureId);
                 }
                 else
                 {
-                    _listDelete.Remove(id);
+                    _listDelete.Remove(photoData.PictureId);
                 }
                 UI_ListPhotoItem.ProxyEnd();
                 _ui.m_btnConfirmDelete.m_txtTitle.text = string.Format("删除({0}/{1})", _listDelete.Count, _photoInfos.Count);
             }
         }
+        private void OnBtnConfirmDeleteClick()
+        {
+            if (_listDelete.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("请选择要删除的照片");
+                return;
+            }
+            AlertUI.Show("删除后的照片无法恢复,是否确认删除?")
+            .SetLeftButton(true, "否").SetRightButton(true, "是", async (object data) =>
+            {
+                bool result = await PoemPhotoSProxy.ReqRemovedPhoto(_listDelete, _sourceType);
+                if (result)
+                {
+                    _listDelete.Clear();
+                    OnBtnTabChange();
+                }
+            });
+        }
+
         private void OnBtnLockClick(EventContext context)
         {
+            if (_ui.m_c2.selectedIndex == 1)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("删除状态无法操作");
+                return;
+            }
             GObject item = context.sender as GObject;
             int index = (int)item.data;
             PoemPhotoData photoData = _photoInfos[index];
             if (photoData.LockingStatus == false)
             {
-                AlertUI.Show("是否确认锁定此照片?", "(锁住的照片无法被删除)")
+                AlertUI.Show("是否确认锁定此照片?", "(锁的照片无法被删除)")
                .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
                {
                    PoemPhotoSProxy.ReqChangeLockingState(photoData.PictureId, true, _sourceType).Coroutine();
@@ -208,6 +236,11 @@ namespace GFGGame
         }
         private void OnBtnUpClick(EventContext context)
         {
+            if (_ui.m_c2.selectedIndex == 1)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("删除状态无法操作");
+                return;
+            }
             GObject item = context.sender as GObject;
             int index = (int)item.data;
             PoemPhotoData photoData = _photoInfos[index];

BIN
GameClient/Assets/ResIn/UI/Poem/Poem_fui.bytes