From b5cdc4acce06b4e9d21b4cc56e99591fe0381564 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 18 十一月 2025 21:57:09 +0800
Subject: [PATCH] 108 【主界面】仙树升级 213 【付费内容】特权卡 - 临时

---
 Main/System/Invest/InvestModel.cs |  270 ++++++++++++------------------------------------------
 1 files changed, 60 insertions(+), 210 deletions(-)

diff --git a/Main/System/Invest/InvestModel.cs b/Main/System/Invest/InvestModel.cs
index a1f8f9c..1634716 100644
--- a/Main/System/Invest/InvestModel.cs
+++ b/Main/System/Invest/InvestModel.cs
@@ -6,36 +6,24 @@
 
 public class InvestModel : GameSystemManager<InvestModel>
 {
-    // public ILOpenServerActivityProxy activity;
-
-    public const int FuncID = 25;
+    public const int monthCardType = 1; // 鏈堝崱
+    public const int foreverCardType = 2; //姘镐箙鍗� 鏉冮檺 
 
 
     //鎶曡祫瀵瑰簲濂栧姳
-    Dictionary<int, Dictionary<int, List<Item>>> m_InvestItems = new Dictionary<int, Dictionary<int, List<Item>>>();
+    Dictionary<int, int[][]> m_InvestItems = new Dictionary<int, int[][]>();
     //鎶曡祫瀵瑰簲鍏呭�糏D
     Dictionary<int, int[]> m_InvestRechargeIds = new Dictionary<int, int[]>();
     //鎶曡祫瀵瑰簲璐拱鎯呭喌
     Dictionary<int, InvestInfo> m_InvestInfos = new Dictionary<int, InvestInfo>();
-    //{鎶曡祫绫诲瀷锛歔棰嗗彇澶╋紝褰撳墠澶} 澶╀粠1寮�濮�
-    Dictionary<int, List<List<int>>> m_InvestSingleInfos = new Dictionary<int, List<List<int>>>();
-    //鎶曡祫瀵瑰簲鐨勭孩鐐�
-    Dictionary<int, Redpoint> m_Redpoints = new Dictionary<int, Redpoint>();
     //鎶曡祫绫诲瀷
     public List<int> investTypes = new List<int>();
 
 
-    //姘镐箙鍗� 鏉冮檺
-    public const int foreverCardType = 12; //鎶曡祫绫诲瀷   
-    public const int monthCardType = 7; // 鏈堝崱7
-
-
-
-    public event Action onSelectUpdate;
     public event Action<int> onInvestUpdate;
 
     public const int redpointID = 20931;
-    public Redpoint redpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, redpointID);
+    public Redpoint redpoint = new Redpoint(redpointID);
 
 
     public override void Init()
@@ -60,14 +48,13 @@
 
     public bool IsOpen()
     {
-        return FuncOpen.Instance.IsFuncOpen(FuncID);
+        return FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.PrivilegeCard);
     }
 
     
     public void OnBeforePlayerDataInitialize()
     {
         m_InvestInfos.Clear();
-        m_InvestSingleInfos.Clear();
     }
 
     public void OnPlayerLoginOk()
@@ -78,49 +65,16 @@
 
     void ParseConfig()
     {
-        investTypes.Clear();
         var funcConfig = FuncConfigConfig.Get("InvestCost");
-        m_InvestRechargeIds = ConfigParse.ParseIntArrayDict(funcConfig.Numerical3);
-        //m_Redpoints
+        m_InvestRechargeIds = ConfigParse.ParseIntArrayDict(funcConfig.Numerical1);
+
+        funcConfig = FuncConfigConfig.Get("InvestDay");
+        m_InvestItems = ConfigParse.ParseIntArray2Dict(funcConfig.Numerical3);
 
         investTypes = m_InvestRechargeIds.Keys.ToList();
-
         investTypes.Sort();
 
-        var configs = InvestConfig.GetValues();
-        for (int i = 0; i < configs.Count; i++)
-        {
-            var config = configs[i];
-            if (!investTypes.Contains(config.type))
-            {
-                continue;
-            }
-
-            Dictionary<int, List<Item>> dict;
-            if (!m_InvestItems.TryGetValue(config.type, out dict))
-            {
-                dict = new Dictionary<int, List<Item>>();
-                m_InvestItems.Add(config.type, dict);
-            }
-
-            List<Item> items;
-            if (!dict.TryGetValue(config.id, out items))
-            {
-                items = new List<Item>();
-                dict.Add(config.id, items);
-            }
-
-            var itemArray = config.award[1];    //1鏆傛椂绾﹀畾鏈堝崱 姘镐箙鍗★紝鍏朵粬鐨勮嚜瀹氫箟鍚庣画鍐嶅畾
-            for (int j = 0; j < itemArray.Length; j++)
-            {
-                items.Add(new Item()
-                {
-                    id = itemArray[j][0],
-                    countEx = itemArray[j][1],
-                    bind = itemArray[j][2],
-                });
-            }
-        }
+        
     }
 
     public OrderInfoConfig GetOrderInfoId(int type)
@@ -144,113 +98,70 @@
     }
 
 
-    public int GetInvestPassDays(int type)
-    {
-        return m_InvestInfos.ContainsKey(type) ? m_InvestInfos[type].days : 0;
-    }
+    // public int GetInvestPassDays(int type)
+    // {
+    //     return m_InvestInfos.ContainsKey(type) ? m_InvestInfos[type].days : 0;
+    // }
 
-    //鑾峰緱鍗曟姇璧勭殑鎬绘敹鐩�
-    public long GetTotalIncome(int type)
-    {
-        long income = 0;
-        if (m_InvestItems.ContainsKey(type))
-        {
-            var keyList = m_InvestItems[type].Keys.ToList();
-            for (int i = 0; i < keyList.Count; i++)
-            {
-                var items = m_InvestItems[type][keyList[i]];
-                for (var j = 0; j < items.Count; j++)
-                {
-                    var item = items[j];
-                    if (item.id == 20 || item.id == 30)
-                        income += item.countEx;
-                }
-            }
-        }
-        return income;
-    }
 
 
     //id 涓鸿〃閲岀殑ID
     //0-鏈姇璧� 1-鏈揪鎴� 2-鍙鍙� 3-宸查鍙�
     public int GetSingleInvestState(int type, int id)
     {
-        if (IsInvested(type))
-        {
-            var day = GetInvestPassDays(type);
-            if (m_InvestItems.ContainsKey(type)
-                && m_InvestItems[type].ContainsKey(id))
-            {
-                if (IsRewardGot(type, id))
-                {
-                    return 3;
-                }
-                var config = InvestConfig.Get(id);
+        // if (IsInvested(type))
+        // {
+        //     var day = GetInvestPassDays(type);
+        //     if (m_InvestItems.ContainsKey(type)
+        //         && m_InvestItems[type].ContainsKey(id))
+        //     {
+        //         if (IsRewardGot(type, id))
+        //         {
+        //             return 3;
+        //         }
+        //         var config = InvestConfig.Get(id);
 
-                if (!m_InvestSingleInfos.ContainsKey(type))
-                {
-                    return 0;
-                }
+        //         if (!m_InvestSingleInfos.ContainsKey(type))
+        //         {
+        //             return 0;
+        //         }
 
-                var index = id % 100;
-                //姣忎釜鏁版寜浣嶅瓨31涓縺娲荤储寮�
-                var listIndex = index / 31;
-                var bitIndex = index % 31;
+        //         var index = id % 100;
+        //         //姣忎釜鏁版寜浣嶅瓨31涓縺娲荤储寮�
+        //         var listIndex = index / 31;
+        //         var bitIndex = index % 31;
 
 
-                return day < config.needDay ? 1 : 2;
-            }
-        }
+        //         return day < config.needDay ? 1 : 2;
+        //     }
+        // }
         return 0;
     }
 
 
-
-    public bool TryGetItems(int type, int id, out List<Item> items)
-    {
-        items = null;
-        if (m_InvestItems.ContainsKey(type))
-        {
-            return m_InvestItems[type].TryGetValue(id, out items);
-        }
-        return false;
-    }
-
-    public List<int> GetIdsByType(int type)
-    {
-        if (m_InvestItems.ContainsKey(type))
-        {
-            return m_InvestItems[type].Keys.ToList();
-        }
-        return null;
-    }
-
     //鍒ゆ柇鏄惁璐拱浜嗘姇璧�
     public bool IsInvested(int type)
     {
-        return m_InvestInfos.ContainsKey(type) && m_InvestInfos[type].money > 0;
+        if (!m_InvestInfos.ContainsKey(type))
+        {
+            return false;
+        }
+        if (type == 1)
+        {
+            //鏈堝崱 闄愭椂绫诲瀷鐨勬姇璧� 鏈埌鏈熷氨绠楁姇璧�
+            return m_InvestInfos[type].InvestEndTime > 0 && m_InvestInfos[type].InvestEndTime < TimeUtility.AllSeconds;
+        }
+        
+        //姘镐箙绫诲瀷鐨勬姇璧� 鍙璐拱浜嗗氨绠楁姇璧�
+        return m_InvestInfos[type].InvestBuyTime > 0;
     }
 
-    //濂栧姳鏄惁宸查鍙�
-    public bool IsRewardGot(int type, int id)
-    {
-        if (m_InvestSingleInfos.ContainsKey(type))
-        {
-            var index = id % 100;
-            //姣忎釜鏁版寜浣嶅瓨31涓縺娲荤储寮�
-            var listIndex = index / 31;
-            var bitIndex = index % 31;
-            return ((int)Math.Pow(2, bitIndex) & m_InvestSingleInfos[type][1][listIndex]) != 0;
-        }
-        return false;
-    }
 
 
     private void OnFuncStateChangeEvent(int id)
     {
-        if (id == FuncID)
+        if (id == (int)FuncOpenEnum.PrivilegeCard)
         {
-            // activity.StateUpdate(id);
             UpdateRedpoint();
         }
 
@@ -262,7 +173,7 @@
     {
         var pak = new CA541_tagCMGetInvestReward();
         pak.InvestType = (byte)type;
-        pak.RewardIndex = (byte)(id % 100);
+        pak.RewardIndex = (byte)id;
         GameNetSystem.Instance.SendInfo(pak);
     }
 
@@ -272,7 +183,7 @@
         RechargeManager.Instance.CTG(GetOrderInfoId(type));
     }
 
-    public void UpdateInvestInfo(HA338_tagMCInvestInfo package)
+    public void UpdateInvestInfo(HA338_tagSCInvestInfo package)
     {
         if (!investTypes.Contains(package.InvestType))
         {
@@ -281,26 +192,12 @@
 
         m_InvestInfos[package.InvestType] = new InvestInfo()
         {
-            days = (int)package.CurDay,
-            money = package.CurDay >= 1 ? 1 : 0,
+            InvestBuyTime = (int)package.InvestBuyTime,
+            InvestEndTime = (int)package.InvestEndTime,
+            AwardState = package.AwardState
         };
 
-        List<List<int>> singleInfos;
-        if (!m_InvestSingleInfos.TryGetValue(package.InvestType, out singleInfos))
-        {
-            singleInfos = new List<List<int>>();
-            m_InvestSingleInfos.Add(package.InvestType, singleInfos);
-        }
-        singleInfos.Clear();
-        singleInfos.Add(new List<int>());
-        singleInfos.Add(new List<int>());
-        singleInfos.Add(new List<int>());
-        singleInfos[0].Add((int)package.CurDay);
-        for (int i = 0; i < package.ValueCount; i++)
-        {
-            singleInfos[1].Add((int)package.RewardValue[i]);
-            singleInfos[2].Add((int)package.ProgressValue[i]);
-        }
+        
         UpdateRedpoint();
 
         if (onInvestUpdate != null)
@@ -311,67 +208,20 @@
 
     void UpdateRedpoint()
     {
-        List<int> redpointTypes = new List<int>();
-        if (IsOpen())
+        if (!IsOpen())
         {
-            for (var i = 0; i < investTypes.Count; i++)
-            {
-                var type = investTypes[i];
-                if (!IsInvested(type))
-                {
-                    continue;
-                }
-                var keyList = m_InvestItems[type].Keys.ToList();
-                for (int j = 0; j < keyList.Count; j++)
-                {
-                    var id = keyList[j];
-                    if (GetSingleInvestState(type, id) == 2)
-                    {
-                        redpointTypes.Add(type);
-                        break;
-                    }
-                }
-            }
+            return;
         }
 
-        var redList = m_Redpoints.Keys.ToList();
-        for (int j = 0; j < redList.Count; j++)
-        {
-            var type = redList[j];
-            m_Redpoints[type].state = redpointTypes.Contains(type) ? RedPointState.Simple : RedPointState.None;
-        }
     }
 
     
 
-    //宸茬粡璐拱骞堕鍙栨墍鏈夌墿鍝�
-    public bool IsFinish()
-    {
-        for (int i = 0; i < investTypes.Count; i++)
-        {
-            int type = investTypes[i];
-            //蹇界暐姘镐箙鍗�
-            if (type == foreverCardType)
-                continue;
-            var idsList = GetIdsByType(type);
-            if (idsList.IsNullOrEmpty())
-                continue;
-            for (int j = 0; j < idsList.Count; j++)
-            {
-                int id = idsList[j];
-                if (GetSingleInvestState(type, id) != 3)
-                {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
     public struct InvestInfo
     {
-        public int money;
-        public int days;
+        public int InvestBuyTime;    // 鎶曡祫璐拱鏃堕棿鎴筹紝姘镐箙鐨勯�氳繃璇ユ椂闂村垽鏂槸鍚︽湁鏁堟垨宸茶繃澶╂暟锛屼换鎰忕被鍨嬪潎鏈夎鍊硷紝杩囨湡娌℃湁閲嶇疆锛屽墠绔嚜宸卞垽鏂�
+        public int InvestEndTime;    // 鎶曡祫鍒版湡鏃堕棿鎴筹紝闈炴案涔呯殑閫氳繃璇ユ椂闂村垽鏂埌鏈熸椂闂达紝鏈夊ぉ鏁伴檺鍒剁殑鎵嶆湁鍊�
+        public int AwardState;    // 浠婃棩鏄惁宸查鍙栧鍔�
     }
 }
 

--
Gitblit v1.8.0