瀏覽代碼

修改服装合成的人模大小适配

leiyasi 1 年之前
父節點
當前提交
0cc5026591

+ 5 - 2
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ClothingSynthetic/UI_ClothingSyntheticUI.cs

@@ -11,7 +11,8 @@ namespace UI.ClothingSynthetic
         public GButton m_btnBack;
         public GButton m_btnHome;
         public GComponent m_valueBar;
-        public UI_Component1 m_compHolder;
+        public UI_Component1WithMask m_compHolder;
+        public GGraph m_posHelper;
         public UI_CompItemInfo m_compItemInfo;
         public GTextField m_txtSuitName;
         public GTextField m_txtProgress;
@@ -72,7 +73,8 @@ namespace UI.ClothingSynthetic
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_btnHome = (GButton)comp.GetChild("btnHome");
             m_valueBar = (GComponent)comp.GetChild("valueBar");
-            m_compHolder = (UI_Component1)UI_Component1.Create(comp.GetChild("compHolder"));
+            m_compHolder = (UI_Component1WithMask)UI_Component1WithMask.Create(comp.GetChild("compHolder"));
+            m_posHelper = (GGraph)comp.GetChild("posHelper");
             m_compItemInfo = (UI_CompItemInfo)UI_CompItemInfo.Create(comp.GetChild("compItemInfo"));
             m_txtSuitName = (GTextField)comp.GetChild("txtSuitName");
             m_txtProgress = (GTextField)comp.GetChild("txtProgress");
@@ -91,6 +93,7 @@ namespace UI.ClothingSynthetic
             m_valueBar = null;
             m_compHolder.Dispose();
             m_compHolder = null;
+            m_posHelper = null;
             m_compItemInfo.Dispose();
             m_compItemInfo = null;
             m_txtSuitName = null;

+ 75 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ClothingSynthetic/UI_Component1WithMask.cs

@@ -0,0 +1,75 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.ClothingSynthetic
+{
+    public partial class UI_Component1WithMask
+    {
+        public GComponent target;
+        public GGraph m_mask;
+        public UI_Component1 m_compHolder;
+        public const string URL = "ui://4f294tdkgvbr2m";
+        public const string PACKAGE_NAME = "ClothingSynthetic";
+        public const string RES_NAME = "Component1WithMask";
+        private static UI_Component1WithMask _proxy;
+
+        public static UI_Component1WithMask Create(GObject gObject = null)
+        {
+            var ui = new UI_Component1WithMask();
+            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_Component1WithMask Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_Component1WithMask();
+            }
+            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_mask = (GGraph)comp.GetChild("mask");
+            m_compHolder = (UI_Component1)UI_Component1.Create(comp.GetChild("compHolder"));
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_mask = null;
+            m_compHolder.Dispose();
+            m_compHolder = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ClothingSynthetic/UI_Component1WithMask.cs.meta

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

+ 32 - 13
GameClient/Assets/Game/HotUpdate/Views/ClothingSynthetic/ClothingSyntheticView.cs

@@ -5,6 +5,7 @@ using System.Collections.Generic;
 using System;
 using ET;
 using System.Collections;
+using System.Threading.Tasks;
 
 namespace GFGGame
 {
@@ -44,6 +45,7 @@ namespace GFGGame
         private List<ItemData> _materiarsOfSelectedItem;
 
         private UI_MateriasListItem listTypeItem_CloSynthetic;
+        private UI_Component2 _compMover;
 
 
         public override void Dispose()
@@ -85,6 +87,7 @@ namespace GFGGame
             isReturnView = true;
             //this.clickBlankToClose = false;
 
+            _compMover = _ui.m_compHolder.m_compHolder.m_compMover;
             _valueBarController = new ValueBarController(_ui.m_valueBar);
 
             _dressUpObjUI = new DressUpObjUI("SceneDressUpSynthetic");
@@ -101,6 +104,7 @@ namespace GFGGame
             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
             _ui.m_btnProduction.onClick.Add(OnClickBtnProcuction);
             _ui.m_btnHome.onClick.Add(OnClickBtnHome);
+            UpdateMaskHeight();
 
         }
         protected override void AddEventListener()
@@ -208,10 +212,15 @@ namespace GFGGame
         private EaseType ease = EaseType.CubicOut;
         private void UpdateRole(bool tween)
         {
+            // 根据高度比例放大(越高越大)
+            float rate = Screen.height * 1080f / 1920f / Screen.width;
+            // 平板会比宽手机更宽,设定最小值防止缩小
+            rate = Mathf.Max(rate, 1);
+
             _dressUpObjUI.ResetSceneObj(45, true, true, null, false);
             _dressUpObjUI.dressUpObj.AddOrRemove(_selectedItemId, true);
             _imgSelected.visible = _dressUpObjUI.dressUpObj.CheckDressUpItemIsOn(_selectedItemId);
-            _dressUpObjUI.UpdateWrapper(_ui.m_compHolder.m_compMover.m_holder);
+            _dressUpObjUI.UpdateWrapper(_compMover.m_holder);
             int type = ItemUtilCS.GetItemSubType(_selectedItemId);
             float duration = DURATION;
             if (!tween)
@@ -222,33 +231,33 @@ namespace GFGGame
             var dy = _ui.m_compHolder.target.height - 642;
             if (Array.IndexOf(HEAD_Y_ARR, type) >= 0)
             {
-                _ui.m_compHolder.m_compMover.target.TweenMoveY(HEAD_Y + dy, duration).SetEase(ease);
-                _ui.m_compHolder.m_compMover.target.TweenScale(new Vector2(HEAD_SCALE, HEAD_SCALE), duration).SetEase(ease);
+                _compMover.target.TweenMoveY(HEAD_Y + dy, duration).SetEase(ease);
+                _compMover.target.TweenScale(new Vector2(HEAD_SCALE * rate, HEAD_SCALE * rate), duration).SetEase(ease);
             }
             else if (Array.IndexOf(FA_XING_Y_ARR, type) >= 0)
             {
-                _ui.m_compHolder.m_compMover.target.TweenMoveY(FA_XING_Y + dy, duration).SetEase(ease);
-                _ui.m_compHolder.m_compMover.target.TweenScale(new Vector2(FA_XING_SCALE, FA_XING_SCALE), duration).SetEase(ease);
+                _compMover.target.TweenMoveY(FA_XING_Y + dy, duration).SetEase(ease);
+                _compMover.target.TweenScale(new Vector2(FA_XING_SCALE * rate, FA_XING_SCALE * rate), duration).SetEase(ease);
             }
             else if (Array.IndexOf(UPPER_BODY_Y_ARR, type) >= 0)
             {
-                _ui.m_compHolder.m_compMover.target.TweenMoveY(UPPER_BODY_Y + dy, duration).SetEase(ease);
-                _ui.m_compHolder.m_compMover.target.TweenScale(new Vector2(UPPER_BODY_SCALE, UPPER_BODY_SCALE), duration).SetEase(ease);
+                _ui.m_compHolder.m_compHolder.m_compMover.target.TweenMoveY(UPPER_BODY_Y + dy, duration).SetEase(ease);
+                _compMover.target.TweenScale(new Vector2(UPPER_BODY_SCALE* rate, UPPER_BODY_SCALE * rate), duration).SetEase(ease);
             }
             else if (Array.IndexOf(LOWER_BODY_Y_ARR, type) >= 0)
             {
-                _ui.m_compHolder.m_compMover.target.TweenMoveY(LOWER_BODY_Y + dy, duration).SetEase(ease);
-                _ui.m_compHolder.m_compMover.target.TweenScale(new Vector2(LOWER_BODY_SCALE, LOWER_BODY_SCALE), duration).SetEase(ease);
+                _compMover.target.TweenMoveY(LOWER_BODY_Y + dy, duration).SetEase(ease);
+                _compMover.target.TweenScale(new Vector2(LOWER_BODY_SCALE * rate, LOWER_BODY_SCALE* rate), duration).SetEase(ease);
             }
             else if (Array.IndexOf(SHOES_Y_ARR, type) >= 0)
             {
-                _ui.m_compHolder.m_compMover.target.TweenMoveY(SHOES_Y + dy, duration).SetEase(ease);
-                _ui.m_compHolder.m_compMover.target.TweenScale(new Vector2(SHOES_SCALE, SHOES_SCALE), duration).SetEase(ease);
+                _compMover.target.TweenMoveY(SHOES_Y + dy, duration).SetEase(ease);
+                _compMover.target.TweenScale(new Vector2(SHOES_SCALE * rate, SHOES_SCALE * rate), duration).SetEase(ease);
             }
             else
             {
-                _ui.m_compHolder.m_compMover.target.TweenMoveY(BODY_Y + dy, duration).SetEase(ease);
-                _ui.m_compHolder.m_compMover.target.TweenScale(new Vector2(BODY_SCALE, BODY_SCALE), duration).SetEase(ease);
+                _compMover.target.TweenMoveY(BODY_Y + dy, duration).SetEase(ease);
+                _compMover.target.TweenScale(new Vector2(BODY_SCALE * rate, BODY_SCALE * rate), duration).SetEase(ease);
             }
 
             if (!tween)
@@ -457,5 +466,15 @@ namespace GFGGame
             GuideController.TryGuide(_ui.m_btnProduction, ConstGuideId.CLOTHING_SYNTHETIC, 5, "点击获得新的服饰。");
             GuideController.TryGuide(_ui.m_btnBack, ConstGuideId.CLOTHING_SYNTHETIC, 6, "获得新衣服啦,继续通关主线剧情吧。");
         }
+
+        /// <summary>
+        /// 按照屏幕尺寸 更新遮罩的高度
+        /// </summary>
+        /// <returns></returns>
+        private async Task UpdateMaskHeight()
+        {
+            await Task.Delay(5);
+            _ui.m_compHolder.m_mask.height = _ui.m_posHelper.height;
+        }
     }
 }

二進制
GameClient/Assets/ResIn/UI/ClothingSynthetic/ClothingSynthetic_fui.bytes