| | |
| | | this.id = _id;
|
| | | }
|
| | |
|
| | | public void ParseQuestNormalOpenTime(string timeString, int duration)
|
| | | public void ParseQuestNormalOpenTime(DailyQuestOpenTimeConfig activityOpenTime)
|
| | | {
|
| | | string timeString = activityOpenTime.OpenTime;
|
| | | int duration = activityOpenTime.Duration;
|
| | | var matches = Regex.Matches(timeString, "\\\"[0-9]\\\":\\[[0-9|,|\\[|\\]]+");
|
| | | always = matches.Count == 0;
|
| | |
|
| | |
| | | {
|
| | | hourMinutes.Add(new HourMinute(matches[i].Value, duration));
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | var hourMinutes = dayIndexOpenTimes[dayIndex];
|
| | | hourMinutes.Add(new HourMinute(config.StartHour, config.StartMinute, config.EndHour, config.EndMinute));
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | |
|
| | | // 改成判断日常活动ID不在定制中配置则定制期间正常开启
|
| | | public bool InOpenTime()
|
| | | {
|
| | | if (always)
|
| | |
| | | var isSpecialDay = TimeUtility.OpenWeekCnt <= 1 && (DailyQuestType)id != DailyQuestType.CrossServerPk;
|
| | | var openDayWeek = (int)TimeUtility.openServerDayOfWeek;
|
| | | var dayIndex = TimeUtility.OpenDay + 1;
|
| | | if (isSpecialDay)
|
| | | if (isSpecialDay && specialOpenTimes.Count > 0)
|
| | | {
|
| | | if (specialOpenTimes.ContainsKey(openDayWeek) && specialOpenTimes[openDayWeek].ContainsKey(dayIndex))
|
| | | {
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | var dayOfWeek = (int)TimeUtility.ServerNow.DayOfWeek;
|
| | | if (!openTimes.ContainsKey(dayOfWeek))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | else
|
| | | {
|
| | | var hourMinutes = openTimes[dayOfWeek];
|
| | | for (int i = 0; i < hourMinutes.Count; i++)
|
| | | {
|
| | | if (hourMinutes[i].InOpenTime())
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | |
|
| | | return false;
|
| | | }
|
| | | return IsNormalOpenTime();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | //日常活动开启判断
|
| | | private bool IsNormalOpenTime()
|
| | | {
|
| | | var dayOfWeek = (int)TimeUtility.ServerNow.DayOfWeek;
|
| | | if (!openTimes.ContainsKey(dayOfWeek))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | else
|
| | | {
|
| | | var hourMinutes = openTimes[dayOfWeek];
|
| | | for (int i = 0; i < hourMinutes.Count; i++)
|
| | | {
|
| | | if (hourMinutes[i].InOpenTime())
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | |
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | public bool TryGetTodayNearestOpenTime(out HourMinute _hourMinute)
|
| | | {
|
| | |
| | | var isSpecialDay = TimeUtility.OpenWeekCnt <= 1 && (DailyQuestType)id != DailyQuestType.CrossServerPk;
|
| | | var openDayWeek = (int)TimeUtility.openServerDayOfWeek;
|
| | | var dayIndex = TimeUtility.OpenDay + 1;
|
| | | if (isSpecialDay)
|
| | | if (isSpecialDay && specialOpenTimes.Count > 0)
|
| | | {
|
| | | if (specialOpenTimes.ContainsKey(openDayWeek) && specialOpenTimes[openDayWeek].ContainsKey(dayIndex))
|
| | | {
|
| | |
| | | {
|
| | | List<HourMinute> hourminutes = null;
|
| | | var days = dayIndex + i;
|
| | | if (IsInMixServerCustomDay(days, out mixDayIndex))
|
| | | if (mixServerOpenTimes.Count > 0 && IsInMixServerCustomDay(days, out mixDayIndex))
|
| | | {
|
| | | if (!mixServerOpenTimes.ContainsKey(mixDayIndex))
|
| | | {
|
| | |
| | | }
|
| | | hourminutes = mixServerOpenTimes[mixDayIndex];
|
| | | }
|
| | | else if (days <= maxSpecialDays)
|
| | | else if (specialOpenTimes.Count > 0 && days <= maxSpecialDays)
|
| | | {
|
| | | if (!specialOpenTimes.ContainsKey(openDayWeek)
|
| | | || !specialOpenTimes[openDayWeek].ContainsKey(days))
|
| | |
| | | {
|
| | | List<HourMinute> hourminutes = null;
|
| | | var days = dayIndex + i;
|
| | | if (IsInMixServerCustomDay(days, out mixDayIndex))
|
| | | if (mixServerOpenTimes.Count > 0 && IsInMixServerCustomDay(days, out mixDayIndex))
|
| | | {
|
| | | if (!mixServerOpenTimes.ContainsKey(mixDayIndex))
|
| | | {
|
| | |
| | | }
|
| | | hourminutes = mixServerOpenTimes[mixDayIndex];
|
| | | }
|
| | | else if (days <= maxSpecialDays)
|
| | | else if (specialOpenTimes.Count > 0 && days <= maxSpecialDays)
|
| | | {
|
| | | if (!specialOpenTimes.ContainsKey(openDayWeek)
|
| | | || !specialOpenTimes[openDayWeek].ContainsKey(days))
|
| | |
| | | var beginDay = (int)(beginTime - openServerDay).TotalDays + 1;
|
| | | List<HourMinute> hourMinutes = null;
|
| | |
|
| | | if (IsInMixServerCustomDay(beginDay, out mixDayIndex))
|
| | | if (mixServerOpenTimes.Count > 0 && IsInMixServerCustomDay(beginDay, out mixDayIndex))
|
| | | {
|
| | | if (mixServerOpenTimes.ContainsKey(mixDayIndex))
|
| | | {
|
| | | hourMinutes = mixServerOpenTimes[mixDayIndex];
|
| | | }
|
| | | }
|
| | | else if (beginDay <= maxSpecialDays)
|
| | | else if (specialOpenTimes.Count > 0 && beginDay <= maxSpecialDays)
|
| | | {
|
| | | if (specialOpenTimes.ContainsKey(openDayWeek) && specialOpenTimes[openDayWeek].ContainsKey(beginDay))
|
| | | {
|
| | |
| | | for (int i = beginDay; i <= dayIndex; i++)
|
| | | {
|
| | | hourMinutes = null;
|
| | | if (IsInMixServerCustomDay(i, out mixDayIndex))
|
| | | if (mixServerOpenTimes.Count > 0 && IsInMixServerCustomDay(i, out mixDayIndex))
|
| | | {
|
| | | if (mixServerOpenTimes.ContainsKey(mixDayIndex))
|
| | | {
|
| | | hourMinutes = mixServerOpenTimes[mixDayIndex];
|
| | | }
|
| | | }
|
| | | else if (i <= maxSpecialDays)
|
| | | else if (specialOpenTimes.Count > 0 && i <= maxSpecialDays)
|
| | | {
|
| | | if (specialOpenTimes.ContainsKey(openDayWeek) && specialOpenTimes[openDayWeek].ContainsKey(i))
|
| | | {
|
| | |
| | | var todayWeek = (int)TimeUtility.ServerNow.DayOfWeek;
|
| | | todayWeek = todayWeek == 0 ? 7 : todayWeek;
|
| | | var targetMixOpenDay = week - todayWeek + TimeUtility.MixOpenDay;
|
| | | if (targetMixOpenDay >= 0 && targetMixOpenDay < GeneralDefine.mixServerCustomDays)
|
| | | if (mixServerOpenTimes.Count > 0 && targetMixOpenDay >= 0 && targetMixOpenDay < GeneralDefine.mixServerCustomDays)
|
| | | {
|
| | | mixServerOpenTimes.TryGetValue(targetMixOpenDay + 1, out hourMinutes);
|
| | | }
|
| | |
| | | else
|
| | | {
|
| | | var isSpecificDay = TimeUtility.OpenWeekCnt <= 1;
|
| | | if (isSpecificDay)
|
| | | if (isSpecificDay && specialOpenTimes.Count > 0)
|
| | | {
|
| | | var openDayWeek = (int)TimeUtility.openServerDayOfWeek;
|
| | | var todayWeek = (int)TimeUtility.ServerNow.DayOfWeek;
|
| | |
| | | minuteEnd = _minuteEnd;
|
| | |
|
| | | wholeDay = hourBegin == 0 && minuteBegin == 0 && hourEnd == 0 && minuteEnd == 0;
|
| | |
|
| | | }
|
| | |
|
| | | public bool InOpenTime()
|