示例#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);
                     }
                 }
             }
         }
     }
 }
示例#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);
                 }
             }
         }
     }
 }
示例#3
0
        private static void CheckRoomStatus()
        {
            using (PlayerBussiness db = new PlayerBussiness())
            {
                MarryRoomInfo[] roomInfos = db.GetMarryRoomInfo();

                foreach (MarryRoomInfo roomInfo in roomInfos)
                {
                    //TimeSpan usedTime = roomInfo.BreakTime - roomInfo.BeginTime;
                    //int timeLeft = roomInfo.AvailTime - usedTime.Hours;

                    if (roomInfo.ServerID != GameServer.Instance.Configuration.ServerID)
                    {
                        continue;
                    }

                    TimeSpan usedTime = DateTime.Now - roomInfo.BeginTime;
                    int      timeLeft = roomInfo.AvailTime * 60 - (int)usedTime.TotalMinutes;

                    if (timeLeft > 0)
                    {
                        //创建房间
                        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);
                    }
                }
            }
        }