创建标签系统包

This commit is contained in:
MuHua-123
2025-02-27 17:40:31 +08:00
parent 27aed5f684
commit cf0e273205
125 changed files with 13817 additions and 62 deletions
@@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 单例模块
/// </summary>
public abstract class ModuleSingle<T> : MonoBehaviour where T : ModuleSingle<T> {
/// <summary> 模块单例 </summary>
public static T I => instance;
/// <summary> 模块单例 </summary>
protected static T instance;
/// <summary> 核心模块 </summary>
protected virtual ModuleCore ModuleCore => ModuleCore.I;
/// <summary> 初始化 </summary>
protected abstract void Awake();
/// <summary> 替换 </summary>
protected virtual void Replace(bool isDontDestroy = true) {
if (instance != null) { Destroy(instance.gameObject); }
instance = (T)this;
if (isDontDestroy) { DontDestroyOnLoad(gameObject); }
}
/// <summary> 不替换 </summary>
protected virtual void NoReplace(bool isDontDestroy = true) {
if (isDontDestroy) { DontDestroyOnLoad(gameObject); }
if (instance == null) { instance = (T)this; }
else { Destroy(gameObject); }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 121ca341c2100df4b94d707ed24452f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: