mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 将所有小写的命名空间导入更正为首字母大写格式 - 统一 GFramework 框架的命名空间引用规范 - 修复 core、ecs、godot 等模块的命名空间导入错误 - 标准化文档示例代码中的 using 语句格式 - 确保所有文档中的命名空间引用保持一致性 - 更新 global using 语句以匹配正确的命名空间格式
38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
namespace GFramework.Godot.Extensions;
|
||
|
||
/// <summary>
|
||
/// 提供对 Godot 路径相关操作的扩展方法。
|
||
/// 包含判断路径类型的功能,例如用户数据路径(user://)和资源路径(res://)。
|
||
/// </summary>
|
||
public static class GodotPathExtensions
|
||
{
|
||
/// <summary>
|
||
/// 判断指定路径是否为 Godot 用户数据路径(user://)。
|
||
/// </summary>
|
||
/// <param name="path">待检查的路径字符串。</param>
|
||
/// <returns>如果路径以 "user://" 开头且不为空,则返回 true;否则返回 false。</returns>
|
||
public static bool IsUserPath(this string path)
|
||
{
|
||
return !string.IsNullOrEmpty(path) && path.StartsWith("user://");
|
||
}
|
||
|
||
/// <summary>
|
||
/// 判断指定路径是否为 Godot 资源路径(res://)。
|
||
/// </summary>
|
||
/// <param name="path">待检查的路径字符串。</param>
|
||
/// <returns>如果路径以 "res://" 开头且不为空,则返回 true;否则返回 false。</returns>
|
||
public static bool IsResPath(this string path)
|
||
{
|
||
return !string.IsNullOrEmpty(path) && path.StartsWith("res://");
|
||
}
|
||
|
||
/// <summary>
|
||
/// 判断指定路径是否为 Godot 特殊路径(user:// 或 res://)。
|
||
/// </summary>
|
||
/// <param name="path">待检查的路径字符串。</param>
|
||
/// <returns>如果路径是用户数据路径或资源路径,则返回 true;否则返回 false。</returns>
|
||
public static bool IsGodotPath(this string path)
|
||
{
|
||
return path.IsUserPath() || path.IsResPath();
|
||
}
|
||
} |