using UnityEngine; namespace TH1Resource { /// /// 缓存所有 AnimationClip 的资源,避免多次同步加载调用。 /// 所有动画通过该类统一访问。 /// public class AnimCache { private bool _initialized = false; //gridVFX相关像话 public AnimationClip GridVFXShowUp; public AnimationClip GridVFXShowOut; public AnimationClip GridVFXHurt; public AnimationClip GridVFXDie; public AnimationClip GridVFXDieHint; public AnimationClip GridVFXTreasure; public AnimationClip GridVFXHeal; public AnimationClip GridVFXDamage; // 提示气泡动画 public AnimationClip HintBubbleIdle; public AnimationClip HintBubbleShow; public AnimationClip HintBubbleHide; public AnimationClip HintTextShow; public AnimationClip HintTextHide; //------- Hint相关参数 // 通用UI动画 public AnimationClip UICommonPanelFadeIn; public AnimationClip UICommonPanelFadeOut; public AnimationClip UIToggleButtonTurnOn; public AnimationClip UIToggleButtonTurnOff; // TODO: 根据需要添加更多动画资源,例如单位攻击、死亡、特效等 /// /// 初始化方法,在第一次使用前调用 /// public void Init() { if (_initialized) return; // 加载动画资源 GridVFXShowUp = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayHeal"); GridVFXShowOut = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayFog"); GridVFXHurt = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayAttack"); GridVFXDie = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayDie"); GridVFXDieHint = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayDieHint"); GridVFXTreasure = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayTreasure"); GridVFXHeal = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayHeal"); GridVFXDamage = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayDamage"); HintBubbleIdle = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayHint"); HintBubbleShow = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayHintShow"); HintBubbleHide = TH1Resource.ResourceLoader.Load("Animations/VFX/PlayHintHide"); HintTextShow = HintBubbleShow; HintTextHide = HintBubbleHide; UICommonPanelFadeIn = TH1Resource.ResourceLoader.Load("Animations/UI/Common/PanelFadeIn"); UICommonPanelFadeOut = TH1Resource.ResourceLoader.Load("Animations/UI/Common/PanelFadeOut"); UIToggleButtonTurnOn = TH1Resource.ResourceLoader.Load("Animations/UI/ToggleButton/ToggleButtonTurnOn"); UIToggleButtonTurnOff = TH1Resource.ResourceLoader.Load("Animations/UI/ToggleButton/ToggleButtonTurnOff"); _initialized = true; } } }