Explorar o código

更新UI适配,完成部分置顶图片不受UI下移的影响

leiyasi hai 1 ano
pai
achega
4d72d235cc
Modificáronse 23 ficheiros con 92 adicións e 27 borrados
  1. 3 3
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ActivityAfternoonTea/UI_ActivityTeaMainUI.cs
  2. 6 3
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ActivityDay7/UI_ActivityDay7UI.cs
  3. 3 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Bag/UI_BagUI.cs
  4. 3 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ClothingDecompose/UI_ClothingDecomposeUI.cs
  5. 3 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/FieldGuide/UI_CardGuideUI.cs
  6. 3 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/FieldGuide/UI_DressUpGuideUI.cs
  7. 3 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/RoleInfo/UI_RoleInfoUI.cs
  8. 3 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Task/UI_TaskUI.cs
  9. 3 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Travel/UI_TravelRewardUI.cs
  10. 8 2
      GameClient/Assets/Game/HotUpdate/Views/Notice/NoticeView.cs
  11. 30 15
      GameClient/Assets/Game/HotUpdate/Views/UIView.cs
  12. 13 1
      GameClient/Assets/Game/HotUpdate/Views/ViewGlobal.cs
  13. BIN=BIN
      GameClient/Assets/ResIn/UI/ActivityAfternoonTea/ActivityAfternoonTea_fui.bytes
  14. BIN=BIN
      GameClient/Assets/ResIn/UI/ActivityDay7/ActivityDay7_fui.bytes
  15. BIN=BIN
      GameClient/Assets/ResIn/UI/Bag/Bag_fui.bytes
  16. BIN=BIN
      GameClient/Assets/ResIn/UI/ClothingDecompose/ClothingDecompose_fui.bytes
  17. BIN=BIN
      GameClient/Assets/ResIn/UI/FieldGuide/FieldGuide_fui.bytes
  18. BIN=BIN
      GameClient/Assets/ResIn/UI/RoleInfo/RoleInfo_fui.bytes
  19. BIN=BIN
      GameClient/Assets/ResIn/UI/Task/Task_fui.bytes
  20. BIN=BIN
      GameClient/Assets/ResIn/UI/Travel/Travel_fui.bytes
  21. 1 0
      GameClient/Packages/manifest.json
  22. 7 0
      GameClient/Packages/packages-lock.json
  23. 3 3
      GameClient/ProjectSettings/PackageManagerSettings.asset

+ 3 - 3
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ActivityAfternoonTea/UI_ActivityTeaMainUI.cs

@@ -7,7 +7,7 @@ namespace UI.ActivityAfternoonTea
     public partial class UI_ActivityTeaMainUI
     {
         public GComponent target;
-        public GLoader m_Bg;
+        public GLoader m_Top_img;
         public GButton m_btnBack;
         public GLoader m_titleBg;
         public GLoader m_oneTimeIcon;
@@ -67,7 +67,7 @@ namespace UI.ActivityAfternoonTea
 
         private void Init(GComponent comp)
         {
-            m_Bg = (GLoader)comp.GetChild("Bg");
+            m_Top_img = (GLoader)comp.GetChild("Top_img");
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_titleBg = (GLoader)comp.GetChild("titleBg");
             m_oneTimeIcon = (GLoader)comp.GetChild("oneTimeIcon");
@@ -83,7 +83,7 @@ namespace UI.ActivityAfternoonTea
         }
         public void Dispose(bool disposeTarget = false)
         {
-            m_Bg = null;
+            m_Top_img = null;
             m_btnBack = null;
             m_titleBg = null;
             m_oneTimeIcon = null;

+ 6 - 3
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ActivityDay7/UI_ActivityDay7UI.cs

@@ -7,7 +7,8 @@ namespace UI.ActivityDay7
     public partial class UI_ActivityDay7UI
     {
         public GComponent target;
-        public GLoader m_loaBg;
+        public GLoader m_Top_img1;
+        public GLoader m_Top_img2;
         public GButton m_btnBack;
         public GTextField m_TimeStr;
         public GButton m_tip;
@@ -65,7 +66,8 @@ namespace UI.ActivityDay7
 
         private void Init(GComponent comp)
         {
-            m_loaBg = (GLoader)comp.GetChild("loaBg");
+            m_Top_img1 = (GLoader)comp.GetChild("Top_img1");
+            m_Top_img2 = (GLoader)comp.GetChild("Top_img2");
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_TimeStr = (GTextField)comp.GetChild("TimeStr");
             m_tip = (GButton)comp.GetChild("tip");
@@ -79,7 +81,8 @@ namespace UI.ActivityDay7
         }
         public void Dispose(bool disposeTarget = false)
         {
-            m_loaBg = null;
+            m_Top_img1 = null;
+            m_Top_img2 = null;
             m_btnBack = null;
             m_TimeStr = null;
             m_tip = null;

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Bag/UI_BagUI.cs

@@ -8,6 +8,7 @@ namespace UI.Bag
     {
         public GComponent target;
         public GLoader m_loaBg;
+        public GLoader m_Top_img;
         public GComponent m_comValueBar;
         public GList m_list;
         public GButton m_btnBack;
@@ -60,6 +61,7 @@ namespace UI.Bag
         private void Init(GComponent comp)
         {
             m_loaBg = (GLoader)comp.GetChild("loaBg");
+            m_Top_img = (GLoader)comp.GetChild("Top_img");
             m_comValueBar = (GComponent)comp.GetChild("comValueBar");
             m_list = (GList)comp.GetChild("list");
             m_btnBack = (GButton)comp.GetChild("btnBack");
@@ -68,6 +70,7 @@ namespace UI.Bag
         public void Dispose(bool disposeTarget = false)
         {
             m_loaBg = null;
+            m_Top_img = null;
             m_comValueBar = null;
             m_list = null;
             m_btnBack = null;

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ClothingDecompose/UI_ClothingDecomposeUI.cs

@@ -10,6 +10,7 @@ namespace UI.ClothingDecompose
         public Controller m_c1;
         public Controller m_TouchSelect;
         public GLoader m_bg;
+        public GLoader m_Top_img;
         public UI_Button6 m_btnClothing;
         public UI_Button6 m_btnSkillBook;
         public GComponent m_valueBar;
@@ -74,6 +75,7 @@ namespace UI.ClothingDecompose
             m_c1 = comp.GetController("c1");
             m_TouchSelect = comp.GetController("TouchSelect");
             m_bg = (GLoader)comp.GetChild("bg");
+            m_Top_img = (GLoader)comp.GetChild("Top_img");
             m_btnClothing = (UI_Button6)UI_Button6.Create(comp.GetChild("btnClothing"));
             m_btnSkillBook = (UI_Button6)UI_Button6.Create(comp.GetChild("btnSkillBook"));
             m_valueBar = (GComponent)comp.GetChild("valueBar");
@@ -94,6 +96,7 @@ namespace UI.ClothingDecompose
             m_c1 = null;
             m_TouchSelect = null;
             m_bg = null;
+            m_Top_img = null;
             m_btnClothing.Dispose();
             m_btnClothing = null;
             m_btnSkillBook.Dispose();

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/FieldGuide/UI_CardGuideUI.cs

@@ -8,6 +8,7 @@ namespace UI.FieldGuide
     {
         public GComponent target;
         public GLoader m_loaBg;
+        public GLoader m_Top_img;
         public GButton m_btnBack;
         public GList m_listCard;
         public GList m_listRole;
@@ -62,6 +63,7 @@ namespace UI.FieldGuide
         private void Init(GComponent comp)
         {
             m_loaBg = (GLoader)comp.GetChild("loaBg");
+            m_Top_img = (GLoader)comp.GetChild("Top_img");
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_listCard = (GList)comp.GetChild("listCard");
             m_listRole = (GList)comp.GetChild("listRole");
@@ -72,6 +74,7 @@ namespace UI.FieldGuide
         public void Dispose(bool disposeTarget = false)
         {
             m_loaBg = null;
+            m_Top_img = null;
             m_btnBack = null;
             m_listCard = null;
             m_listRole = null;

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/FieldGuide/UI_DressUpGuideUI.cs

@@ -9,6 +9,7 @@ namespace UI.FieldGuide
         public GComponent target;
         public Controller m_c1;
         public GLoader m_loaBg;
+        public GLoader m_Top_img;
         public GButton m_btnBack;
         public GList m_listType1;
         public GList m_listType2;
@@ -68,6 +69,7 @@ namespace UI.FieldGuide
         {
             m_c1 = comp.GetController("c1");
             m_loaBg = (GLoader)comp.GetChild("loaBg");
+            m_Top_img = (GLoader)comp.GetChild("Top_img");
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_listType1 = (GList)comp.GetChild("listType1");
             m_listType2 = (GList)comp.GetChild("listType2");
@@ -83,6 +85,7 @@ namespace UI.FieldGuide
         {
             m_c1 = null;
             m_loaBg = null;
+            m_Top_img = null;
             m_btnBack = null;
             m_listType1 = null;
             m_listType2 = null;

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

@@ -9,6 +9,7 @@ namespace UI.RoleInfo
         public GComponent target;
         public Controller m_type;
         public GLoader m_loaBg;
+        public GLoader m_Top_img1;
         public GTextField m_txtVersion;
         public GButton m_btnHelp;
         public GButton m_btnBack;
@@ -82,6 +83,7 @@ namespace UI.RoleInfo
         {
             m_type = comp.GetController("type");
             m_loaBg = (GLoader)comp.GetChild("loaBg");
+            m_Top_img1 = (GLoader)comp.GetChild("Top_img1");
             m_txtVersion = (GTextField)comp.GetChild("txtVersion");
             m_btnHelp = (GButton)comp.GetChild("btnHelp");
             m_btnBack = (GButton)comp.GetChild("btnBack");
@@ -111,6 +113,7 @@ namespace UI.RoleInfo
         {
             m_type = null;
             m_loaBg = null;
+            m_Top_img1 = null;
             m_txtVersion = null;
             m_btnHelp = null;
             m_btnBack = null;

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Task/UI_TaskUI.cs

@@ -9,6 +9,7 @@ namespace UI.Task
         public GComponent target;
         public Controller m_c1;
         public GLoader m_loaBg;
+        public GLoader m_Top_img;
         public GButton m_btnBack;
         public GButton m_btnTask;
         public GButton m_btnWeekly;
@@ -63,6 +64,7 @@ namespace UI.Task
         {
             m_c1 = comp.GetController("c1");
             m_loaBg = (GLoader)comp.GetChild("loaBg");
+            m_Top_img = (GLoader)comp.GetChild("Top_img");
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_btnTask = (GButton)comp.GetChild("btnTask");
             m_btnWeekly = (GButton)comp.GetChild("btnWeekly");
@@ -73,6 +75,7 @@ namespace UI.Task
         {
             m_c1 = null;
             m_loaBg = null;
+            m_Top_img = null;
             m_btnBack = null;
             m_btnTask = null;
             m_btnWeekly = null;

+ 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;

+ 8 - 2
GameClient/Assets/Game/HotUpdate/Views/Notice/NoticeView.cs

@@ -161,16 +161,22 @@ namespace GFGGame
 
             if (jumpIndex != 0)
             {
-                //Hide();
                 ViewManager.Show($"GFGGame.{adCfg.jumpId}", jumpIndex, false, false);
+                //Hide();
             }
             else
             {
-                //Hide();
                 ViewManager.Show($"GFGGame.{adCfg.jumpId}", param, false, false);
+                //Hide();
             }
         }
 
+        public override void Refresh()
+        {
+            base.Refresh();
+            Debug.LogError(1);
+        }
+
         /// <summary>
         /// 系统公告 1
         /// </summary>

+ 30 - 15
GameClient/Assets/Game/HotUpdate/Views/UIView.cs

@@ -254,40 +254,55 @@ namespace GFGGame
                 targetWidth = GRoot.inst.width;
             }
 
-            float offsetY = ViewGlobal.GetRealTopOffset();
-
             GameObject uiObj = viewCom.displayObject.gameObject;
 
-            // 处理全屏背景图
-            List<Transform> list = ViewGlobal.FindAllGLoaderInTrans(uiObj.transform);
+            List<GObject> listTopImg = new List<GObject>();
+            float offsetY = ViewGlobal.GetRealTopOffset();
 
+            // 处理全屏显示的背景图/遮罩
+            List<Transform> list = ViewGlobal.FindAllGLoaderInTrans(uiObj.transform);
             for (int i = 0; i < list.Count; i++)
             {
                 GameObject bg = list[i].gameObject;
                 DisplayObjectInfo bgInfo = bg.GetComponent<DisplayObjectInfo>();
                 GObject obj = GRoot.inst.DisplayObjectToGObject(bgInfo.displayObject);
-                
-                if (obj != null && ViewGlobal.IsFullScreenPic(obj.name) && obj.height >= 1920)
+
+                if (obj != null)
                 {
-                    switch (bg.name)
+                    if (ViewGlobal.IsFullScreenPic(obj.name) && obj.height >= 1920)
+                    {
+                        obj.AddRelation(ui, RelationType.Center_Center);
+                        obj.SetSize(1080, 2400);
+                        obj.SetXY(obj.x, obj.y - offsetY / 2);
+                    }
+                    else if (obj.name.Contains("Top_img"))
                     {
-                        case "GLoader":
-                            break;
-                        case "Shape":
-                            break;
+                        listTopImg.Add(obj);
                     }
-                    obj.AddRelation(ui, RelationType.Center_Center);
-                    obj.RemoveRelation(ui, RelationType.Size);
-                    obj.SetSize(1080, 2400);
-                    obj.SetXY(obj.x, obj.y - offsetY / 2);
                 }
             }
 
+            // 保存未适配时,不需要改变位置的UI的信息(适配部分存在拉伸效果的UI)
+            ui.SetSize(targetWidth, GRoot.inst.height);
+            List<float> heightList = new List<float>();
+            for (int i = 0; i < listTopImg.Count; i++)
+            {
+                listTopImg[i].RemoveRelation(ui, RelationType.Center_Center);
+                heightList.Add(listTopImg[i].height);
+            }
+
             // UI整体高度缩放
             ui.SetSize(targetWidth, ViewGlobal.GetUIHeight());
             // UI整体下移动
             ui.SetXY(ui.x, offsetY);
 
+            // 还原不需要适配的UI
+            for (int i = 0; i < listTopImg.Count; i++)
+            {
+                listTopImg[i].SetSize(listTopImg[i].width, heightList[i]);
+                listTopImg[i].SetXY(listTopImg[i].x, listTopImg[i].y - offsetY);
+            }
+
             _adaptFinished = true;
         }
 

+ 13 - 1
GameClient/Assets/Game/HotUpdate/Views/ViewGlobal.cs

@@ -38,7 +38,7 @@ namespace GFGGame
         /// <returns></returns>
         static float GetTopOffset()
         {
-            int designOffset = (Screen.safeArea.height == Screen.height ? 0 : 50);
+            int designOffset = (Screen.safeArea.height == Screen.height ? 0 : 90);
             return Screen.height - Screen.safeArea.height - Screen.safeArea.y - designOffset;
         }
 
@@ -78,6 +78,8 @@ namespace GFGGame
         }
 
         private static List<string> fullScreenPicNames = new List<string>() { "loaBg", "mask" };
+        private static List<string> notMoveUI = new List<string>() { "Top_img" };
+
 
         public static bool IsFullScreenPic(string name)
         {
@@ -88,5 +90,15 @@ namespace GFGGame
             }
             return false;
         }
+
+        public static bool IsNotMoveUI(string name)
+        {
+            foreach (string s in notMoveUI)
+            {
+                if (s.Contains(name))
+                    return true;
+            }
+            return false;
+        }
     }
 }

BIN=BIN
GameClient/Assets/ResIn/UI/ActivityAfternoonTea/ActivityAfternoonTea_fui.bytes


BIN=BIN
GameClient/Assets/ResIn/UI/ActivityDay7/ActivityDay7_fui.bytes


BIN=BIN
GameClient/Assets/ResIn/UI/Bag/Bag_fui.bytes


BIN=BIN
GameClient/Assets/ResIn/UI/ClothingDecompose/ClothingDecompose_fui.bytes


BIN=BIN
GameClient/Assets/ResIn/UI/FieldGuide/FieldGuide_fui.bytes


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


BIN=BIN
GameClient/Assets/ResIn/UI/Task/Task_fui.bytes


BIN=BIN
GameClient/Assets/ResIn/UI/Travel/Travel_fui.bytes


+ 1 - 0
GameClient/Packages/manifest.json

@@ -5,6 +5,7 @@
     "com.unity.2d.psdimporter": "4.3.0",
     "com.unity.2d.sprite": "1.0.0",
     "com.unity.collab-proxy": "1.15.15",
+    "com.unity.device-simulator": "3.1.0-preview",
     "com.unity.ide.rider": "2.0.7",
     "com.unity.ide.visualstudio": "2.0.15",
     "com.unity.ide.vscode": "1.2.5",

+ 7 - 0
GameClient/Packages/packages-lock.json

@@ -56,6 +56,13 @@
       },
       "url": "https://packages.unity.cn"
     },
+    "com.unity.device-simulator": {
+      "version": "3.1.0-preview",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
     "com.unity.ext.nunit": {
       "version": "1.0.6",
       "depth": 1,

+ 3 - 3
GameClient/ProjectSettings/PackageManagerSettings.asset

@@ -12,11 +12,11 @@ MonoBehaviour:
   m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
   m_Name: 
   m_EditorClassIdentifier: 
-  m_EnablePreviewPackages: 0
-  m_EnablePackageDependencies: 0
+  m_EnablePreviewPackages: 1
+  m_EnablePackageDependencies: 1
   m_AdvancedSettingsExpanded: 1
   m_ScopedRegistriesSettingsExpanded: 1
-  oneTimeWarningShown: 0
+  oneTimeWarningShown: 1
   m_Registries:
   - m_Id: main
     m_Name: