This commit is contained in:
MuHua-123
2025-01-14 14:41:05 +08:00
parent 55be3e8f83
commit 35de23040f
13 changed files with 29 additions and 104 deletions
@@ -1,26 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 单个独立模块
/// </summary>
public abstract class ModuleSingle<Data> : MonoBehaviour {
/// <summary> 模块单例 </summary>
public static ModuleSingle<Data> I => instance;
/// <summary> 模块单例 </summary>
protected static ModuleSingle<Data> instance;
/// <summary> 初始化 </summary>
protected virtual void Awake() {
if (instance != null) { Destroy(instance.gameObject); }
instance = this;
}
/// <summary> 打开 </summary>
public virtual void Open(Data data) { throw new NotImplementedException(); }
/// <summary> 完成 </summary>
public virtual void Complete() { throw new NotImplementedException(); }
/// <summary> 关闭 </summary>
public virtual void Close() { throw new NotImplementedException(); }
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 121ca341c2100df4b94d707ed24452f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,15 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SingleTest : ModuleSingle<string> {
// Start is called before the first frame update
void Start() {
I.Open("ss");
}
// Update is called once per frame
void Update() {
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7cd3fb8ca73868a46bf1ff920e0cdc13
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: