예제 #1
0
파일: PVPLogic.cs 프로젝트: JoeChen999/scut
        public static bool IsOpen(int userId)
        {
            TimeSpan startTime      = TimeSpan.Parse(GameConfigs.GetString("Pvp_Start_Time_Everyday", "4:00:00"));
            TimeSpan endTime        = TimeSpan.Parse(GameConfigs.GetString("Pvp_End_Time_Everyday", "16:00:00"));
            DateTime todayStartTime = DateTime.Today.Add(startTime);
            DateTime todayEndTime   = DateTime.Today.Add(endTime);
            DateTime now            = DateTime.UtcNow;

            if (now < todayStartTime || now > todayEndTime)
            {
                return(false);
            }
            PlayerLogic p = new PlayerLogic().SetUser(userId);

            if (p.MyPlayer.Level < GameConfigs.GetInt("Pvp_Require_Player_Level", 30))
            {
                return(false);
            }
            return(true);
        }