From d7bb467b74c78370a5274db9e2be92fb91ae7997 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 27 十月 2025 14:14:21 +0800
Subject: [PATCH] 125 战斗 BUFF图标配置未配置 设置为空的防错 (空的都做了防错)
---
Main/Utility/ComponentExtersion.cs | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/Main/Utility/ComponentExtersion.cs b/Main/Utility/ComponentExtersion.cs
index 17601fc..5c562a4 100644
--- a/Main/Utility/ComponentExtersion.cs
+++ b/Main/Utility/ComponentExtersion.cs
@@ -290,6 +290,12 @@
return;
}
+ if (string.IsNullOrEmpty(_id))
+ {
+ Debug.LogError("Image SetSprite id is null or empty " + _id);
+ return;
+ }
+
var sprite = UILoader.LoadSprite(_id);
_image.overrideSprite = sprite;
}
@@ -302,6 +308,12 @@
return;
}
+ if (string.IsNullOrEmpty(_id))
+ {
+ Debug.LogError("TextImage SetSprite id is null or empty " + _id);
+ return;
+ }
+
var sprite = UILoader.LoadSprite(_id);
_textImage.sprite = sprite;
}
@@ -311,6 +323,12 @@
{
if (_image == null)
{
+ return;
+ }
+
+ if (string.IsNullOrEmpty(iconName))
+ {
+ Debug.LogError("SetOrgSprite iconName is null or empty " + iconName);
return;
}
@@ -332,6 +350,12 @@
return;
}
+ if (string.IsNullOrEmpty(itemConfig.IconKey))
+ {
+ Debug.LogError("SetItemSprite IconKey is null or empty for itemID " + itemID);
+ return;
+ }
+
var sprite = UILoader.LoadSprite("icon", itemConfig.IconKey);
_image.overrideSprite = sprite;
}
@@ -346,6 +370,12 @@
var skillConfig = SkillConfig.Get(skillID);
if (skillConfig == null)
{
+ return;
+ }
+
+ if (string.IsNullOrEmpty(skillConfig.IconName))
+ {
+ Debug.LogError("SetSkillSprite IconName is null or empty for skillID " + skillID);
return;
}
@@ -388,6 +418,12 @@
return;
}
+ if (string.IsNullOrEmpty(_id))
+ {
+ Debug.LogError("SetTexture2DPNG id is null or empty " + _id);
+ return;
+ }
+
var texture = UILoader.LoadTexture2DPNG(_id);
_image.texture = texture;
}
--
Gitblit v1.8.0