Fixed an issue where maps could not be generated after exporting the project.
解决导出项目后,无法生成地图的问题。
This commit is contained in:
parent
b0da4b049e
commit
fdb8b88c1e
|
@ -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}の位置を計算するのに失敗します。
|
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}。
|
place_existing_rooms,放置已存在的房间{0}。,Place existing rooms {0}.,既存の部屋を置きます{0}。
|
||||||
room_placement_failed,房间{0}放置失败。,Room {0} placement failed.,部屋{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_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}にある標語ファイルが見つかりません。
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -139,6 +139,16 @@ public static class Config
|
||||||
return OS.HasFeature("debug");
|
return OS.HasFeature("debug");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Whether to run on the editor</para>
|
||||||
|
/// <para>是否在编辑器上运行</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsEditor()
|
||||||
|
{
|
||||||
|
return OS.HasFeature("editor");
|
||||||
|
}
|
||||||
|
|
||||||
public enum OsEnum
|
public enum OsEnum
|
||||||
{
|
{
|
||||||
//unknown
|
//unknown
|
||||||
|
|
|
@ -14,10 +14,13 @@ public partial class HealthBar : TextureProgressBar
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetFriendlyTones()
|
public void SetFriendlyTones()
|
||||||
{
|
{
|
||||||
|
//The border color is Open Gray 0
|
||||||
//边框颜色为Open Gray 0
|
//边框颜色为Open Gray 0
|
||||||
TintOver = new Color("#f8f9fa");
|
TintOver = new Color("#f8f9fa");
|
||||||
|
//The background color is Open Green 1
|
||||||
//背景色为Open Green 1
|
//背景色为Open Green 1
|
||||||
TintUnder = new Color("#d3f9d8");
|
TintUnder = new Color("#d3f9d8");
|
||||||
|
//The progress bar color is Open Green 5
|
||||||
//进度条颜色为Open Green 5
|
//进度条颜色为Open Green 5
|
||||||
TintProgress = new Color("#51cf66");
|
TintProgress = new Color("#51cf66");
|
||||||
}
|
}
|
||||||
|
@ -28,10 +31,13 @@ public partial class HealthBar : TextureProgressBar
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetEnemyTones()
|
public void SetEnemyTones()
|
||||||
{
|
{
|
||||||
|
//The border color is Open Gray 0
|
||||||
//边框颜色为Open Gray 0
|
//边框颜色为Open Gray 0
|
||||||
TintOver = new Color("#f8f9fa");
|
TintOver = new Color("#f8f9fa");
|
||||||
|
//The background color is Open Red 1
|
||||||
//背景色为Open Red 1
|
//背景色为Open Red 1
|
||||||
TintUnder = new Color("#ffe3e3");
|
TintUnder = new Color("#ffe3e3");
|
||||||
|
//The progress bar color is Open Red 5
|
||||||
//进度条颜色为Open Red 5
|
//进度条颜色为Open Red 5
|
||||||
TintProgress = new Color("#ff6b6b");
|
TintProgress = new Color("#ff6b6b");
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,12 @@ public static class RoomFactory
|
||||||
var resList = new List<string>();
|
var resList = new List<string>();
|
||||||
foreach (var roomTemplate in roomTemplateSet)
|
foreach (var roomTemplate in roomTemplateSet)
|
||||||
{
|
{
|
||||||
|
var roomTemplatePath = ResUtils.GetRunTimeResPath(roomTemplate);
|
||||||
//Detects whether it is a folder
|
//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)
|
if (dir != null)
|
||||||
{
|
{
|
||||||
dir.ListDirBegin();
|
dir.ListDirBegin();
|
||||||
|
@ -39,7 +40,7 @@ public static class RoomFactory
|
||||||
{
|
{
|
||||||
if (!dir.CurrentIsDir())
|
if (!dir.CurrentIsDir())
|
||||||
{
|
{
|
||||||
resList.Add(Path.Join(roomTemplate, fileName));
|
resList.Add(Path.Join(roomTemplatePath, fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName = dir.GetNext();
|
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
|
var room = new Room
|
||||||
{
|
{
|
||||||
RoomScene = GD.Load<PackedScene>(ResUtils.GetAbsolutePath(resPath))
|
RoomScene = GD.Load<PackedScene>(ResUtils.GetEditorResPath(resPath))
|
||||||
};
|
};
|
||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,61 @@
|
||||||
|
|
||||||
namespace ColdMint.scripts.utils;
|
namespace ColdMint.scripts.utils;
|
||||||
|
|
||||||
public class ResUtils
|
/// <summary>
|
||||||
|
/// <para>ResUtils</para>
|
||||||
|
/// <para>资源文件工具类</para>
|
||||||
|
/// </summary>
|
||||||
|
public static class ResUtils
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>The suffix that the game engine adds to the resource file while the game is running</para>
|
||||||
|
/// <para>游戏运行时,游戏引擎为资源文件添加的后缀</para>
|
||||||
|
/// </summary>
|
||||||
|
private const string Suffix = ".remap";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>The game returns the res directory with a.remap suffix at runtime, causing an error while loading the resource</para>
|
/// <para>The game returns the res directory with a.remap suffix at runtime, causing an error while loading the resource</para>
|
||||||
/// <para>游戏在运行时返回res目录后带有.remap后缀,导致加载资源时出错</para>
|
/// <para>游戏在运行时返回res目录后带有.remap后缀,导致加载资源时出错</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
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;
|
return index > -1 ? path[..index] : path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Gets the runtime path of the resource file</para>
|
||||||
|
/// <para>获取资源文件运行时路径</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user