diff --git a/Assets/Scripts/Framework/OtherKit/MonoCenter.cs b/Assets/Scripts/Framework/OtherKit/MonoCenter.cs deleted file mode 100644 index 89b4b3211..000000000 --- a/Assets/Scripts/Framework/OtherKit/MonoCenter.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using UnityEngine; - -namespace AibisDream.Framework -{ - public class MonoCenter : MonoBehaviour - { - public static event Action OnUpdate; - - public static MonoCenter Mono; - private static IOCContainer _iocContainer; - - private void Awake() - { - if (Mono) - Destroy(Mono.gameObject); - else Mono = this; - - InitKits(); - } - - private void InitKits() - { - _iocContainer ??= new IOCContainer(); - // 在这里添加相应的工具 - Register(new TransTest()); - } - - private void Register(T kit) where T : IMonoKit - { - _iocContainer.Register(kit); - OnUpdate += kit.OnUpdate; - } - - private void Unregister() where T : class, IMonoKit - { - var kit = _iocContainer.Unregister(); - OnUpdate -= kit.OnUpdate; - } - - private void Update() - { - OnUpdate?.Invoke(); - } - } - - public class TransTest : IMonoKit - { - public void OnUpdate() - { - } - } - - public interface IMonoKit - { - void OnUpdate(); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Framework/OtherKit/MonoCenter.cs.meta b/Assets/Scripts/Framework/OtherKit/MonoCenter.cs.meta deleted file mode 100644 index e78586fec..000000000 --- a/Assets/Scripts/Framework/OtherKit/MonoCenter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 93f180e6eb06c9f40a52e2bba277fc6e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Framework/TimelineKit.meta b/Assets/Scripts/Framework/TimelineKit.meta deleted file mode 100644 index 2f6beb66e..000000000 --- a/Assets/Scripts/Framework/TimelineKit.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 81a3c7f5c3edcc94e83bef49a64c7183 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Framework/TimelineKit/TimelineManager.cs b/Assets/Scripts/Framework/TimelineKit/TimelineManager.cs deleted file mode 100644 index 785407f99..000000000 --- a/Assets/Scripts/Framework/TimelineKit/TimelineManager.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Playables; - -public class TimelineManager : MonoBehaviour -{ - public static TimelineManager Instance { get; private set; } - - // 使用字典来管理多个PlayableDirector - private Dictionary directors = new Dictionary(); - - private void Awake() - { - if (Instance == null) - { - Instance = this; - DontDestroyOnLoad(gameObject); // 不销毁 - } - else - { - Destroy(gameObject); - return; - } - - // 自动注册所有子对象中的PlayableDirector - RegisterAllDirectors(); - } - - /// - /// 自动注册所有子对象中的PlayableDirector - /// - private void RegisterAllDirectors() - { - var allDirectors = GetComponentsInChildren(); - foreach (var director in allDirectors) - { - if (director.playableAsset != null) - { - RegisterDirector(director.playableAsset.name, director); - } - } - } - - /// - /// 注册PlayableDirector - /// - /// Timeline的名称 - /// PlayableDirector实例 - public void RegisterDirector(string name, PlayableDirector director) - { - if (!directors.ContainsKey(name)) - { - directors.Add(name, director); - Debug.Log($"Registered PlayableDirector for {name}"); - } - } - - /// - /// 播放指定的Timeline并等待其完成 - /// - /// Timeline的名称 - // [YarnCommand("play_timeline")] - public IEnumerator PlayTimeline(string name) - { - if (directors.TryGetValue(name, out var director)) - { - director.Play(); - Debug.Log($"Timeline {name} playing."); - - // 等待Timeline播放完成 - bool isPlaying = true; - director.stopped += (PlayableDirector aDirector) => { isPlaying = false; }; - - while (isPlaying) - { - yield return null; - } - - Debug.Log($"Timeline {name} finished."); - director.Stop(); - - // 启动重置时间的协程,但不等待其完成 - StartCoroutine(ResetDirectorTimeCoroutine(name)); - } - else - { - Debug.LogError($"PlayableDirector for {name} not found."); - } - } - - private IEnumerator ResetDirectorTimeCoroutine(string name) - { - yield return new WaitForSeconds(2f); - ResetDirectorTime(name); - } - - /// - /// 重置PlayableDirector的时间 - /// - /// Timeline的名称 - public void ResetDirectorTime(string name) - { - if (directors.TryGetValue(name, out var director)) - { - director.time = 0; - director.Evaluate(); // 评估以应用时间重置 - Debug.Log($"Timeline {name} time reset."); - } - else - { - Debug.LogError($"PlayableDirector for {name} not found."); - } - } - - /// - /// 暂停指定的Timeline - /// - /// Timeline的名称 - // [YarnCommand("pause_timeline")] - public void PauseTimeline(string name) - { - if (directors.TryGetValue(name, out var director)) - { - director.Pause(); - Debug.Log($"Timeline {name} paused."); - } - else - { - Debug.LogError($"PlayableDirector for {name} not found."); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Framework/TimelineKit/TimelineManager.cs.meta b/Assets/Scripts/Framework/TimelineKit/TimelineManager.cs.meta deleted file mode 100644 index 2fb50fe13..000000000 --- a/Assets/Scripts/Framework/TimelineKit/TimelineManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ccea65c35014bc24080e71809ed81683 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: