Esempio n. 1
0
 private static void CheckRoomStatus()
 {
     using (PlayerBussiness playerBussiness = new PlayerBussiness())
     {
         MarryRoomInfo[] marryRoomInfo = playerBussiness.GetMarryRoomInfo();
         MarryRoomInfo[] array         = marryRoomInfo;
         for (int i = 0; i < array.Length; i++)
         {
             MarryRoomInfo marryRoomInfo2 = array[i];
             if (marryRoomInfo2.ServerID == GameServer.Instance.Configuration.ServerID)
             {
                 TimeSpan timeSpan = DateTime.Now - marryRoomInfo2.BeginTime;
                 int      num      = marryRoomInfo2.AvailTime * 60 - (int)timeSpan.TotalMinutes;
                 if (num > 0)
                 {
                     MarryRoomMgr.CreateMarryRoomFromDB(marryRoomInfo2, num);
                 }
                 else
                 {
                     playerBussiness.DisposeMarryRoomInfo(marryRoomInfo2.ID);
                     if (GameServer.Instance.LoginServer != null)
                     {
                         Console.WriteLine(marryRoomInfo2.Name);
                         GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(marryRoomInfo2.GroomID);
                         GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(marryRoomInfo2.BrideID);
                         GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(marryRoomInfo2.GroomID, false, marryRoomInfo2);
                         GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(marryRoomInfo2.BrideID, false, marryRoomInfo2);
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 private static void CheckRoomStatus()
 {
     using (PlayerBussiness db = new PlayerBussiness())
     {
         MarryRoomInfo[] roomInfos = db.GetMarryRoomInfo();
         MarryRoomInfo[] array     = roomInfos;
         for (int i = 0; i < array.Length; i++)
         {
             MarryRoomInfo roomInfo = array[i];
             if (roomInfo.ServerID == GameServer.Instance.Config.ServerID)
             {
                 TimeSpan usedTime = DateTime.Now - roomInfo.BeginTime;
                 int      timeLeft = roomInfo.AvailTime * 60 - (int)usedTime.TotalMinutes;
                 if (timeLeft > 0)
                 {
                     MarryRoomMgr.CreateMarryRoomFromDB(roomInfo, timeLeft);
                 }
                 else
                 {
                     db.DisposeMarryRoomInfo(roomInfo.ID);
                     GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(roomInfo.GroomID);
                     GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(roomInfo.BrideID);
                     GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(roomInfo.GroomID, false, roomInfo);
                     GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(roomInfo.BrideID, false, roomInfo);
                 }
             }
         }
     }
 }
Esempio n. 3
0
 public static bool Init()
 {
     MarryRoomMgr._Rooms = new Dictionary <int, MarryRoom>();
     try
     {
         MarryRoomMgr.CheckRoomStatus();
     }
     catch (Exception ex)
     {
         MarryRoomMgr.log.Error(ex.Message);
     }
     return(true);
 }
Esempio n. 4
0
 public static bool Init()
 {
     MarryRoomMgr._Rooms = new Dictionary <int, MarryRoom>();
     MarryRoomMgr.CheckRoomStatus();
     return(true);
 }