guodong hai 1 ano
pai
achega
0c0bc99915

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/BaseWindow.cs

@@ -189,7 +189,7 @@ namespace GFGGame
                 else
                 {
                     btnClose = new GGraph();
-                    btnClose.DrawRect(GRoot.inst.width, GRoot.inst.height, 0, Color.red, UIConfig.modalLayerColor);
+                    btnClose.DrawRect(ViewManager.ViewWidth, GRoot.inst.height, 0, Color.red, UIConfig.modalLayerColor);
                     btnClose.AddRelation(GRoot.inst, RelationType.Size);
                     btnClose.alpha = 0;
                 }

+ 16 - 0
GameClient/Assets/Game/HotUpdate/Views/ViewManager.cs

@@ -3,6 +3,7 @@ using System;
 using FairyGUI;
 using System.Linq;
 using ET;
+using UnityEngine;
 
 namespace GFGGame
 {
@@ -112,6 +113,21 @@ namespace GFGGame
             _floatLayer.AddChild(gObject);
         }
 
+        public static float ViewWidth
+        {
+            get
+            {
+                //这里做了最大宽度适配
+                float maxAspectRatio = 1080 * 1.0f / 1920;
+                if (Screen.width * 1.0f / Screen.height > maxAspectRatio)
+                {
+                    return GRoot.inst.height * maxAspectRatio;
+                }
+                return GRoot.inst.width;
+            }
+            
+        }
+
         /// <summary>
         /// 显示一个视图
         /// </summary>