Browse Source

Merge branch 'master' of http://10.108.64.190:3000/gfg/client

zhaoyang 2 years ago
parent
commit
ef803f6329

+ 4 - 4
GameClient/Assets/Game/HotUpdate/Data/DressUpMenuSuitDataManager.cs

@@ -72,7 +72,7 @@ namespace GFGGame
                 {
                     _travelSuitIDList.Add(travelSuitCfg.id);
                 }
-                if (CheckSuitHasAction(value))
+                if (SuitCfgArray.Instance.CheckSuitHasAction(value))
                 {
                     _actionIDList.Add(value);
                 }
@@ -89,7 +89,7 @@ namespace GFGGame
                 {
                     _travelSuitIDList.Remove(travelSuitCfg.id);
                 }
-                if (CheckSuitHasAction(value) && _actionIDList.Contains(value))
+                if (SuitCfgArray.Instance.CheckSuitHasAction(value) && _actionIDList.Contains(value))
                 {
                     _actionIDList.Remove(travelSuitCfg.id);
                 }
@@ -250,8 +250,8 @@ namespace GFGGame
             EventAgent.DispatchEvent(ConstMessage.SUIT_BOX_STATUS_CHANGED, suitId);
         }
 
-        //检查套装是否有动作
-        public static bool CheckSuitHasAction(int suitId)
+        //检查套装是否有动作资源
+        public static bool CheckSuitHasActionRes(int suitId)
         {
             var suitCfg = SuitCfgArray.Instance.GetCfg(suitId);
             return suitCfg != null && ResPathUtil.CheckDressUpAnimationExist(suitCfg.aniRes);

+ 58 - 52
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObj.cs

@@ -293,7 +293,7 @@ namespace GFGGame
             }
             TakeOffAll(false);
             _dressUpData.suitId = id;
-            bool hasSuitActionRes = DressUpMenuSuitDataManager.CheckSuitHasAction(_dressUpData.suitId);
+            bool hasSuitActionRes = DressUpMenuSuitDataManager.CheckSuitHasActionRes(_dressUpData.suitId);
             _dressUpData.actionId = (hasSuitActionRes && tryShowAction) ? id : 0;
             SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_dressUpData.suitId);
             List<int> items = new List<int>(suitCfg.partsArr);
@@ -325,6 +325,63 @@ namespace GFGGame
             UpdateWholeBodyView();
         }
 
+        //穿上一个动作
+        public void PutOnAction(int actionId)
+        {
+            bool hasSuitActionRes = DressUpMenuSuitDataManager.CheckSuitHasActionRes(_dressUpData.suitId);
+            _dressUpData.actionId = actionId;
+            if(hasSuitActionRes)
+            {
+                foreach (int itemId in itemList)
+                {
+                    bool replaceableByAction = SuitCfgArray.Instance.CheckItemReaplaceableByAction(itemId, _dressUpData.actionId);
+                    if (!replaceableByAction)
+                    {
+                        AddOrRemove(itemId, false, false, true);
+                    }
+                }
+            }
+            else
+            {
+                CancelAction(true);
+            }
+            checkDefaultItem();
+            UpdateWholeBodyView();
+        }
+
+        //取消动作
+        public void CancelAction(bool changeToStand = false)
+        {
+            if (_dressUpData.actionId <= 0)
+            {
+                return;
+            }
+            var tempActionId = _dressUpData.actionId;
+            _dressUpData.actionId = 0;
+            if (changeToStand)
+            {
+                SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(tempActionId);
+                List<int> items = new List<int>(suitCfg.partsArr);
+                if (suitCfg.partsOptionalArr != null && suitCfg.partsOptionalArr.Length > 0)
+                {
+                    items.AddRange(suitCfg.partsOptionalArr);
+                }
+                foreach (int itemId in items)
+                {
+                    if (DressUpMenuItemDataManager.CheckHasItem(itemId))
+                    {
+                        bool replaceableByAction = SuitCfgArray.Instance.CheckItemReaplaceableByAction(itemId, tempActionId);
+                        if (!replaceableByAction)
+                        {
+                            AddOrRemove(itemId, false, true);
+                        }
+                    }
+                }
+            }
+            checkDefaultItem();
+            UpdateWholeBodyView();
+        }
+
         //穿戴一组换装数据
         public void PutOnDressUpData(DressUpData dressUpData)
         {
@@ -537,57 +594,6 @@ namespace GFGGame
             }
         }
 
-        //穿上一个动作
-        public void PutOnAction(int actionId)
-        {
-            _dressUpData.actionId = actionId;
-            foreach (int itemId in itemList)
-            {
-                bool replaceableByAction = SuitCfgArray.Instance.CheckItemReaplaceableByAction(itemId, _dressUpData.actionId);
-                if (!replaceableByAction)
-                {
-                    AddOrRemove(itemId, false, false, true);
-                }
-            }
-            checkDefaultItem();
-            UpdateWholeBodyView();
-        }
-
-        //取消动作
-        public void CancelAction(bool changeToStand = false)
-        {
-            if (_dressUpData.actionId <= 0)
-            {
-                return;
-            }
-            var tempActionId = _dressUpData.actionId;
-            _dressUpData.actionId = 0;
-            if(changeToStand)
-            {
-                SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(tempActionId);
-                List<int> items = new List<int>(suitCfg.partsArr);
-                if (suitCfg.partsOptionalArr != null && suitCfg.partsOptionalArr.Length > 0)
-                {
-                    items.AddRange(suitCfg.partsOptionalArr);
-                }
-                int subType = 0;
-                foreach (int itemId in items)
-                {
-                    if (DressUpMenuItemDataManager.CheckHasItem(itemId))
-                    {
-                        subType = ItemUtilCS.GetItemSubType(itemId);
-                        bool replaceableByAction = SuitCfgArray.Instance.CheckItemReaplaceableByAction(itemId, tempActionId);
-                        if (!replaceableByAction)
-                        {
-                            AddOrRemove(itemId, false, true);
-                        }
-                    }
-                }
-            }
-            checkDefaultItem();
-            UpdateWholeBodyView();
-        }
-
         
     }
 }

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

@@ -271,7 +271,7 @@ namespace GFGGame
             // bool isSuit = SuitCfgArray.Instance.GetTotalCountOfOneSuit(id) > 0;
             if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
             {
-                if (DressUpMenuSuitDataManager.CheckSuitHasAction(id))
+                if (SuitCfgArray.Instance.CheckSuitHasAction(id))
                 {
                     listItem.m_comAxtionSelect.target.visible = true;
                     UI_PartsListItem.ProxyEnd();
@@ -813,7 +813,7 @@ namespace GFGGame
                 if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
                 {
                     listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
-                    listItem.m_comAxtionSelect.target.visible = id == selectSuitId && DressUpMenuSuitDataManager.CheckSuitHasAction(id);
+                    listItem.m_comAxtionSelect.target.visible = id == selectSuitId && SuitCfgArray.Instance.CheckSuitHasAction(id);
                 }
                 else if (_currentMenuType == ConstDressUpItemType.DONG_ZUO)
                 {