From 5e0fb1f2d7587738d767f39996dc65bc50b72477 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期四, 02 一月 2025 15:35:59 +0800
Subject: [PATCH] 10290 运势-客户端

---
 System/LoopAct/YunShi/YunShiXBActModel.cs |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/System/LoopAct/YunShi/YunShiXBActModel.cs b/System/LoopAct/YunShi/YunShiXBActModel.cs
index 221711a..fe411cf 100644
--- a/System/LoopAct/YunShi/YunShiXBActModel.cs
+++ b/System/LoopAct/YunShi/YunShiXBActModel.cs
@@ -23,6 +23,8 @@
         //<寻宝类型,<物品id,格子背景编号>>
         public Dictionary<int, Dictionary<int, int>> itemIdBgDict = new Dictionary<int, Dictionary<int, int>>();
 
+        //<寻宝类型,功能ID>
+        public Dictionary<int, int> funcIDDict = new Dictionary<int, int>();
         public int actNum = 10; //对应界面
         public event Action<bool> UpdateMissionEvent;
         public readonly int AwardCellCount = 5;
@@ -50,6 +52,7 @@
         public bool isSkipXB { get; set; }
 
         HappyXBModel happyXBModel { get { return ModelCenter.Instance.GetModelEx<HappyXBModel>(); } }
+        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
 
         public override void Init()
         {
@@ -58,6 +61,7 @@
             OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent;
             happyXBModel.RefreshXBTypeInfoAct += OnRefreshXBTypeInfoAct;
             OperationTimeHepler.Instance.operationTimeUpdateEvent += OnOperationTimeUpdateEvent;
+            packModel.refreshItemCountEvent += OnRefreshItemCountEvent;
             OpenServerActivityCenter.Instance.Register(activityID, this, activityType);
 
             var jsonData = JsonMapper.ToObject(FuncConfigConfig.Get("YunShi").Numerical1);
@@ -84,6 +88,15 @@
                     }
                 }
             }
+            jsonData = JsonMapper.ToObject(FuncConfigConfig.Get("YunShi").Numerical2);
+            keyList = jsonData.Keys.ToList();
+            for (int i = 0; i < keyList.Count; i++)
+            {
+                int type = int.Parse(keyList[i]);
+                int funcId = int.Parse(jsonData[keyList[i]].ToJson());
+                funcIDDict[type] = funcId;
+            }
+
         }
 
         public void OnBeforePlayerDataInitialize()
@@ -99,6 +112,12 @@
         {
             happyXBModel.RefreshXBTypeInfoAct -= OnRefreshXBTypeInfoAct;
             OperationTimeHepler.Instance.operationTimeUpdateEvent -= OnOperationTimeUpdateEvent;
+            packModel.refreshItemCountEvent -= OnRefreshItemCountEvent;
+        }
+
+        private void OnRefreshItemCountEvent(PackType type, int arg2, int arg3)
+        {
+            UpdateRedPoint();
         }
 
         private void OnOperationTimeUpdateEvent(Operation operation)
@@ -196,6 +215,10 @@
             list.Sort();
             if (list == null)
                 return;
+
+            if (happyXBModel.IsHaveOneXBTool(type) || (happyXBModel.IsHaveManyXBTool(type, out int toolCnt, out int needToolCnt) && toolCnt >= needToolCnt))
+                redPointTab.state = RedPointState.Simple;
+
             //有奖励未领取
             for (int i = 0; i < AwardCellCount; i++)
             {
@@ -259,6 +282,23 @@
             return ((int)Math.Pow(2, index) & treasureCntAward) == 0 ? 1 : 2;
         }
 
+        public bool IsFuncOpen()
+        {
+            OperationYunShi act;
+            OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
+            if (act == null)
+                return false;
+
+            int type = act.treasureType;
+            var xbInfo = happyXBModel.GetXBInfoByType(type);
+            if (xbInfo == null)
+                return false;
+
+            if (!funcIDDict.TryGetValue(type, out var funcId))
+                return false;
+            return FuncOpen.Instance.IsFuncOpen(funcId);
+        }
+
         public void SendGetAward(int type, int count)
         {
             CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward();

--
Gitblit v1.8.0