zhaoyang 3 жил өмнө
parent
commit
d6affba1bc

+ 3 - 0
FGUIProject/assets/Main/components/ButtonModle1.xml

@@ -3,6 +3,9 @@
   <controller name="button" pages="0,up,1,down,2,over,3,selectedOver" selected="0"/>
   <displayList>
     <loader id="n1_wg7t" name="icon" xy="127,130" pivot="0.5,0.5" anchor="true" size="254,260" url="ui://mfvz4q8kq08xi" autoSize="true"/>
+    <graph id="n2_lki4" name="holder" xy="127,130" size="0,0" touchable="false">
+      <relation target="" sidePair="height-height"/>
+    </graph>
   </displayList>
   <Button/>
 </component>

+ 3 - 0
FGUIProject/assets/Main/components/ComponentHeadBar.xml

@@ -10,5 +10,8 @@
     <text id="n38_slb4" name="txtLvl" xy="96,84" size="29,29" fontSize="20" color="#ffffff" align="center" text="99">
       <relation target="n37_slb4" sidePair="center-center,middle-middle"/>
     </text>
+    <graph id="n40_lki4" name="holder" xy="62,62" size="0,0" touchable="false">
+      <relation target="" sidePair="height-height"/>
+    </graph>
   </displayList>
 </component>

+ 2 - 2
GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

@@ -267,9 +267,9 @@ namespace GFGGame
             SetParticleSortingOrder(gameObj, sortingOrder);
             return gameObj;
         }
-        public static GameObject AddAnimationObj(string res)
+        public static GameObject AddAnimationObj(string resPath)
         {
-            string resPath = ResPathUtil.GetCardAnimationPath(res);
+            // string resPath = ResPathUtil.GetCardAnimationPath(res);
             var prefab = GFGAsset.Load<GameObject>(resPath);
             if (prefab == null)
             {

+ 25 - 1
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -2,6 +2,7 @@ using UnityEngine;
 using System.Collections;
 using System;
 using UnityEditor;
+using FairyGUI;
 
 namespace GFGGame
 {
@@ -240,7 +241,7 @@ namespace GFGGame
 
 
         //场景添加单个道具
-        public static void AddScene(GameObject sceneObj, int itemId, int index, int resLayer = int.MinValue)
+        public static void AddItemToScene(GameObject sceneObj, int itemId, int index, int resLayer = int.MinValue)
         {
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
             //普通层
@@ -338,5 +339,28 @@ namespace GFGGame
             }
             return gameObject;
         }
+
+        public static void AddObjectToView(GameObject _gameObject, GoWrapper _wrapper, GGraph holder, string res, out GameObject gameObject, out GoWrapper wrapper, float scale = 100)
+        {
+            if (_gameObject != null)
+            {
+                GameObject.Destroy(_gameObject);
+                _gameObject = null;
+            }
+            _gameObject = DressUpUtil.AddAnimationObj(res);
+            _gameObject.transform.localScale = new Vector3(scale, scale, scale);
+
+            if (_wrapper == null)
+            {
+                _wrapper = new GoWrapper(_gameObject);
+                holder.SetNativeObject(_wrapper);
+            }
+            else
+            {
+                _wrapper.wrapTarget = _gameObject;//替换资源
+            }
+            wrapper = _wrapper;
+            gameObject = _gameObject;
+        }
     }
 }

+ 71 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ButtonModle1.cs

@@ -0,0 +1,71 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.Main
+{
+    public partial class UI_ButtonModle1
+    {
+        public GButton target;
+        public GGraph m_holder;
+        public const string URL = "ui://mfvz4q8kq08xu";
+        public const string PACKAGE_NAME = "Main";
+        public const string RES_NAME = "ButtonModle1";
+        private static UI_ButtonModle1 _proxy;
+
+        public static UI_ButtonModle1 Create(GObject gObject = null)
+        {
+            var ui = new UI_ButtonModle1();
+            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_ButtonModle1 Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_ButtonModle1();
+            }
+            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_holder = (GGraph)comp.GetChild("holder");
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_holder = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ButtonModle1.cs.meta

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

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ComponentHeadBar.cs

@@ -9,6 +9,7 @@ namespace UI.Main
         public GComponent target;
         public GTextField m_txtName;
         public GTextField m_txtLvl;
+        public GGraph m_holder;
         public const string URL = "ui://mfvz4q8kslb416";
         public const string PACKAGE_NAME = "Main";
         public const string RES_NAME = "ComponentHeadBar";
@@ -58,11 +59,13 @@ namespace UI.Main
         {
             m_txtName = (GTextField)comp.GetChild("txtName");
             m_txtLvl = (GTextField)comp.GetChild("txtLvl");
+            m_holder = (GGraph)comp.GetChild("holder");
         }
         public void Dispose(bool disposeTarget = false)
         {
             m_txtName = null;
             m_txtLvl = null;
+            m_holder = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 15 - 10
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_MainUI.cs

@@ -10,11 +10,11 @@ namespace UI.Main
         public Controller m_c1;
         public UI_ComponentHeadBar m_headBar;
         public GComponent m_valueBar;
-        public GButton m_btnXiuFang;
-        public GButton m_btnMain;
-        public GButton m_btnHuanZhuang;
-        public GButton m_btnZhaiXing;
-        public GButton m_btnCiPai;
+        public UI_ButtonModle1 m_btnXiuFang;
+        public UI_ButtonModle1 m_btnMain;
+        public UI_ButtonModle1 m_btnHuanZhuang;
+        public UI_ButtonModle1 m_btnZhaiXing;
+        public UI_ButtonModle1 m_btnCiPai;
         public GList m_list;
         public GButton m_btnChange;
         public const string URL = "ui://mfvz4q8kq08x0";
@@ -67,11 +67,11 @@ namespace UI.Main
             m_c1 = comp.GetController("c1");
             m_headBar = (UI_ComponentHeadBar)UI_ComponentHeadBar.Create(comp.GetChild("headBar"));
             m_valueBar = (GComponent)comp.GetChild("valueBar");
-            m_btnXiuFang = (GButton)comp.GetChild("btnXiuFang");
-            m_btnMain = (GButton)comp.GetChild("btnMain");
-            m_btnHuanZhuang = (GButton)comp.GetChild("btnHuanZhuang");
-            m_btnZhaiXing = (GButton)comp.GetChild("btnZhaiXing");
-            m_btnCiPai = (GButton)comp.GetChild("btnCiPai");
+            m_btnXiuFang = (UI_ButtonModle1)UI_ButtonModle1.Create(comp.GetChild("btnXiuFang"));
+            m_btnMain = (UI_ButtonModle1)UI_ButtonModle1.Create(comp.GetChild("btnMain"));
+            m_btnHuanZhuang = (UI_ButtonModle1)UI_ButtonModle1.Create(comp.GetChild("btnHuanZhuang"));
+            m_btnZhaiXing = (UI_ButtonModle1)UI_ButtonModle1.Create(comp.GetChild("btnZhaiXing"));
+            m_btnCiPai = (UI_ButtonModle1)UI_ButtonModle1.Create(comp.GetChild("btnCiPai"));
             m_list = (GList)comp.GetChild("list");
             m_btnChange = (GButton)comp.GetChild("btnChange");
         }
@@ -81,10 +81,15 @@ namespace UI.Main
             m_headBar.Dispose();
             m_headBar = null;
             m_valueBar = null;
+            m_btnXiuFang.Dispose();
             m_btnXiuFang = null;
+            m_btnMain.Dispose();
             m_btnMain = null;
+            m_btnHuanZhuang.Dispose();
             m_btnHuanZhuang = null;
+            m_btnZhaiXing.Dispose();
             m_btnZhaiXing = null;
+            m_btnCiPai.Dispose();
             m_btnCiPai = null;
             m_list = null;
             m_btnChange = null;

+ 4 - 0
GameClient/Assets/Game/HotUpdate/Utils/ResPathUtil.cs

@@ -96,6 +96,10 @@ namespace GFGGame
         {
             return $"{EFFECT_DIR_PATH}/{res}/{res}.{extName}";
         }
+        public static string GetViewEffectPath(string uiName, string resName, string extName = "prefab")
+        {
+            return $"{EFFECT_DIR_PATH}/{uiName}/{resName}.{extName}";
+        }
         public static string GetCardAnimationPath(string res, string extName = "prefab")
         {
             return $"{ANIMATION_DIR_PATH}/Card/{res}/{res}.{extName}";

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs

@@ -146,7 +146,8 @@ namespace GFGGame
                     GameObject.Destroy(_cardObj);
                     _cardObj = null;
                 }
-                _cardObj = DressUpUtil.AddAnimationObj(_viewData.res);
+                string resPath = ResPathUtil.GetCardAnimationPath(_viewData.res);
+                _cardObj = DressUpUtil.AddAnimationObj(resPath);
                 _cardObj.transform.localScale = new Vector3(scale, scale, scale);
                 if (_wrapper == null)
                 {

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

@@ -173,7 +173,7 @@ namespace GFGGame
                 case EnumPhotographType.SCENE:
 
                     PhotographDataManager.Instance.AddEquipItem(_equipSceneData, itemID, out _equipSceneData);
-                    SceneController.AddScene(_sceneObject, itemID, _equipSceneData[itemID].Count - 1, maxLayer + 1);
+                    SceneController.AddItemToScene(_sceneObject, itemID, _equipSceneData[itemID].Count - 1, maxLayer + 1);
                     maxLayer++;
                     break;
                 case EnumPhotographType.EFFECT:
@@ -403,7 +403,7 @@ namespace GFGGame
             {
                 for (int i = 0; i < _equipSceneData[key].Count; i++)
                 {
-                    SceneController.AddScene(_sceneObject, key, i);
+                    SceneController.AddItemToScene(_sceneObject, key, i);
                     ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(key);
                     PhotographDataManager.Instance.GetMaxLayer(maxLayer, false, itemCfg, out maxLayer);
                 }

+ 36 - 8
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -21,6 +21,20 @@ namespace GFGGame
         private GButton _btnTianGong;
         private GButton _btnStore;
         private GButton _btnTuJian;
+
+        private GameObject _effectObj0;
+        private GoWrapper _wrapper0;
+        private GameObject _effectObj1;
+        private GoWrapper _wrapper1;
+        private GameObject _effectObj2;
+        private GoWrapper _wrapper2;
+        private GameObject _effectObj3;
+        private GoWrapper _wrapper3;
+        private GameObject _effectObj4;
+        private GoWrapper _wrapper4;
+        private GameObject _effectObj5;
+        private GoWrapper _wrapper5;
+
         public override void Dispose()
         {
             _valueBarController.Dispose();
@@ -60,11 +74,11 @@ namespace GFGGame
             _btnJInShu.visible = false;
             _btnTianGong.visible = false;
 
-            _ui.m_btnMain.onClick.Add(OnClickBtnMain);
-            _ui.m_btnHuanZhuang.onClick.Add(OnClickBtnHuanZhuang);
-            _ui.m_btnZhaiXing.onClick.Add(OnClickBtnZhaiXing);
-            _ui.m_btnXiuFang.onClick.Add(OnClickBtnXiuFang);
-            _ui.m_btnCiPai.onClick.Add(OnClickBtnCiPai);
+            _ui.m_btnMain.target.onClick.Add(OnClickBtnMain);
+            _ui.m_btnHuanZhuang.target.onClick.Add(OnClickBtnHuanZhuang);
+            _ui.m_btnZhaiXing.target.onClick.Add(OnClickBtnZhaiXing);
+            _ui.m_btnXiuFang.target.onClick.Add(OnClickBtnXiuFang);
+            _ui.m_btnCiPai.target.onClick.Add(OnClickBtnCiPai);
             _ui.m_headBar.target.onClick.Add(OnClickHeadBar);
 
             _btnStore.onClick.Add(OnClickBtnStore);
@@ -84,6 +98,7 @@ namespace GFGGame
             SceneController.UpdateMainScene(_sceneObject);
             UpdateRoleLvl();
             _valueBarController.OnShown();
+            AddEffect();
 
             TryGuide();
             Timers.inst.AddUpdate(Update);
@@ -102,7 +117,20 @@ namespace GFGGame
             Timers.inst.Remove(Update);
             Timers.inst.Remove(UpdateToCheckGuide);
         }
+        private void AddEffect()
+        {
+            string resPath0 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_xf_tx");
+            SceneController.AddObjectToView(_effectObj0, _wrapper0, _ui.m_btnXiuFang.m_holder, resPath0, out _effectObj0, out _wrapper0);
+            SceneController.AddObjectToView(_effectObj1, _wrapper1, _ui.m_btnHuanZhuang.m_holder, resPath0, out _effectObj1, out _wrapper1);
+            SceneController.AddObjectToView(_effectObj2, _wrapper2, _ui.m_btnZhaiXing.m_holder, resPath0, out _effectObj2, out _wrapper2);
+            SceneController.AddObjectToView(_effectObj3, _wrapper3, _ui.m_btnCiPai.m_holder, resPath0, out _effectObj3, out _wrapper3);
 
+            string resPath1 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zzl_tx");
+            SceneController.AddObjectToView(_effectObj4, _wrapper4, _ui.m_btnMain.m_holder, resPath1, out _effectObj4, out _wrapper4, 100);
+
+            string resPath2 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_tx/ui_zjm_tx");
+            SceneController.AddObjectToView(_effectObj5, _wrapper5, _ui.m_headBar.m_holder, resPath2, out _effectObj5, out _wrapper5, 1);
+        }
         private void OnClickBtnMain()
         {
             this.Hide();
@@ -187,11 +215,11 @@ namespace GFGGame
 
         private void TryGuide()
         {
-            if (!GuideController.TryGuideByGuideId(_ui.m_btnZhaiXing, ConstGuideId.MAIN_UI_BTN_ZHAI_XING, 1, false, "点击摘星按钮,进入抽奖界面"))
+            if (!GuideController.TryGuideByGuideId(_ui.m_btnZhaiXing.target, ConstGuideId.MAIN_UI_BTN_ZHAI_XING, 1, false, "点击摘星按钮,进入抽奖界面"))
             {
-                if (!GuideController.TryGuideByGuideId(_ui.m_btnHuanZhuang, ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG, 1, false, "点击自由换装按钮,进入换装界面"))
+                if (!GuideController.TryGuideByGuideId(_ui.m_btnHuanZhuang.target, ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG, 1, false, "点击自由换装按钮,进入换装界面"))
                 {
-                    GuideController.TryGuideByGuideId(_ui.m_btnMain, ConstGuideId.MAIN_UI_BTN_STORY, 1, false, "这套服装搭配这个背景可真好看!点击按钮,继续故事可以获取更多好看的服装");
+                    GuideController.TryGuideByGuideId(_ui.m_btnMain.target, ConstGuideId.MAIN_UI_BTN_STORY, 1, false, "这套服装搭配这个背景可真好看!点击按钮,继续故事可以获取更多好看的服装");
                 }
             }
         }

BIN
GameClient/Assets/ResIn/UI/Main/Main_fui.bytes