This commit is contained in:
2025-09-02 14:15:18 +08:00
parent 796c8d845d
commit 8872c20cf2
34 changed files with 2024 additions and 695 deletions

View File

@@ -36,9 +36,10 @@ namespace Main
{
base.OnEnter();
this.RegisterEvent<IntroType, string, string>(IntroType.IntroSprite, OnClickPreviousIntro);
this.RegisterEvent<IntroType, string, string>(IntroType.IntroSpriteName, OnClickPreviousIntro);
this.RegisterEvent<IntroType, RuntimeAnimatorController, string>(IntroType.IntroAnimation, OnAddAnimation);
this.RegisterEvent<IntroType, string, string>(IntroType.IntroAudio, OnClickPreviousIntroAudio);
this.RegisterEvent<IntroType, Sprite, string>(IntroType.IntroSprite, SetIntroSprite);
}
public override void OnExit(float delay = 0)
@@ -46,9 +47,10 @@ namespace Main
base.OnExit(delay);
intro.sprite = null;
intro.gameObject.SetActive(false);
this.UnRegisterEvent<IntroType, string, string>(IntroType.IntroSprite, OnClickPreviousIntro);
this.UnRegisterEvent<IntroType, string, string>(IntroType.IntroSpriteName, OnClickPreviousIntro);
this.UnRegisterEvent<IntroType, string, string>(IntroType.IntroAudio, OnClickPreviousIntroAudio);
this.UnRegisterEvent<IntroType, RuntimeAnimatorController, string>(IntroType.IntroAnimation, OnAddAnimation);
this.UnRegisterEvent<IntroType, Sprite, string>(IntroType.IntroSprite, SetIntroSprite);
var animator = intro.transform.GetComponent<Animator>();
if (animator != null)
{
@@ -70,10 +72,7 @@ namespace Main
{
var handle= YooAssets.LoadAssetAsync<Sprite>(spriteName);
await handle.Task;
intro.sprite = handle.GetAssetObject<Sprite>();
intro.SetNativeSize();
intro.gameObject.SetActive(true);
transformInfo.Set(desc);
SetIntroSprite(handle.GetAssetObject<Sprite>(), desc);
}
public async void OnClickPreviousIntroAudio(string auid, string desc)
@@ -85,7 +84,7 @@ namespace Main
});
SetIntroSprite(info.sprite, desc);
}
private void SetIntroSprite(Sprite sprite, string desc)
public void SetIntroSprite(Sprite sprite, string desc)
{
intro.sprite = sprite;
@@ -95,6 +94,7 @@ namespace Main
}
public enum IntroType
{
IntroSpriteName,
IntroSprite,
IntroAudio,
IntroAnimation