From 316392fc7db70f82c5da0badee782a03e73c5d50 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期一, 28 一月 2019 21:24:07 +0800
Subject: [PATCH] 6086 【前端】【1.5.200】春节红包雨活动

---
 System/OpenServerActivity/RedEnvelopeModel.cs |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/System/OpenServerActivity/RedEnvelopeModel.cs b/System/OpenServerActivity/RedEnvelopeModel.cs
index 484ac9e..8b69e2d 100644
--- a/System/OpenServerActivity/RedEnvelopeModel.cs
+++ b/System/OpenServerActivity/RedEnvelopeModel.cs
@@ -31,11 +31,13 @@
         {
             serverInited = false;
             m_RedEnvelopeDict.Clear();
+            redpacks.Clear();
         }
 
         bool serverInited = false;
 
-        private Dictionary<int, RedEnvelope> m_RedEnvelopeDict = new Dictionary<int, RedEnvelope>();
+        Dictionary<int, RedEnvelope> m_RedEnvelopeDict = new Dictionary<int, RedEnvelope>();
+        Dictionary<int, List<int>> redpacks = new Dictionary<int, List<int>>();
 
         public event Action EnvelopeUpdateEvent;
         public event Action<int> EnvelopeGetEvent;
@@ -59,6 +61,18 @@
                     state = info.State,
                     Wish = UIHelper.ServerStringTrim(info.Wish)
                 };
+
+                List<int> list;
+                if (!redpacks.TryGetValue(info.GetWay, out list))
+                {
+                    list = new List<int>();
+                    redpacks.Add(info.GetWay, list);
+                }
+                if (!list.Contains((int)info.RedPacketID))
+                {
+                    list.Add((int)info.RedPacketID);
+                }
+
                 m_RedEnvelopeDict[(int)info.RedPacketID] = _envelope;
                 if (EnvelopeGetEvent != null)
                 {
@@ -141,6 +155,16 @@
                 var _id = (int)_pak.DelRedPacketID[i];
                 if (m_RedEnvelopeDict.ContainsKey(_id))
                 {
+                    var type = m_RedEnvelopeDict[_id].type;
+                    if (redpacks.ContainsKey(type))
+                    {
+                        var list = redpacks[type];
+                        if (list.Contains(_id))
+                        {
+                            list.Remove(_id);
+                        }
+                    }
+
                     m_RedEnvelopeDict.Remove(_id);
                 }
             }
@@ -177,6 +201,11 @@
                 }
             }
             return _has;
+        }
+
+        public bool TryGetEnvelopes(int type, out List<int> list)
+        {
+            return redpacks.TryGetValue(type, out list);
         }
 
         public void GetEnvelopes(int _type, ref List<int> _list)
@@ -224,7 +253,7 @@
 
         public int cacheEnvelopeId = 0;
         public int envelopeSfx { get; set; }
-        public void RequestDetail(int _id)
+        public void SendOpenRedpackPackage(int _id)
         {
             cacheEnvelopeId = _id;
             CAB12_tagCMGrabFamilyRedPacket _pak = new CAB12_tagCMGrabFamilyRedPacket();

--
Gitblit v1.8.0