瀏覽代碼

优化寻奇访胜,添加批量保存/删除功能
修复个人设置相册显示bug

leiyasi 1 年之前
父節點
當前提交
2e0d90afe0
共有 22 個文件被更改,包括 574 次插入130 次删除
  1. 3 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Travel/UI_TravelRewardUI.cs
  2. 0 71
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_Button7.cs
  3. 88 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_PoemPhotoSaveUI.cs
  4. 1 1
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_PoemPhotoSaveUI.cs.meta
  5. 17 9
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_PoemPhotoUI.cs
  6. 4 4
      GameClient/Assets/Game/HotUpdate/Views/ActivityGetYuanXiao/ActivityGetYuanXiaoView.cs
  7. 202 0
      GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoSaveView.cs
  8. 11 0
      GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoSaveView.cs.meta
  9. 206 31
      GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoView.cs
  10. 34 13
      GameClient/Assets/Game/HotUpdate/Views/RoleInfo/PersonalPhotoView.cs
  11. 8 1
      GameClient/Assets/Game/HotUpdate/Views/Travel/TravelRewardView.cs
  12. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0!a.png
  13. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0.png
  14. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_1!a.png
  15. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_1.png
  16. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_2!a.png
  17. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_2.png
  18. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_3.png
  19. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_4!a.png
  20. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_4.png
  21. 二進制
      GameClient/Assets/ResIn/UI/Poem/Poem_fui.bytes
  22. 二進制
      GameClient/Assets/ResIn/UI/Travel/Travel_fui.bytes

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Travel/UI_TravelRewardUI.cs

@@ -7,6 +7,7 @@ namespace UI.Travel
     public partial class UI_TravelRewardUI
     {
         public GComponent target;
+        public GGraph m_mask;
         public UI_ComPostcard m_comPostCard;
         public GList m_list;
         public GButton m_btnGet;
@@ -60,6 +61,7 @@ namespace UI.Travel
 
         private void Init(GComponent comp)
         {
+            m_mask = (GGraph)comp.GetChild("mask");
             m_comPostCard = (UI_ComPostcard)UI_ComPostcard.Create(comp.GetChild("comPostCard"));
             m_list = (GList)comp.GetChild("list");
             m_btnGet = (GButton)comp.GetChild("btnGet");
@@ -69,6 +71,7 @@ namespace UI.Travel
         }
         public void Dispose(bool disposeTarget = false)
         {
+            m_mask = null;
             m_comPostCard.Dispose();
             m_comPostCard = null;
             m_list = null;

+ 0 - 71
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_Button7.cs

@@ -1,71 +0,0 @@
-/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
-
-using FairyGUI;
-
-namespace UI.Poem
-{
-    public partial class UI_Button7
-    {
-        public GButton target;
-        public GTextField m_txtTitle;
-        public const string URL = "ui://iyz778gkuyux103";
-        public const string PACKAGE_NAME = "Poem";
-        public const string RES_NAME = "Button7";
-        private static UI_Button7 _proxy;
-
-        public static UI_Button7 Create(GObject gObject = null)
-        {
-            var ui = new UI_Button7();
-            if(gObject == null)
-            	ui.target =  (GButton)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
-            else
-            	ui.target =  (GButton)gObject;
-            ui.Init(ui.target);
-            return ui;
-        }
-
-        public static UI_Button7 Proxy(GObject gObject = null)
-        {
-            if(_proxy == null)
-            {
-                _proxy = new UI_Button7();
-            }
-            var ui = _proxy;
-            if(gObject == null)
-            	ui.target =  (GButton)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
-            else
-            	ui.target =  (GButton)gObject;
-            ui.Init(ui.target);
-            return ui;
-        }
-
-        public static void ProxyEnd()
-        {
-            if (_proxy != null)
-            {
-                _proxy.Dispose();
-            }
-        }
-
-        public static void ClearProxy()
-        {
-            ProxyEnd();
-            _proxy = null;
-        }
-
-        private void Init(GComponent comp)
-        {
-            m_txtTitle = (GTextField)comp.GetChild("txtTitle");
-        }
-        public void Dispose(bool disposeTarget = false)
-        {
-            m_txtTitle = null;
-            if(disposeTarget && target != null)
-            {
-                target.RemoveFromParent();
-                target.Dispose();
-            }
-            target = null;
-        }
-    }
-}

+ 88 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_PoemPhotoSaveUI.cs

@@ -0,0 +1,88 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.Poem
+{
+    public partial class UI_PoemPhotoSaveUI
+    {
+        public GComponent target;
+        public Controller m_c1;
+        public GGraph m_grhBg;
+        public UI_ListPhotoPreviewItem m_personalPhoto;
+        public GGraph m_saveImg;
+        public GProgressBar m_progress;
+        public UI_ComPostcard m_travelPhoto;
+        public const string URL = "ui://iyz778gkdns3tl5";
+        public const string PACKAGE_NAME = "Poem";
+        public const string RES_NAME = "PoemPhotoSaveUI";
+        private static UI_PoemPhotoSaveUI _proxy;
+
+        public static UI_PoemPhotoSaveUI Create(GObject gObject = null)
+        {
+            var ui = new UI_PoemPhotoSaveUI();
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static UI_PoemPhotoSaveUI Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_PoemPhotoSaveUI();
+            }
+            var ui = _proxy;
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static void ProxyEnd()
+        {
+            if (_proxy != null)
+            {
+                _proxy.Dispose();
+            }
+        }
+
+        public static void ClearProxy()
+        {
+            ProxyEnd();
+            _proxy = null;
+        }
+
+        private void Init(GComponent comp)
+        {
+            m_c1 = comp.GetController("c1");
+            m_grhBg = (GGraph)comp.GetChild("grhBg");
+            m_personalPhoto = (UI_ListPhotoPreviewItem)UI_ListPhotoPreviewItem.Create(comp.GetChild("personalPhoto"));
+            m_saveImg = (GGraph)comp.GetChild("saveImg");
+            m_progress = (GProgressBar)comp.GetChild("progress");
+            m_travelPhoto = (UI_ComPostcard)UI_ComPostcard.Create(comp.GetChild("travelPhoto"));
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_c1 = null;
+            m_grhBg = null;
+            m_personalPhoto.Dispose();
+            m_personalPhoto = null;
+            m_saveImg = null;
+            m_progress = null;
+            m_travelPhoto.Dispose();
+            m_travelPhoto = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

+ 1 - 1
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_Button7.cs.meta → GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_PoemPhotoSaveUI.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 5580fab9c66fa04439feef5e49193383
+guid: a5156e9dee7fe0246bd965fd76a009f8
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 17 - 9
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/poem/UI_PoemPhotoUI.cs

@@ -15,10 +15,13 @@ namespace UI.Poem
         public GList m_listTravel;
         public GLoader m_icon;
         public GList m_typeList;
-        public UI_Button7 m_btnConfirmDelete;
-        public GButton m_btnRule;
-        public GTextField m_txtCount;
+        public GButton m_btnConfirmDelete;
+        public GButton m_btnConfirmSave;
         public GButton m_btnDelete;
+        public GButton m_btnSave;
+        public GTextField m_txtCount;
+        public GButton m_btnChooseAll;
+        public GButton m_btnRule;
         public const string URL = "ui://iyz778gkv4825";
         public const string PACKAGE_NAME = "Poem";
         public const string RES_NAME = "PoemPhotoUI";
@@ -74,10 +77,13 @@ namespace UI.Poem
             m_listTravel = (GList)comp.GetChild("listTravel");
             m_icon = (GLoader)comp.GetChild("icon");
             m_typeList = (GList)comp.GetChild("typeList");
-            m_btnConfirmDelete = (UI_Button7)UI_Button7.Create(comp.GetChild("btnConfirmDelete"));
-            m_btnRule = (GButton)comp.GetChild("btnRule");
-            m_txtCount = (GTextField)comp.GetChild("txtCount");
+            m_btnConfirmDelete = (GButton)comp.GetChild("btnConfirmDelete");
+            m_btnConfirmSave = (GButton)comp.GetChild("btnConfirmSave");
             m_btnDelete = (GButton)comp.GetChild("btnDelete");
+            m_btnSave = (GButton)comp.GetChild("btnSave");
+            m_txtCount = (GTextField)comp.GetChild("txtCount");
+            m_btnChooseAll = (GButton)comp.GetChild("btnChooseAll");
+            m_btnRule = (GButton)comp.GetChild("btnRule");
         }
         public void Dispose(bool disposeTarget = false)
         {
@@ -89,11 +95,13 @@ namespace UI.Poem
             m_listTravel = null;
             m_icon = null;
             m_typeList = null;
-            m_btnConfirmDelete.Dispose();
             m_btnConfirmDelete = null;
-            m_btnRule = null;
-            m_txtCount = null;
+            m_btnConfirmSave = null;
             m_btnDelete = null;
+            m_btnSave = null;
+            m_txtCount = null;
+            m_btnChooseAll = null;
+            m_btnRule = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 4 - 4
GameClient/Assets/Game/HotUpdate/Views/ActivityGetYuanXiao/ActivityGetYuanXiaoView.cs

@@ -237,7 +237,7 @@ namespace GFGGame
             _ui.m_catcher.target.visible = true;
             _ui.m_catcher.target.draggable = true;
             //_ui.m_catcher.target.dragBounds = new Rect(-_ui.m_catcher.target.width / 2, _ui.m_catcher.target.y, Stage.inst.width + _ui.m_catcher.target.width, 0);
-            Vector2 dragLeftPos = _ui.m_startLeft.LocalToGlobal(Vector2.zero)/(UIContentScaler.scaleFactor);
+            Vector2 dragLeftPos = _ui.m_startLeft.LocalToGlobal(Vector2.zero) / (UIContentScaler.scaleFactor);
             Vector2 dragRightPos = _ui.m_startRight.LocalToGlobal(Vector2.zero) / (UIContentScaler.scaleFactor);
 
 
@@ -272,7 +272,7 @@ namespace GFGGame
 
             _ui.m_time.text = TimeUtil.FormattingTimeTo_mmss(_countTime * 1000);
             --_countTime;
-                
+
             if (_countTime < 0)
             {
                 Timers.inst.Remove(UpdateTime);
@@ -397,7 +397,7 @@ namespace GFGGame
                 }
             }
 
-            if(_ui.m_catcher.target.visible)
+            if (_ui.m_catcher.target.visible)
             {
                 GameEnd(true);
             }
@@ -491,7 +491,7 @@ namespace GFGGame
                 return;
             }
             _timer += Time.deltaTime * 1000;
-            if(_timer >= _cfg.dropTime)
+            if (_timer >= _cfg.dropTime)
             {
                 CreateItems(null);
                 _timer = 0;

+ 202 - 0
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoSaveView.cs

@@ -0,0 +1,202 @@
+using System.Collections;
+using UnityEngine;
+using UI.Poem;
+using System.Collections.Generic;
+using ET;
+using FairyGUI;
+using System.Threading.Tasks;
+
+namespace GFGGame
+{
+    public class PoemPhotoSaveView : BaseWindow
+    {
+        private UI_PoemPhotoSaveUI _ui;
+        private int curIndex;
+        private bool saveFinished;
+        private bool captureFinished;
+        private byte[] byteArr;
+
+        public override void Dispose()
+        {
+            if(_ui != null)
+            {
+                _ui.Dispose();
+                _ui = null;
+            }
+
+            base.Dispose();
+        }
+
+        protected override void OnInit()
+        {
+            base.OnInit();
+
+            packageName = UI_PoemPhotoSaveUI.PACKAGE_NAME;
+            _ui = UI_PoemPhotoSaveUI.Create();
+            viewCom = _ui.target;
+            isfullScreen = true;
+            this.modal = false;
+            clickBlankToClose = false;
+        }
+
+        protected override void OnShown()
+        {
+            base.OnShown();
+
+            SavePhotoList savePhoto = (SavePhotoList)viewData;
+            _ui.m_c1.selectedIndex = savePhoto.pageIndex;
+            UpdateProgress(0, savePhoto.listChoose.Count);
+            RefreshUI(savePhoto);
+        }
+
+        protected override void OnHide()
+        {
+            base.OnHide();
+            ResetData();
+        }
+
+        private void ResetData()
+        {
+            curIndex = 0;
+            byteArr = null;
+            saveFinished = false;
+            captureFinished = false;
+        }
+
+        private async void RefreshUI(SavePhotoList savePhoto)
+        {
+            for(int i = 0; i < savePhoto.listChoose.Count; i++)
+            {
+                int index = GetPhotoListIndex(savePhoto.photoInfos, savePhoto.listChoose[i]);
+
+                byte[] bytes = null;
+                if (_ui.m_c1.selectedIndex == 0)
+                {
+                    RefreshPhoto(savePhoto.photoInfos[index]);
+                    bytes = savePhoto.photoInfos[index].Bytes;
+                }
+                else
+                {
+                    RefreshTravelPhoto(savePhoto.photoInfos[i]);
+                    captureFinished = false;
+                    Timers.inst.StartCoroutine(CaptureByUI());
+                    while (!captureFinished)
+                    {
+                        await Task.Delay(17);
+                    }
+                    bytes = byteArr;
+                }
+
+                saveFinished = false;
+                SavePhoto(bytes);
+                while (!saveFinished)
+                {
+                    await Task.Delay(17);
+                }
+
+                ++curIndex;
+                UpdateProgress(curIndex, savePhoto.listChoose.Count);
+                if (curIndex == savePhoto.listChoose.Count)
+                {
+                    PromptController.Instance.ShowFloatTextPrompt("已全部保存至相册!");
+                    Hide();
+                }
+            }
+
+        }
+
+        private int GetPhotoListIndex(List<PoemPhotoData> photoInfos, long pictureID)
+        {
+            for (int i = 0; i < photoInfos.Count; i++)
+            {
+                if (photoInfos[i].PictureId == pictureID)
+                {
+                    return i;
+                }
+            }
+            return -1;
+        }
+
+        private void UpdateProgress(int cur, int max)
+        {
+            _ui.m_progress.value = cur;
+            _ui.m_progress.max = max;
+        }
+
+        private void RefreshPhoto(PoemPhotoData data)
+        {
+            UI_ListPhotoPreviewItem item = UI_ListPhotoPreviewItem.Proxy(_ui.m_personalPhoto.target);
+
+            item.m_comPhoto.m_loaPhoto.texture = data.Ntexture;
+            UI_ListPhotoPreviewItem.ProxyEnd();
+        }
+
+        private void RefreshTravelPhoto(PoemPhotoData data)
+        {
+            UI_ComPostcard item = UI_ComPostcard.Proxy(_ui.m_travelPhoto.target);
+
+            PoemPhotoData photoData = data;
+            TravelLoactionCfg loactionCfg = TravelLoactionCfgArray.Instance.GetCfg(photoData.TravelLocationId);
+
+            item.m_comTravel.m_loaBg.url = ResPathUtil.GetTravelBgPath(loactionCfg.res);
+            item.m_txtLocationName.text = loactionCfg.name;
+            item.m_txtTime.text = TimeUtil.FormattingTimeTo_yyyMMdd1(photoData.CreationTime);
+            item.m_comTravel.m_loaRole.url = "";
+            if (photoData.TravelSuitId > 0)
+            {
+                TravelSuitCfg travelSuitCfg = TravelSuitCfgArray.Instance.GetCfg(photoData.TravelSuitId);
+                item.m_comTravel.m_loaRole.url = ResPathUtil.GetTravelRolePath(travelSuitCfg.reourcesArr[photoData.SuitResIndex]);
+                item.m_comTravel.m_loaRole.SetXY(loactionCfg.positionsArr[photoData.PositionIndex][0], loactionCfg.positionsArr[photoData.PositionIndex][1]);
+            }
+
+            UI_ComPostcard.ProxyEnd();
+        }
+
+        private IEnumerator CaptureByUI()
+        {
+            //等待帧画面渲染结束
+            yield return new WaitForEndOfFrame();
+
+            int width = (int)(_ui.m_saveImg.width * UIContentScaler.scaleFactor);
+            int height = (int)(_ui.m_saveImg.height * UIContentScaler.scaleFactor);
+
+            Vector2 pos = _ui.m_saveImg.LocalToGlobal(Vector2.zero);
+            pos.y = Screen.height - pos.y - height;
+
+            Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false);
+            //从屏幕读取像素, leftBtmX/leftBtnY 是读取的初始位置,width、height是读取像素的宽度和高度
+            tex.ReadPixels(new Rect(pos.x, pos.y, width, height), 0, 0);
+            //执行读取操作
+            tex.Apply();
+            byte[] bytes = tex.EncodeToPNG();
+
+            captureFinished = true;
+            byteArr = bytes;
+        }
+
+        private void SavePhoto(byte[] bytes)
+        {
+#if UNITY_EDITOR
+            // pc端保存
+            string path = Application.dataPath + "/StreamingAssets/" + TimeHelper.ServerNowSecs + curIndex + ".png";
+            System.IO.File.WriteAllBytes(path, bytes);
+            Debug.Log("the photo saved in:" + path);
+            saveFinished = true;
+#else
+            // 手机端
+            string fileName = "wsj" + TimeHelper.ServerNowSecs + curIndex + ".jpg";
+            NativeGallery.Permission permission = NativeGallery.SaveImageToGallery(bytes, "Wanshijing", fileName, (success, path) =>
+            {
+                if (success)
+                {
+                    saveFinished = true;
+                }
+                else
+                {
+
+                }
+            });
+#endif
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoSaveView.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 12dae7166790ac84ea13211730f2cb49
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 206 - 31
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemPhotoView.cs

@@ -2,17 +2,27 @@ using System.Collections.Generic;
 using ET;
 using FairyGUI;
 using UI.Poem;
+using UnityEngine;
 
 namespace GFGGame
 {
+    public struct SavePhotoList
+    {
+        public int pageIndex;
+        public List<PoemPhotoData> photoInfos;
+        public List<long> listChoose;
+    }
+
     public class PoemPhotoView : BaseWindow
     {
         private UI_PoemPhotoUI _ui;
-        private List<long> _listDelete = new List<long>();
+        private List<long> _listChoose = new List<long>();
+
         private List<PoemPhotoData> _photoInfos;
         private int _sourceType = 0;
 
 
+
         public override void Dispose()
         {
             if (_ui != null)
@@ -42,8 +52,11 @@ namespace GFGGame
 
             _ui.m_btnback.onClick.Add(OnBtnBackClick);
             _ui.m_btnDelete.onClick.Add(OnBtnDeleteClick);
-            _ui.m_btnConfirmDelete.target.onClick.Add(OnBtnConfirmDeleteClick);
+            _ui.m_btnSave.onClick.Add(OnBtnSaveClick);
+            _ui.m_btnConfirmDelete.onClick.Add(OnBtnConfirmDeleteClick);
             _ui.m_c1.onChanged.Add(OnBtnTabChange);
+            _ui.m_btnChooseAll.onClick.Add(OnClickBtnChooseAll);
+            _ui.m_btnConfirmSave.onClick.Add(OnClickConfirmSave);
 
             InitTypeList();
         }
@@ -56,7 +69,7 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            if(this.viewData != null)
+            if (this.viewData != null)
             {
                 _ui.m_c1.selectedIndex = (int)this.viewData;
             }
@@ -70,7 +83,7 @@ namespace GFGGame
         {
             base.OnHide();
             _ui.m_c2.selectedIndex = 0;
-            _listDelete.Clear();
+            _listChoose.Clear();
             Timers.inst.Remove(CheckGuide);
         }
 
@@ -97,23 +110,40 @@ namespace GFGGame
         }
         private void OnBtnDeleteClick()
         {
-            if (_ui.m_c1.selectedIndex == 0 && _ui.m_list.numItems == 0)
+            if (_ui.m_c1.selectedIndex == 0 && GetEnablePhotoNum(true) == 0)
             {
                 PromptController.Instance.ShowFloatTextPrompt("暂无照片可删除");
                 return;
             }
-            if (_ui.m_c1.selectedIndex == 1 && _ui.m_listTravel.numItems == 0)
+            if (_ui.m_c1.selectedIndex == 1 && GetEnablePhotoNum(true) == 0)
             {
                 PromptController.Instance.ShowFloatTextPrompt("暂无明信片可删除");
                 return;
             }
             _ui.m_c2.selectedIndex = 1;
+            _ui.m_btnChooseAll.selected = false;
+        }
+
+        private void OnBtnSaveClick()
+        {
+            if (_ui.m_c1.selectedIndex == 0 && _photoInfos.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("暂无照片可保存");
+                return;
+            }
+            if (_ui.m_c1.selectedIndex == 1 && _photoInfos.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("暂无明信片可保存");
+                return;
+            }
+            _ui.m_c2.selectedIndex = 2;
+            _ui.m_btnChooseAll.selected = false;
         }
 
         private void OnBtnTabChange()
         {
             _ui.m_c2.selectedIndex = 0;
-            _listDelete.Clear();
+            _listChoose.Clear();
             UpdateView();
 
         }
@@ -138,14 +168,16 @@ namespace GFGGame
                 _ui.m_txtCount.text = string.Format("{0}/{1}", _photoInfos.Count, RoleDataManager.WanShuiQianShanMaxStorageCount);
             }
 
-           
-            _ui.m_btnConfirmDelete.m_txtTitle.text = string.Format("删除 {0}/{1}", _listDelete.Count, _photoInfos.Count);
+
+            _ui.m_btnConfirmDelete.title = string.Format("删除 {0}/{1}", _listChoose.Count, _photoInfos.Count);
+            _ui.m_btnConfirmSave.title = string.Format("保存 {0}/{1}", _listChoose.Count, _photoInfos.Count);
+
         }
 
         private void RenderListItem(int index, GObject obj)
         {
             UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
-            if (_ui.m_c2.selectedIndex == 1 && _listDelete.IndexOf(_photoInfos[index].PictureId) >= 0)
+            if (_ui.m_c2.selectedIndex != 0 && _listChoose.IndexOf(_photoInfos[index].PictureId) >= 0)
             {
                 item.m_c1.SetSelectedIndex(1);
             }
@@ -193,7 +225,7 @@ namespace GFGGame
 
             UI_ComPhotoPostcard item = UI_ComPhotoPostcard.Proxy(obj);
 
-            item.m_c1.selectedIndex = _ui.m_c2.selectedIndex == 1 && _listDelete.IndexOf(_photoInfos[index].PictureId) >= 0 ? 1 : 0;
+            item.m_c1.selectedIndex = _ui.m_c2.selectedIndex != 0 && _listChoose.IndexOf(_photoInfos[index].PictureId) >= 0 ? 1 : 0;
             item.m_comTravel.m_loaBg.url = ResPathUtil.GetTravelBgPath(loactionCfg.res);
             item.m_comTravel.m_loaRole.url = "";
             if (poemPhotoData.TravelSuitId > 0)
@@ -235,36 +267,51 @@ namespace GFGGame
             {
                 ViewManager.Show<PoemPhotoPreView>(new object[] { index, _photoInfos, _sourceType });
             }
-            else if (_ui.m_c2.selectedIndex == 1)
+            else
             {
-                if (photoData.LockingStatus)
+                if (_ui.m_c2.selectedIndex == 1)
                 {
-                    PromptController.Instance.ShowFloatTextPrompt("锁定的照片无法删除");
-                    return;
-                }
-                if (photoData.ToppingStatus)
-                {
-                    PromptController.Instance.ShowFloatTextPrompt("置顶的照片无法删除");
-                    return;
+                    if (photoData.LockingStatus)
+                    {
+                        PromptController.Instance.ShowFloatTextPrompt("锁定的照片无法删除");
+                        return;
+                    }
+                    if (photoData.ToppingStatus)
+                    {
+                        PromptController.Instance.ShowFloatTextPrompt("置顶的照片无法删除");
+                        return;
+                    }
                 }
+
                 UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj.parent);
 
                 item.m_c1.selectedIndex ^= 1;
                 if (item.m_c1.selectedIndex == 1)
                 {
-                    _listDelete.Add(photoData.PictureId);
+                    _listChoose.Add(photoData.PictureId);
                 }
                 else
                 {
-                    _listDelete.Remove(photoData.PictureId);
+                    _listChoose.Remove(photoData.PictureId);
                 }
                 UI_ListPhotoItem.ProxyEnd();
-                _ui.m_btnConfirmDelete.m_txtTitle.text = string.Format("删除({0}/{1})", _listDelete.Count, _photoInfos.Count);
+
+                if (_ui.m_c2.selectedIndex == 1)
+                {
+                    _ui.m_btnConfirmDelete.title = string.Format("删除({0}/{1})", _listChoose.Count, _photoInfos.Count);
+                    _ui.m_btnChooseAll.selected = (GetEnablePhotoNum(true) == _listChoose.Count);
+                }
+                else if (_ui.m_c2.selectedIndex == 2)
+                {
+                    _ui.m_btnConfirmSave.title = string.Format("保存({0}/{1})", _listChoose.Count, _photoInfos.Count);
+                    _ui.m_btnChooseAll.selected = (GetEnablePhotoNum(false) == _listChoose.Count);
+                }
+
             }
         }
         private void OnBtnConfirmDeleteClick()
         {
-            if (_listDelete.Count == 0)
+            if (_listChoose.Count == 0)
             {
                 PromptController.Instance.ShowFloatTextPrompt("请选择要删除的照片");
                 return;
@@ -272,10 +319,10 @@ namespace GFGGame
             AlertUI.Show("删除后的照片无法恢复,是否确认删除?")
             .SetLeftButton(true, "否").SetRightButton(true, "是", async (object data) =>
             {
-                bool result = await PoemPhotoSProxy.ReqRemovedPhoto(_listDelete, _sourceType);
+                bool result = await PoemPhotoSProxy.ReqRemovedPhoto(_listChoose, _sourceType);
                 if (result)
                 {
-                    _listDelete.Clear();
+                    _listChoose.Clear();
                     OnBtnTabChange();
                 }
             });
@@ -283,9 +330,9 @@ namespace GFGGame
 
         private void OnBtnLockClick(EventContext context)
         {
-            if (_ui.m_c2.selectedIndex == 1)
+            if (_ui.m_c2.selectedIndex != 0)
             {
-                PromptController.Instance.ShowFloatTextPrompt("删除状态无法操作");
+                //PromptController.Instance.ShowFloatTextPrompt("删除状态无法操作");
                 return;
             }
             GObject item = context.sender as GObject;
@@ -314,9 +361,9 @@ namespace GFGGame
 
         private void OnBtnUpClick(EventContext context)
         {
-            if (_ui.m_c2.selectedIndex == 1)
+            if (_ui.m_c2.selectedIndex != 0)
             {
-                PromptController.Instance.ShowFloatTextPrompt("删除状态无法操作");
+                //PromptController.Instance.ShowFloatTextPrompt("删除状态无法操作");
                 return;
             }
             GObject item = context.sender as GObject;
@@ -364,12 +411,140 @@ namespace GFGGame
         /// </summary>
         private void InitTypeList()
         {
-            for(int i = 0; i < _ui.m_typeList.numChildren; i++)
+            for (int i = 0; i < _ui.m_typeList.numChildren; i++)
             {
                 UI_Button6 button6 = UI_Button6.Proxy(_ui.m_typeList.GetChildAt(i));
                 button6.m_title1.text = button6.target.title;
                 UI_Button6.ProxyEnd();
             }
         }
+
+        /// <summary>
+        /// 获取当前相册可操作的相片数量
+        /// </summary>
+        /// <param name="delete">为true时跳过锁住的和置顶的相片</param>
+        /// <returns></returns>
+        private int GetEnablePhotoNum(bool delete)
+        {
+            int num = 0;
+            for (int i = 0; i < _photoInfos.Count; i++)
+            {
+                PoemPhotoData photoData = _photoInfos[i];
+
+                if (delete && (photoData.LockingStatus || photoData.ToppingStatus))
+                {
+                    continue;
+                }
+
+                ++num;
+            }
+
+            return num;
+        }
+
+        private void OnClickBtnChooseAll()
+        {
+            _listChoose.Clear();
+
+            GList list = ((_ui.m_c1.selectedIndex == 0) ? _ui.m_list : _ui.m_listTravel);
+            for (int i = 0; i < _photoInfos.Count; i++)
+            {
+                PoemPhotoData photoData = _photoInfos[i];
+
+                // 删除全选时不选择 置顶或者锁住 的照片
+                if (_ui.m_c2.selectedIndex == 1 && (photoData.LockingStatus || photoData.ToppingStatus))
+                {
+                    continue;
+                }
+
+                if (_ui.m_btnChooseAll.selected)
+                {
+                    _listChoose.Add(photoData.PictureId);
+                }
+            }
+
+            list.numItems = _photoInfos.Count;
+            if (_ui.m_c2.selectedIndex == 1)
+            {
+                _ui.m_btnConfirmDelete.title = string.Format("删除({0}/{1})", _listChoose.Count, _photoInfos.Count);
+            }
+            else if (_ui.m_c2.selectedIndex == 2)
+            {
+                _ui.m_btnConfirmSave.title = string.Format("保存({0}/{1})", _listChoose.Count, _photoInfos.Count);
+            }
+        }
+
+        private void OnClickConfirmSave()
+        {
+            if (_listChoose.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("请选择要保存的照片");
+                return;
+            }
+
+#if UNITY_EDITOR
+            OpenSaveView();
+#else
+            CheckSaveLocal();
+#endif
+        }
+
+        /// <summary>
+        /// 检查保存相片相应权限
+        /// </summary>
+        private async void CheckSaveLocal()
+        {
+            string permissionName = "存储";
+#if UNITY_IOS
+            permissionName = "相册";
+#endif
+            NativeGallery.Permission permission = NativeGallery.CheckPermission(NativeGallery.PermissionType.Write, NativeGallery.MediaType.Image);
+            Debug.Log("Permission result: " + permission);
+
+            if (permission.Equals(NativeGallery.Permission.Denied))
+            {
+                string tips = $"保存至本地需要使用{permissionName}权限,您已经禁止!请前往手机系统设置开启应用的{permissionName}权限。";
+                if (NativeGallery.CanOpenSettings())
+                {
+                    AlertSystem.Show(tips)
+                                .SetLeftButton(true, "前往", (data) => { NativeGallery.OpenSettings(); })
+                                .SetRightButton(true, "拒绝");
+                }
+                else
+                {
+                    AlertSystem.Show(tips)
+                            .SetLeftButton(true, "知道了");
+                }
+            }
+            else
+            {
+                if (permission.Equals(NativeGallery.Permission.ShouldAsk))
+                {
+                    string tips = $"保存至本地需要使用{permissionName}权限,请同意!";
+                    PromptController.Instance.ShowFloatTextPrompt(tips);
+                    permission = await NativeGallery.RequestPermissionAsync(NativeGallery.PermissionType.Write, NativeGallery.MediaType.Image);
+                    //Debug.Log("Permission result: " + permission);
+                    if (!permission.Equals(NativeGallery.Permission.Granted))
+                    {
+                        PromptController.Instance.ShowFloatTextPrompt($"由于被禁止{permissionName}权限,保存失败!");
+                        return;
+                    }
+                }
+
+                //Debug.Log("Permission result: " + permission);
+            }
+
+            OpenSaveView();
+        }
+
+        private void OpenSaveView()
+        {
+            SavePhotoList savePhoto = new SavePhotoList();
+            savePhoto.pageIndex = _ui.m_c1.selectedIndex;
+            savePhoto.photoInfos = _photoInfos;
+            savePhoto.listChoose = _listChoose;
+
+            ViewManager.Show<PoemPhotoSaveView>(savePhoto);
+        }
     }
 }

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

@@ -1,5 +1,6 @@
 using UI.RoleInfo;
 using FairyGUI;
+using System.Collections.Generic;
 
 namespace GFGGame
 {
@@ -82,27 +83,17 @@ namespace GFGGame
             UI_ListPhotoItemDetail.ProxyEnd();
 
         }
+
         private async void OnListItemClick(EventContext context)
         {
             GObject obj = context.data as GObject;
             long selectPictureId = (long)obj.data;
+            UpdatePhotoData();
             if (selectPictureId == _showPictureId)//删除:点击相同id照片
             {
                 RoleDataManager.photoDatas[_showIndex] = 0;
 
-                // 将空位移动到后面
-                for (int i = _showIndex; i < RoleDataManager.photoDatas.Count - 1; i++)
-                {
-                    if (RoleDataManager.photoDatas[i + 1] == 0)
-                    {
-                        break;
-                    }
-                    else
-                    {
-                        RoleDataManager.photoDatas[i] = RoleDataManager.photoDatas[i + 1];
-                        RoleDataManager.photoDatas[i + 1] = 0;
-                    }
-                }
+                UpdatePhotoData();
             }
             else
             {
@@ -142,5 +133,35 @@ namespace GFGGame
                 Hide();
             }
         }
+
+        private void UpdatePhotoData()
+        {
+            List<long> numArr = new List<long>();
+            // 提取有数据的位置
+            for(int i=0;i< RoleDataManager.photoDatas.Count; i++)
+            {
+                if (RoleDataManager.photoDatas[i] != 0)
+                {
+                    numArr.Add(RoleDataManager.photoDatas[i]);
+                }
+            }
+
+            // 找到可用空位赋值
+            int index = 0;
+            for (int i = 0; i < RoleDataManager.photoDatas.Count; i++)
+            {
+                if (RoleInfoManager.GetPosType(i) == MonthCardType.Gold && !RoleDataManager.CheckIsMonthCardOpenByType(MonthCardType.Gold)
+|| RoleInfoManager.GetPosType(i) == MonthCardType.BlackGold && !RoleDataManager.CheckIsMonthCardOpenByType(MonthCardType.BlackGold))
+                {
+                    RoleDataManager.photoDatas[i] = -1;
+                    continue;
+                }
+
+                if (index < numArr.Count)
+                {
+                    RoleDataManager.photoDatas[i] = numArr[index++];
+                }
+            }
+        }
     }
 }

+ 8 - 1
GameClient/Assets/Game/HotUpdate/Views/Travel/TravelRewardView.cs

@@ -6,7 +6,7 @@ using UnityEngine;
 
 namespace GFGGame
 {
-    public class TravelRewardView : BaseWindow
+    public class TravelRewardView :BaseWindow
     {
         private UI_TravelRewardUI _ui;
 
@@ -33,6 +33,8 @@ namespace GFGGame
             _ui.m_list.onClickItem.Add(OnListItemClick);
 
             _ui.m_btnGet.onClick.Add(OnBtnGetClick);
+            _ui.m_mask.onClick.Add(OnClickBtnMask);
+
         }
         protected override void AddEventListener()
         {
@@ -105,5 +107,10 @@ namespace GFGGame
             }
         }
 
+        private void OnClickBtnMask()
+        {
+            Hide();
+        }
+
     }
 }

二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0!a.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_1!a.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_1.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_2!a.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_2.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_3.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_4!a.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0_4.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_fui.bytes


二進制
GameClient/Assets/ResIn/UI/Travel/Travel_fui.bytes