浏览代码

抽卡成就开发

lzx 9 小时之前
父节点
当前提交
195a4e2f44

+ 1 - 1
Assets/Art/VFX/Materials/UIMat/ui fb kuang glow3 mask uv.mat

@@ -139,7 +139,7 @@ Material:
     - _MainSpeedU: 0
     - _MainSpeedV: 0
     - _MainTexOffsetU: 0
-    - _MainTexOffsetV: -0.3
+    - _MainTexOffsetV: 0.06125945
     - _MainTilingU: 1
     - _MainTilingV: 0.78
     - _MaskSpeedU: 0.5

+ 18 - 0
Assets/Res/Config/DropConfig.json

@@ -1485,14 +1485,32 @@
     },
     {
       "ID": 999007,
+      "dropGroupID": [
+        8,
+        9,
+        10,
+        11,
+        12,
+        13
+      ],
       "dropType": 2
     },
     {
       "ID": 999008,
+      "dropGroupID": [
+        14,
+        15,
+        16,
+        17
+      ],
       "dropType": 2
     },
     {
       "ID": 999009,
+      "dropGroupID": [
+        18,
+        19
+      ],
       "dropType": 2
     }
   ]

+ 4 - 2
Assets/Res/Config/InitialPlayerConfig.json

@@ -7,14 +7,16 @@
         1002,
         1003,
         1004,
-        1005
+        1005,
+        1007
       ],
       "itemAmount": [
         10,
         10,
         10,
         10,
-        10
+        10,
+        100000
       ],
       "fabaoId": [
         10002

+ 3 - 3
Assets/Res/UI/BoxPanel/GachaPanel.prefab

@@ -241,7 +241,7 @@ RectTransform:
   m_AnchorMin: {x: 0.5, y: 0.5}
   m_AnchorMax: {x: 0.5, y: 0.5}
   m_AnchoredPosition: {x: 0, y: 189}
-  m_SizeDelta: {x: 750, y: 1624}
+  m_SizeDelta: {x: 547, y: 1257}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!225 &855192496587546533
 CanvasGroup:
@@ -1623,7 +1623,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &342747676854343371
 RectTransform:
   m_ObjectHideFlags: 0
@@ -3049,7 +3049,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &7592450372735246186
 RectTransform:
   m_ObjectHideFlags: 0

+ 5 - 0
Assets/Scripts/GameLogic/Player/AccountFileInfo.cs

@@ -442,6 +442,11 @@ public class AccountFileInfo : Singleton<AccountFileInfo>
         //保底次数
         public int baodiCount1;
         public int baodiCount2;
+        
+        // 存储最近几次十连抽的结果
+        public List<List<int>> drawHistory = new List<List<int>>();
+
+        public int score;
     }
 
 

+ 110 - 0
Assets/Scripts/GameLogic/Player/SummonManager.cs

@@ -4,6 +4,7 @@ using Excel2Json;
 using Fort23.UTool;
 using GameLogic.Bag;
 using UnityEngine;
+using UnityEngine.UIElements;
 using Utility;
 
 namespace GameLogic.Player
@@ -12,6 +13,9 @@ namespace GameLogic.Player
     {
         public Map<int, AccountFileInfo.SummonData> summonDataMap = new Map<int, AccountFileInfo.SummonData>();
 
+        //积分规则
+        public Map<int, List<OpenBoxScoreRule>> openBoxScoreRuleMap = new Map<int, List<OpenBoxScoreRule>>();
+
         public void CustomInit()
         {
             OpenBoxConfig[] openBoxConfigs = ConfigComponent.Instance.GetAll<OpenBoxConfig>();
@@ -27,6 +31,21 @@ namespace GameLogic.Player
                 }
             }
 
+            OpenBoxScoreRule[] openBoxScoreRules = ConfigComponent.Instance.GetAll<OpenBoxScoreRule>();
+            foreach (var openBoxScoreRule in openBoxScoreRules)
+            {
+                List<OpenBoxScoreRule> openBoxScoreRuleList;
+                if (!openBoxScoreRuleMap.ContainsKey(openBoxScoreRule.openBoxID))
+                {
+                    openBoxScoreRuleList = new List<OpenBoxScoreRule>();
+                    openBoxScoreRuleMap[openBoxScoreRule.openBoxID] = openBoxScoreRuleList;
+                }
+
+                openBoxScoreRuleList = openBoxScoreRuleMap[openBoxScoreRule.openBoxID];
+                openBoxScoreRuleList.Add(openBoxScoreRule);
+            }
+
+
             foreach (var playerDataSummonData in AccountFileInfo.Instance.playerData.SummonDatas)
             {
                 if (!summonDataMap.ContainsKey(playerDataSummonData.id))
@@ -62,6 +81,7 @@ namespace GameLogic.Player
                     {
                         PlayerManager.Instance.BagController.DeductCoin(openBoxConfig.oneConsume);
                         allIitem = Summon(summonData, 1);
+
                         summonData.onePayCount++;
                         summonData.nextOneFreeTime = PlayerManager.Instance.serverTime + openBoxConfig.oneConsumeFreePara[0] * 1000;
                     }
@@ -78,7 +98,14 @@ namespace GameLogic.Player
                 if (summonData.tenFreeCount < openBoxConfig.oneConsumeFreePara_1[1] && PlayerManager.Instance.serverTime >= summonData.nextTenFreeTime)
                 {
                     allIitem = Summon(summonData, 10);
+                    //记录抽卡道具 用于成就检测
+                    List<int> drawHistory = new List<int>();
+                    foreach (var itemInfo in allIitem)
+                    {
+                        drawHistory.Add(itemInfo.itemID);
+                    }
 
+                    summonData.drawHistory.Add(drawHistory);
                     summonData.tenFreeCount++;
                     summonData.tenPayCount++;
                     summonData.nextTenFreeTime = PlayerManager.Instance.serverTime + openBoxConfig.oneConsumeChargePara[0] * 1000;
@@ -90,8 +117,18 @@ namespace GameLogic.Player
                     {
                         PlayerManager.Instance.BagController.DeductCoin(openBoxConfig.tenConsume);
                         allIitem = Summon(summonData, 10);
+                        //记录抽卡道具 用于成就检测
+                        List<int> drawHistory = new List<int>();
+                        foreach (var itemInfo in allIitem)
+                        {
+                            drawHistory.Add(itemInfo.itemID);
+                        }
+
+                        summonData.drawHistory.Add(drawHistory);
                         summonData.tenPayCount++;
                         summonData.nextTenFreeTime = PlayerManager.Instance.serverTime + openBoxConfig.oneConsumeChargePara[0] * 1000;
+
+                        CheckAchievements(summonData);
                     }
                     else
                     {
@@ -100,6 +137,7 @@ namespace GameLogic.Player
                 }
             }
 
+            AccountFileInfo.Instance.SavePlayerData();
             return allIitem;
         }
 
@@ -187,5 +225,77 @@ namespace GameLogic.Player
             AccountFileInfo.Instance.SavePlayerData();
             return allIitem;
         }
+
+
+        // 检查成就匹配
+        private void CheckAchievements(AccountFileInfo.SummonData summonData)
+        {
+            List<OpenBoxScoreRule> openBoxScoreRuleList = openBoxScoreRuleMap[summonData.id];
+
+            List<OpenBoxScoreRule> daChengOpenBoxScoreRuleList = new List<OpenBoxScoreRule>();
+            foreach (var openBoxScoreRule in openBoxScoreRuleList)
+            {
+                // 检查连续 Para0 次十连
+                if (summonData.drawHistory.Count < openBoxScoreRule.para0) continue;
+
+                bool allDrawsSatisfy = true;
+                // 检查最近 Para0 次十连是否都满足条件
+                for (int i = summonData.drawHistory.Count - openBoxScoreRule.para0; i < summonData.drawHistory.Count; i++)
+                {
+                    if (!CheckSingleDraw(openBoxScoreRule, summonData.drawHistory[i]))
+                    {
+                        allDrawsSatisfy = false;
+                        break;
+                    }
+                }
+
+                if (allDrawsSatisfy)
+                {
+                    daChengOpenBoxScoreRuleList.Add(openBoxScoreRule);
+                }
+            }
+
+            if (daChengOpenBoxScoreRuleList.Count > 0)
+            {
+                int id = daChengOpenBoxScoreRuleList.Max(obsr => obsr.ID);
+                OpenBoxScoreRule openBoxScoreRule = ConfigComponent.Instance.Get<OpenBoxScoreRule>(id);
+                summonData.score += openBoxScoreRule.score;
+                LogTool.Log($"达成成就 ID: {openBoxScoreRule.ID}, 分数: {openBoxScoreRule.score}, 描述: 连续{openBoxScoreRule.para0}次十连获得{openBoxScoreRule.para1}个品质{openBoxScoreRule.para3}的道具");
+            }
+        }
+
+
+        // 检查单次十连是否满足成就条件
+        private bool CheckSingleDraw(OpenBoxScoreRule openBoxScoreRule, List<int> drawResult)
+        {
+            // 统计符合条件的道具数量
+            int validItemCount = 0;
+            foreach (var item in drawResult)
+            {
+                ItemConfig itemConfig = ConfigComponent.Instance.Get<ItemConfig>(item);
+                // 检查道具标签
+                if (!openBoxScoreRule.para4.Contains(itemConfig.itemTag)) continue;
+
+                // 检查品质是否符合
+                bool qualityMatch = false;
+                switch (openBoxScoreRule.para2)
+                {
+                    case 1: // 等于
+                        qualityMatch = itemConfig.quality == openBoxScoreRule.para3;
+                        break;
+                    case 2: // 大于等于
+                        qualityMatch = itemConfig.quality >= openBoxScoreRule.para3;
+                        break;
+                    case 3: // 小于等于
+                        qualityMatch = itemConfig.quality <= openBoxScoreRule.para3;
+                        break;
+                }
+
+                if (qualityMatch) validItemCount++;
+            }
+
+            // 根据 Para1 判断是否满足数量要求
+            return validItemCount >= openBoxScoreRule.para1;
+        }
     }
 }

+ 19 - 3
Assets/Scripts/GameUI/UI/BoxPanel/BoxPanel.cs

@@ -176,7 +176,7 @@ namespace Fort23.Mono
         public void OpenPanel()
         {
             CombatController.currActiveCombat.isUpdate = false;
-            openBoxConfig = ConfigComponent.Instance.Get<OpenBoxConfig>(1);
+            openBoxConfig = ConfigComponent.Instance.Get<OpenBoxConfig>(2);
             ItemConfig config = ConfigComponent.Instance.Get<ItemConfig>(openBoxConfig.CostItemID);
             icon_Oneitem.icon_name = config.icon;
             Icon_TenItem.icon_name = config.icon;
@@ -198,7 +198,15 @@ namespace Fort23.Mono
                 if (Text_TenFree.gameObject.activeSelf)
                 {
                     Text_TenFree.gameObject.SetActive(false);
-                    tenCion.text = "x" + openBoxConfig.tenConsume;
+                    if (summonData.tenFreeCount < openBoxConfig.oneConsumeFreePara_1[1])
+                    {
+                        tenCion.text = "免费";
+                    }
+                    else
+                    {
+                        tenCion.text = "x" + openBoxConfig.tenConsume;
+                    }
+                  
                 }
             }
 
@@ -212,7 +220,15 @@ namespace Fort23.Mono
                 if (Text_OneFree.gameObject.activeSelf)
                 {
                     Text_OneFree.gameObject.SetActive(false);
-                    onCion.text = "x" + openBoxConfig.oneConsume;
+                    if (summonData.oneFreeCount < openBoxConfig.oneConsumeFreePara[1])
+                    {
+                        onCion.text = "免费";
+                    }
+                    else
+                    {
+                        onCion.text = "x" + openBoxConfig.oneConsume;
+                    }
+                   
                 }
             }
         }

二进制
Excel2Json/Excel/ChouKa.xlsx


二进制
Excel2Json/Excel/InitialPlayer.xlsx


二进制
Excel2Json/Excel/OpenBox.xlsx