diff --git a/data/levelGraphs/test.json b/data/levelGraphs/test.json index 129664f..d6a41bd 100644 --- a/data/levelGraphs/test.json +++ b/data/levelGraphs/test.json @@ -46,7 +46,7 @@ "res://prefab/roomTemplates/dungeon/" ], "Tags": null, - "RoomInjectionProcessorData": "[\n {\n \"Id\": \"Chance\",\n \"Config\": \"{\\\"Chance\\\":35.5}\"\n }\n]" + "RoomInjectionProcessorData": "[\n {\n \"Id\": \"TimeInterval\",\n \"Config\": \"{\\\"DateSpecifiesLevel\\\":0,\\\"StartTime\\\":\\\"2024/1/1 20:34:23\\\",\\\"EndTime\\\":\\\"2025/1/1 20:34:23\\\"}\"\n }\n]" } ] } \ No newline at end of file diff --git a/locals/Log.csv b/locals/Log.csv index 2062ba1..a60b247 100644 --- a/locals/Log.csv +++ b/locals/Log.csv @@ -16,4 +16,5 @@ failed_to_calculate_the_room_location,计算房间{0}位置时失败。,Failed t place_existing_rooms,放置已存在的房间{0}。,Place existing rooms {0}.,既存の部屋を置きます{0}。 room_placement_failed,房间{0}放置失败。,Room {0} placement failed.,部屋{0}の放置に失敗します。 room_placement_information,房间{0}已被成功放置在{1}。,Room {0} has been successfully placed in {1}.,部屋{0}を{1}に配置しました。 -room_injection_processor_does_not_exist,找不到房间注入处理器{0},请检测是否在MapGenerator内注册。,"Room injection processor {0} not found, check to see if it is registered in MapGenerator.",部屋注入プロセッサ{0}が見つかりません、MapGenerator内に登録されているかどうか検出してください。 \ No newline at end of file +room_injection_processor_does_not_exist,找不到房间注入处理器{0},请检测是否在MapGenerator内注册。,"Room injection processor {0} not found, check to see if it is registered in MapGenerator.",部屋注入プロセッサ{0}が見つかりません、MapGenerator内に登録されているかどうか検出してください。 +time_range_debug,当前时间:{0}起始时间:{1},结束时间{2},是否在范围内{3},"Current time: {0} Start time: {1}, end time {2}, whether in range {3}",現在時間:{0}開始時間:{1}終了時間{2}範囲内かどうか{3}です \ No newline at end of file diff --git a/locals/Log.en.translation b/locals/Log.en.translation index 8a37c69..3607ef0 100644 Binary files a/locals/Log.en.translation and b/locals/Log.en.translation differ diff --git a/locals/Log.jp.translation b/locals/Log.jp.translation index c79b462..401598a 100644 Binary files a/locals/Log.jp.translation and b/locals/Log.jp.translation differ diff --git a/locals/Log.zh.translation b/locals/Log.zh.translation index b125571..e819175 100644 Binary files a/locals/Log.zh.translation and b/locals/Log.zh.translation differ diff --git a/scripts/map/roomInjectionProcessor/TimeIntervalRoomInjectorProcessor.cs b/scripts/map/roomInjectionProcessor/TimeIntervalRoomInjectorProcessor.cs index ee88205..aa5085f 100644 --- a/scripts/map/roomInjectionProcessor/TimeIntervalRoomInjectorProcessor.cs +++ b/scripts/map/roomInjectionProcessor/TimeIntervalRoomInjectorProcessor.cs @@ -35,16 +35,47 @@ public class configData.EndTime = configData.StartTime; } - var now = DateTime.Now; - if (!configData.SpecifiedYear) + if (configData.DateSpecifiesLevel == null) { - //If no year is specified, it is automatically added to the current year - //若未指定年份,则自动补充为当前年份 - var nowYear = now.Year; - configData.StartTime = $"{nowYear}-{configData.StartTime}"; - configData.EndTime = $"{nowYear}-{configData.EndTime}"; + //If no date level is specified, the default is 0 + //若未指定日期等级,则默认为0 + configData.DateSpecifiesLevel = 0; } + var now = DateTime.Now; + var nowYear = now.Year; + var nowMonth = now.Month; + switch (configData.DateSpecifiesLevel) + { + case 0: + //The complete time is specified in the format yyyy/MM/dd hh:mm:ss + //指定了完整的时间,格式如:yyyy/MM/dd hh:mm:ss + break; + case 1: + //No year is specified. The format is mm/dd hh:mm:ss + //未指定年份。格式如:MM/dd hh:mm:ss + configData.StartTime = $"{nowYear}/{configData.StartTime}"; + configData.EndTime = $"{nowYear}/{configData.EndTime}"; + break; + case 2: + //No year and month are specified. The format is dd hh:mm:ss + //未指定年份和月份。格式如:dd hh:mm:ss + configData.StartTime = $"{nowYear}/{nowMonth}/{configData.StartTime}"; + configData.EndTime = $"{nowYear}/{nowMonth}/{configData.EndTime}"; + break; + case 3: + //No year, month, and day are specified. The format is hh:mm:ss + //未指定年份、月份和日期。格式如:hh:mm:ss + configData.StartTime = $"{nowYear}/{nowMonth}/{now.Day} {configData.StartTime}"; + configData.EndTime = $"{nowYear}/{nowMonth}/{now.Day} {configData.EndTime}"; + break; + case 4: + //No year, month, day, and hour are specified. The format is mm:ss + //未指定年份、月份、日期和小时。格式如:mm:ss + configData.StartTime = $"{nowYear}/{nowMonth}/{now.Day} {now.Hour}:{configData.StartTime}"; + configData.EndTime = $"{nowYear}/{nowMonth}/{now.Day} {now.Hour}:{configData.EndTime}"; + break; + } return Task.FromResult(TimeUtils.IsBetweenTimeSpan(now, configData.StartTime, configData.EndTime)); } @@ -52,33 +83,25 @@ public class public class ConfigData { /// - /// Whether to specify a year - /// 是否指定年份 + /// Date specifies the level + /// 日期指定的等级 /// /// - ///If true, then Year can be specified in StartTime and EndTime. The specified year is used to be executed only once in a given year, while configurations that do not specify a year are automatically replenished with the current year (performed annually). - ///如果为true,那么可以在StartTime和EndTime内指定Year。指定年份被用于在特定的年份仅执行一次,而未指定年份的配置会自动补充为当前年份(每年执行)。 + ///Level 0: Specify complete yyyy/MM/DD hh:mm:ss, level 1: yyyy (year automatically uses this year), Level 2: yyyy/MM (year and month automatically uses this month), Level 3: yyyy/MM/DD (automatically uses today), level 4: yyyy/MM/dd hh(The current hour is automatically used) + ///等级0:指定完整的yyyy/MM/dd hh:mm:ss,等级1:yyyy(年份自动采用今年),等级2:yyyy/MM(年份和月份自动采用本年本月),等级3:yyyy/MM/dd(自动采用今天),等级4:yyyy/MM/dd hh(自动采用当前小时) /// - public bool SpecifiedYear { get; set; } + public int? DateSpecifiesLevel { get; set; } /// /// Start time /// 起始时间 /// - /// - ///If the year is not specified, enter data in the format MM-DD hh:mm:ss. If the year is specified, enter data in the format yyyy-MM-dd hh:mm:ss. - ///若未指定年份,则可填入格式为MM-dd hh:mm:ss的数据,若指定了年份,那么请填入yyyy-MM-dd hh:mm:ss格式数据。 - /// public string? StartTime { get; set; } /// /// End time /// 结束时间 /// - /// - ///See StartTime - ///同StartTime - /// public string? EndTime { get; set; } } } \ No newline at end of file diff --git a/scripts/utils/TimeUtils.cs b/scripts/utils/TimeUtils.cs index 4e4c5d4..52bfc43 100644 --- a/scripts/utils/TimeUtils.cs +++ b/scripts/utils/TimeUtils.cs @@ -1,4 +1,5 @@ using System; +using ColdMint.scripts.debug; namespace ColdMint.scripts.utils; @@ -27,6 +28,8 @@ public static class TimeUtils var dtEndTime = Convert.ToDateTime(endTime); var compNum1 = DateTime.Compare(dateTime, dtStartTime); var compNum2 = DateTime.Compare(dateTime, dtEndTime); - return compNum1 >= 0 && compNum2 <= 0; + var result = compNum1 >= 0 && compNum2 <= 0; + LogCat.LogWithFormat("time_range_debug", dateTime, dtStartTime, dtEndTime, result); + return result; } } \ No newline at end of file