(client) feat:添加游玩时UI相关贴图,添加3d模型场景按钮,添加多级调色进度条,添加SVG图片包,添加事件定义以及管理器,添加音频管理器,定义部分怪物,添加通信协议定义;fix:修复维度切换错误,修复LogUI显示不正确 (#55)
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: #55
This commit is contained in:
38
Client/Assets/Scripts/Prefab/UIImageAnimator.cs
Normal file
38
Client/Assets/Scripts/Prefab/UIImageAnimator.cs
Normal file
@ -0,0 +1,38 @@
|
||||
// UI/UIImageAnimator.cs
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Base; // 引入Base命名空间以使用BaseAnimator
|
||||
|
||||
namespace UI
|
||||
{
|
||||
[RequireComponent(typeof(Image))]
|
||||
public class UIImageAnimator : BaseAnimator // 继承BaseAnimator
|
||||
{
|
||||
private Image _image; // UI Image组件
|
||||
|
||||
protected override void ValidateComponent()
|
||||
{
|
||||
_image = GetComponent<Image>();
|
||||
if (_image == null)
|
||||
{
|
||||
Debug.LogError("UIImageAnimator requires an Image component.", this);
|
||||
enabled = false; // 禁用脚本如果组件缺失
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetDisplaySprite(Sprite sprite)
|
||||
{
|
||||
if (_image)
|
||||
{
|
||||
_image.sprite = sprite;
|
||||
}
|
||||
}
|
||||
|
||||
// [可选] 如果UIImageAnimator需要任何Awake后特有的初始化逻辑,可以在这里重写
|
||||
// protected override void Awake()
|
||||
// {
|
||||
// base.Awake(); // 确保调用基类的Awake
|
||||
// // 子类特有的初始化
|
||||
// }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user