少年修仙传客户端代码仓库
client_linchunjie
2019-01-28 316392fc7db70f82c5da0badee782a03e73c5d50
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();