Пример #1
0
        public static void ApplyPeriodicClear(long ticks)
        {
            if (ticks < NextPeriodicCheckTime)// || -1 != ticks)
            {
                return;
            }
            NextPeriodicCheckTime = ticks + 1000 * 10;

            lock (MarryApplyList)
            {
                foreach (var it in MarryApplyList.ToList())
                {
                    MarryApplyData applyData = it.Value;
                    if (applyData.ApplyExpireTime > 0 && applyData.ApplyExpireTime <= ticks)
                    {
                        ApplyReturnMoney(it.Key, applyData);
                        applyData.ApplyExpireTime = 0;
                    }

                    if (applyData.ApplyCDEndTime <= ticks)
                    {
                        MarryApplyList.Remove(it.Key);
                    }
                }
            }
        }
Пример #2
0
        public static MarryApplyData AddMarryApply(int roleID, MarryApplyType type, int spouseID)
        {
            MarryApplyData data = null;

            lock (MarryLogic.MarryApplyList)
            {
                if (!MarryLogic.MarryApplyList.ContainsKey(roleID))
                {
                    data = new MarryApplyData
                    {
                        ApplyExpireTime   = TimeUtil.NOW() + (long)(MarryLogic.MarryReplyTime * 1000),
                        ApplyCDEndTime    = 0L,
                        ApplySpouseRoleID = spouseID,
                        ApplyType         = type
                    };
                    if (type == MarryApplyType.ApplyInit)
                    {
                        data.ApplyCDEndTime = TimeUtil.NOW() + (long)(MarryLogic.MarryCD * 1000);
                    }
                    else
                    {
                        data.ApplyCDEndTime = data.ApplyExpireTime;
                    }
                    MarryLogic.MarryApplyList.Add(roleID, data);
                }
            }
            return(data);
        }
Пример #3
0
        public static MarryApplyData AddMarryApply(int roleID, MarryApplyType type, int spouseID)
        {
            MarryApplyData data = null;

            lock (MarryApplyList)
            {
                if (MarryApplyList.ContainsKey(roleID) == false)
                {
                    data = new MarryApplyData()
                    {
                        ApplyExpireTime   = TimeUtil.NOW() + MarryReplyTime * 1000,
                        ApplyCDEndTime    = 0,
                        ApplySpouseRoleID = spouseID,
                        ApplyType         = type,
                        //IsMoneyReturn = 0,
                    };
                    if (type == MarryApplyType.ApplyInit)
                    {
                        data.ApplyCDEndTime = TimeUtil.NOW() + MarryCD * 1000;
                    }
                    else
                    {
                        data.ApplyCDEndTime = data.ApplyExpireTime;
                    }
                    MarryApplyList.Add(roleID, data);
                }
            }

            return(data);
        }
Пример #4
0
 public static void ApplyShutdownClear()
 {
     lock (MarryLogic.MarryApplyList)
     {
         foreach (KeyValuePair <int, MarryApplyData> it in MarryLogic.MarryApplyList)
         {
             MarryApplyData applyData = it.Value;
             if (applyData.ApplyExpireTime > 0L)
             {
                 MarryLogic.ApplyReturnMoney(it.Key, applyData, null);
             }
         }
         MarryLogic.MarryApplyList.Clear();
     }
 }
Пример #5
0
 public static void ApplyShutdownClear()
 {
     lock (MarryApplyList)
     {
         foreach (var it in MarryApplyList)
         {
             MarryApplyData applyData = it.Value;
             if (applyData.ApplyExpireTime > 0)
             {
                 ApplyReturnMoney(it.Key, applyData);
             }
         }
         MarryApplyList.Clear();
     }
 }
Пример #6
0
 public static void ApplyReturnMoney(int roleID, MarryApplyData applyData, GameClient client = null)
 {
     if (client == null)
     {
         client = GameManager.ClientMgr.FindClient(roleID);
     }
     if (client != null)
     {
         if (applyData.ApplyType == MarryApplyType.ApplyInit)
         {
             GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, MarryLogic.MarryCost, "求婚超时返回钻石", ActivityTypes.None, "");
         }
         else if (applyData.ApplyType == MarryApplyType.ApplyDivorce)
         {
             GameManager.ClientMgr.AddMoney1(client, MarryLogic.DivorceCost, "离婚超时返还绑金", true);
         }
     }
 }
Пример #7
0
 public static void ApplyPeriodicClear(long ticks)
 {
     if (ticks >= MarryLogic.NextPeriodicCheckTime)
     {
         MarryLogic.NextPeriodicCheckTime = ticks + 10000L;
         lock (MarryLogic.MarryApplyList)
         {
             foreach (KeyValuePair <int, MarryApplyData> it in MarryLogic.MarryApplyList.ToList <KeyValuePair <int, MarryApplyData> >())
             {
                 MarryApplyData applyData = it.Value;
                 if (applyData.ApplyExpireTime > 0L && applyData.ApplyExpireTime <= ticks)
                 {
                     MarryLogic.ApplyReturnMoney(it.Key, applyData, null);
                     applyData.ApplyExpireTime = 0L;
                 }
                 if (applyData.ApplyCDEndTime <= ticks)
                 {
                     MarryLogic.MarryApplyList.Remove(it.Key);
                 }
             }
         }
     }
 }