diff --git a/locals/Log.csv b/locals/Log.csv index 2c63795..b50f575 100644 --- a/locals/Log.csv +++ b/locals/Log.csv @@ -15,4 +15,5 @@ room_data_missing,房间数据缺失。,Room data missing.,部屋データが欠 failed_to_calculate_the_room_location,计算房间{0}位置时失败。,Failed to calculate the location of room {0}.,部屋{0}の位置を計算するのに失敗します。 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}に配置しました。 \ No newline at end of file +room_placement_information,房间{0}已被成功放置在{1}。,Room {0} has been successfully placed in {1}.,部屋{0}を{1}に配置しました。 +slogan_not_exist,找不到位于{0}的标语文件。,The tagline file at {0} could not be found.,{0}にある標語ファイルが見つかりません。 \ No newline at end of file diff --git a/locals/Log.en.translation b/locals/Log.en.translation index 51b0b48..746750f 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 ef41ed4..c329b63 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 dccd558..ef316a3 100644 Binary files a/locals/Log.zh.translation and b/locals/Log.zh.translation differ diff --git a/scripts/Config.cs b/scripts/Config.cs index 1247775..663d5a4 100644 --- a/scripts/Config.cs +++ b/scripts/Config.cs @@ -139,6 +139,16 @@ public static class Config return OS.HasFeature("debug"); } + /// + /// Whether to run on the editor + /// 是否在编辑器上运行 + /// + /// + public static bool IsEditor() + { + return OS.HasFeature("editor"); + } + public enum OsEnum { //unknown diff --git a/scripts/health/HealthBar.cs b/scripts/health/HealthBar.cs index 97d7b12..b6acb3d 100644 --- a/scripts/health/HealthBar.cs +++ b/scripts/health/HealthBar.cs @@ -14,10 +14,13 @@ public partial class HealthBar : TextureProgressBar /// public void SetFriendlyTones() { + //The border color is Open Gray 0 //边框颜色为Open Gray 0 TintOver = new Color("#f8f9fa"); + //The background color is Open Green 1 //背景色为Open Green 1 TintUnder = new Color("#d3f9d8"); + //The progress bar color is Open Green 5 //进度条颜色为Open Green 5 TintProgress = new Color("#51cf66"); } @@ -28,10 +31,13 @@ public partial class HealthBar : TextureProgressBar /// public void SetEnemyTones() { + //The border color is Open Gray 0 //边框颜色为Open Gray 0 TintOver = new Color("#f8f9fa"); + //The background color is Open Red 1 //背景色为Open Red 1 TintUnder = new Color("#ffe3e3"); + //The progress bar color is Open Red 5 //进度条颜色为Open Red 5 TintProgress = new Color("#ff6b6b"); } diff --git a/scripts/map/room/RoomFactory.cs b/scripts/map/room/RoomFactory.cs index 0ef6993..d49a553 100644 --- a/scripts/map/room/RoomFactory.cs +++ b/scripts/map/room/RoomFactory.cs @@ -26,11 +26,12 @@ public static class RoomFactory var resList = new List(); foreach (var roomTemplate in roomTemplateSet) { + var roomTemplatePath = ResUtils.GetRunTimeResPath(roomTemplate); //Detects whether it is a folder //检测是否为文件夹 - if (DirAccess.DirExistsAbsolute(roomTemplate)) + if (DirAccess.DirExistsAbsolute(roomTemplatePath)) { - using var dir = DirAccess.Open(roomTemplate); + using var dir = DirAccess.Open(roomTemplatePath); if (dir != null) { dir.ListDirBegin(); @@ -39,7 +40,7 @@ public static class RoomFactory { if (!dir.CurrentIsDir()) { - resList.Add(Path.Join(roomTemplate, fileName)); + resList.Add(Path.Join(roomTemplatePath, fileName)); } fileName = dir.GetNext(); @@ -47,9 +48,9 @@ public static class RoomFactory } } - if (FileAccess.FileExists(roomTemplate)) + if (FileAccess.FileExists(roomTemplatePath)) { - resList.Add(roomTemplate); + resList.Add(roomTemplatePath); } } @@ -75,7 +76,7 @@ public static class RoomFactory var room = new Room { - RoomScene = GD.Load(ResUtils.GetAbsolutePath(resPath)) + RoomScene = GD.Load(ResUtils.GetEditorResPath(resPath)) }; return room; } diff --git a/scripts/utils/ResUtils.cs b/scripts/utils/ResUtils.cs index 5c022bb..e142f61 100644 --- a/scripts/utils/ResUtils.cs +++ b/scripts/utils/ResUtils.cs @@ -2,17 +2,61 @@ namespace ColdMint.scripts.utils; -public class ResUtils +/// +/// ResUtils +/// 资源文件工具类 +/// +public static class ResUtils { + /// + /// The suffix that the game engine adds to the resource file while the game is running + /// 游戏运行时,游戏引擎为资源文件添加的后缀 + /// + private const string Suffix = ".remap"; + /// /// The game returns the res directory with a.remap suffix at runtime, causing an error while loading the resource /// 游戏在运行时返回res目录后带有.remap后缀,导致加载资源时出错 /// /// /// - public static string GetAbsolutePath(string path) + public static string GetEditorResPath(string path) { - var index = path.LastIndexOf(".remap", StringComparison.Ordinal); + if (Config.IsEditor()) + { + return path; + } + + var index = path.LastIndexOf(Suffix, StringComparison.Ordinal); return index > -1 ? path[..index] : path; } + + /// + /// Gets the runtime path of the resource file + /// 获取资源文件运行时路径 + /// + /// + /// + public static string GetRunTimeResPath(string path) + { + if (Config.IsEditor()) + { + return path; + } + + //Determine whether the path is a file path + //判断路径是否为文件路径 + var symbolIndex = path.LastIndexOf('.'); + if (symbolIndex > -1) + { + //Found the file symbol + //找到了文件符号 + var index = path.LastIndexOf(Suffix, StringComparison.Ordinal); + return index > -1 ? path : path + Suffix; + } + else + { + return path; + } + } } \ No newline at end of file