(client) feat:实现血条显示,实现攻击交互,添加碰撞体;fix:修复部分朝向贴图加载失败的问题;chore:规范工作类和行为获取类命名
This commit is contained in:
@ -90,16 +90,16 @@ namespace Managers
|
||||
}
|
||||
|
||||
// 判断是否为 Unity 资源路径
|
||||
bool isUnityResource = drawOrder.texturePath.StartsWith("res:", StringComparison.OrdinalIgnoreCase);
|
||||
string rootPath = packRootSite[drawOrder.packID];
|
||||
var isUnityResource = drawOrder.texturePath.StartsWith("res:", StringComparison.OrdinalIgnoreCase);
|
||||
var rootPath = packRootSite[drawOrder.packID];
|
||||
|
||||
if (isUnityResource)
|
||||
{
|
||||
// 移除 "res:" 前缀并适配 Unity 资源路径规则
|
||||
string resourceFolder = drawOrder.texturePath.Substring(4).TrimStart('/').Replace('\\', '/');
|
||||
var resourceFolder = drawOrder.texturePath.Substring(4).TrimStart('/').Replace('\\', '/');
|
||||
|
||||
// 加载文件夹下的所有纹理资源
|
||||
Texture2D[] textures = Resources.LoadAll<Texture2D>(resourceFolder);
|
||||
var textures = Resources.LoadAll<Texture2D>(resourceFolder);
|
||||
if (textures == null || textures.Length == 0)
|
||||
{
|
||||
Debug.LogWarning($"No textures found in Unity resource folder: {resourceFolder}");
|
||||
@ -124,7 +124,6 @@ namespace Managers
|
||||
new Vector2(0.5f, 0.5f), // 中心点
|
||||
drawOrder.pixelsPerUnit
|
||||
);
|
||||
|
||||
var name = image.name;
|
||||
|
||||
// 插入纹理
|
||||
@ -269,7 +268,11 @@ namespace Managers
|
||||
sprites.Clear();
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
public Sprite GetSprite(ImageDef ima)
|
||||
{
|
||||
return GetSprite(ima.packID,ima.name);
|
||||
}
|
||||
public Sprite GetSprite(string packID, string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(packID))
|
||||
|
Reference in New Issue
Block a user