refactor: 移除废弃的 TimelineManager 和 MonoCenter
This commit is contained in:
@@ -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>(T kit) where T : IMonoKit
|
||||
{
|
||||
_iocContainer.Register(kit);
|
||||
OnUpdate += kit.OnUpdate;
|
||||
}
|
||||
|
||||
private void Unregister<T>() where T : class, IMonoKit
|
||||
{
|
||||
var kit = _iocContainer.Unregister<T>();
|
||||
OnUpdate -= kit.OnUpdate;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
OnUpdate?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransTest : IMonoKit
|
||||
{
|
||||
public void OnUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public interface IMonoKit
|
||||
{
|
||||
void OnUpdate();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93f180e6eb06c9f40a52e2bba277fc6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user