예제 #1
0
        //private bool _isHymeneal;
        //public bool IsHymeneal
        //{
        //    get { return _isHymeneal; }
        //    set { _isHymeneal = value; }
        //}

        public HotSpringRoom(HotSpringRoomInfo info, IHotSpringProcessor processor)
        {
            Info = info;

            _processor = processor;

            _guestsList = new List<GamePlayer>();

            _count = 0;

            //_isHymeneal = false;

            _roomState = eRoomState.FREE;

            _userForbid = new List<int>();

            _userRemoveList = new List<int>();

       }
예제 #2
0
        //public static HotSpringRoom GetHotRoombyID(int id, string pw, ref string msg)
        //{
        //    return ROOM[id - 1];
        //}
        public static HotSpringRoom CreateHotSpringRoomFromDB(HotSpringRoomInfo roomInfo, int timeLeft)
        {
            HotSpringRoom room = null;
            _locker.AcquireWriterLock();
            try
            {
                room = new HotSpringRoom(roomInfo, _processor);
                if (room != null)
                {
                    _Rooms.Add(room.Info.RoomID, room);

                    room.BeginTimer(60 * 1000 * timeLeft);
                    return room;
                }
            }
            finally
            {
                _locker.ReleaseWriterLock();
            }

            return null;
        }
 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     int num = packet.ReadInt();
     try
     {
         TankHotSpringLogicProcessor processor = new TankHotSpringLogicProcessor();
         HotSpringRoomInfo info = new HotSpringRoomInfo {
             RoomID = num
         };
         client.Player.CurrentHotSpringRoom = new HotSpringRoom(info, processor);
     }
     catch
     {
         Console.WriteLine("System Error!");
     }
     HotSpringRoom room = client.Player.CurrentHotSpringRoom;
     using (PlayerBussiness db = new PlayerBussiness())
     {
         db.UpdateHotSpringRoomInfo(room.Info);
     }
     string str = packet.ReadString();
     GSPacketIn pkg = new GSPacketIn(0xca);
     pkg.WriteInt(num);
     pkg.WriteInt(num);
     pkg.WriteString(room.Info.RoomName);
     pkg.WriteString(room.Info.Pwd);
     pkg.WriteInt(1);
     pkg.WriteInt(1);
     pkg.WriteInt(client.Player.PlayerCharacter.ID);
     pkg.WriteString(client.Player.PlayerCharacter.NickName);
     pkg.WriteDateTime(room.Info.BeginTime);
     pkg.WriteString(room.Info.RoomIntroduction);
     pkg.WriteInt(1);
     pkg.WriteInt(10);
     pkg.WriteDateTime(DateTime.Now);
     pkg.WriteInt(10);
     client.SendTCP(pkg);
     return 0;
 }
예제 #4
0
 public bool UpdateHotSpringRoomInfo(HotSpringRoomInfo info)
 {
     bool flag = false;
     try
     {
         SqlParameter[] SqlParameters = new SqlParameter[7]
     {
       new SqlParameter("@RoomID", (object) info.RoomID),
       new SqlParameter("@RoomName", (object) info.RoomName),
       new SqlParameter("@Pwd", (object) info.Pwd),
       new SqlParameter("@AvailTime", (object) info.AvailTime.ToString()),
       new SqlParameter("@BreakTime", (object) info.BreakTime.ToString()),
       new SqlParameter("@roomIntroduction", (object) info.RoomIntroduction),
       new SqlParameter("@Result", SqlDbType.Int)
     };
         SqlParameters[6].Direction = ParameterDirection.ReturnValue;
         this.db.RunProcedure("SP_Update_HotSpringRoomInfo", SqlParameters);
         flag = true;
     }
     catch (Exception ex)
     {
         if (BaseBussiness.log.IsErrorEnabled)
             BaseBussiness.log.Error((object)"UpdateHotSpringRoomInfo", ex);
     }
     return flag;
 }
예제 #5
0
 public HotSpringRoomInfo[] GetHotSpringRoomInfo()
 {
     SqlDataReader ResultDataReader = (SqlDataReader)null;
     List<HotSpringRoomInfo> list = new List<HotSpringRoomInfo>();
     try
     {
         this.db.GetReader(ref ResultDataReader, "SP_Get_HotSpring_Room");
         while (ResultDataReader.Read())
         {
             HotSpringRoomInfo hotSpringRoomInfo = new HotSpringRoomInfo()
             {
                 RoomID = (int)ResultDataReader["RoomID"],
                 RoomName = ResultDataReader["RoomName"] == null ? "" : ResultDataReader["RoomName"].ToString(),
                 PlayerID = (int)ResultDataReader["PlayerID"],
                 PlayerName = ResultDataReader["PlayerName"] == null ? "" : ResultDataReader["PlayerName"].ToString(),
                 Pwd = ResultDataReader["Pwd"].ToString() == null ? "" : ResultDataReader["Pwd"].ToString(),
                 AvailTime = (int)ResultDataReader["AvailTime"],
                 MaxCount = (int)ResultDataReader["MaxCount"],
                 BeginTime = (DateTime)ResultDataReader["BeginTime"],
                 BreakTime = (DateTime)ResultDataReader["BreakTime"],
                 RoomIntroduction = ResultDataReader["RoomIntroduction"] == null ? "" : ResultDataReader["RoomIntroduction"].ToString(),
                 RoomType = (int)ResultDataReader["RoomType"],
                 ServerID = (int)ResultDataReader["ServerID"],
                 RoomNumber = (int)ResultDataReader["RoomNumber"]
             };
             list.Add(hotSpringRoomInfo);
         }
         return list.ToArray();
     }
     catch (Exception ex)
     {
         if (BaseBussiness.log.IsErrorEnabled)
             BaseBussiness.log.Error((object)"HotSpringRoomInfo", ex);
     }
     finally
     {
         if (ResultDataReader != null && !ResultDataReader.IsClosed)
             ResultDataReader.Close();
     }
     return (HotSpringRoomInfo[])null;
 }
예제 #6
0
 public GSPacketIn SendContinuation(GamePlayer player, HotSpringRoomInfo hotSpringRoomInfo)
 {
     throw new NotImplementedException();
 }
예제 #7
0
 public HotSpringRoomInfo[] GetHotSpringRoomInfo()
 {
     SqlDataReader resultDataReader = null;
     List<HotSpringRoomInfo> list = new List<HotSpringRoomInfo>();
     try
     {
         db.GetReader(ref resultDataReader, "SP_Get_HotSpring_Room");
         while (resultDataReader.Read())
         {
             HotSpringRoomInfo item = new HotSpringRoomInfo
             {
                 RoomID = (int)resultDataReader["RoomID"],
                 RoomName = (resultDataReader["RoomName"] == null) ? "" : resultDataReader["RoomName"].ToString(),
                 PlayerID = (int)resultDataReader["PlayerID"],
                 PlayerName = (resultDataReader["PlayerName"] == null) ? "" : resultDataReader["PlayerName"].ToString(),
                 Pwd = (resultDataReader["Pwd"].ToString() == null) ? "" : resultDataReader["Pwd"].ToString(),
                 AvailTime = (int)resultDataReader["AvailTime"],
                 MaxCount = (int)resultDataReader["MaxCount"],
                 BeginTime = (DateTime)resultDataReader["BeginTime"],
                 BreakTime = (DateTime)resultDataReader["BreakTime"],
                 RoomIntroduction = (resultDataReader["RoomIntroduction"] == null) ? "" : resultDataReader["RoomIntroduction"].ToString(),
                 RoomType = (int)resultDataReader["RoomType"],
                 ServerID = (int)resultDataReader["ServerID"],
                 RoomNumber = (int)resultDataReader["RoomNumber"]
             };
             list.Add(item);
         }
         return list.ToArray();
     }
     catch (Exception exception)
     {
         if (BaseBussiness.log.IsErrorEnabled)
         {
             BaseBussiness.log.Error("HotSpringRoomInfo", exception);
         }
     }
     finally
     {
         if (!((resultDataReader == null) || resultDataReader.IsClosed))
         {
             resultDataReader.Close();
         }
     }
     return null;
 }