This repository was archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
MonoManager
syadeu edited this page Apr 15, 2021
·
8 revisions
Namespace: Syadeu
public abstract class MonoManager<T> : ManagerEntity, IStaticMonoManager where T : Component, IStaticMonoManagerInheritance: ManagerEntity -> MonoManager<T>
Implements: IStaticMonoManager
- 사용자가 모노스크립트내, 설정값이나 씬마다 유동적으로 배치 할 수 있는 싱글톤 객체를 만들 수 있습니다.
- StaticManager와 기능과 작동부는 거의 같지만, MonoManager는 초기화 함수가 Awake에서 작동한다는 점이 가장 다릅니다.
MonoManager는 게임 전역에서 사용되지않거나, 해당 씬에서만 사용되어야되는 싱글톤 객체를 만들기 위한 abstract class 입니다.
StaticManager와 동일한 override Property이 존재하고, override bool ManualInitialize = true로 void Awake() 함수에서 자동으로 초기화 되는 것이 아닌, 사용자가 초기화 타이밍을 결정 할 수 있는 것이 가장 큰 차이점이라고 말할 수 있습니다.
Override로 StaticManager와 유사하게 만들 수 있지만, Instance 변수에 접근시 싱글톤이 즉시 생성되는 것이 아니기에 이 점을 유의하여야됩니다.
아래는 간단한 MonoManager를 만드는 방법에 대해 설명합니다.
public sealed class TestMonoManager : MonoManager<TestMonoManager>
{
// 기본값은 null 입니다.
public override string DisplayName => "IMTESTMONO";
// 기본값은 false 입니다.
public override bool DontDestory => false;
// 기본값은 false 입니다.
public override bool HideInHierarchy => false;
// 이 매니저가 Awake 함수에서 Initialize 함수를 호출할 것인지를 설정합니다.
// 기본값은 false 입니다.
public override bool ManualInitialize => false;
public string m_UserStringValue = null;
public int m_UserIntValue = 0;
protected override void Awake()
{
Debug.Log($"1. Has Instance = {HasInstance}\n1. Is Initialized = {Initialized}");
// 이 base.Awake()를 절때 지우면 안됩니다.
base.Awake();
Debug.Log($"2. Has Instance = {HasInstance}\n2. Is Initialized = {Initialized}");
}
public override void OnInitialize()
{
Debug.Log("Initialized");
}
public override void OnStart()
{
Debug.Log("Started");
}
// Expected Log
//
// 1. Has Instance = false
// 1. Is Initialized = false
// Initialized
// Started
// 2. Has Instance = true
// 2. Is Initialized = true
}| Name | Description |
|---|---|
| System | CoreSystem 의 인스턴스입니다. |
| Name | Description |
|---|---|
| Initialized | 이 매니저가 초기화되었나요? |
| HasInstance | 이 매니저가 싱글톤을 갖고있나요? |
| Instance | 이 매니저의 싱글톤입니다. |
| Name | Description |
|---|---|
| Flag | 이 매니저의 내부 SystemFlag 입니다. |
| DisplayName | Hierarchy에서 표시될 이름을 설정합니다. 런타임에 아무런 영향을 주지 않습니다. |
| DontDestroy | 씬이 전환되어도 파괴되지 않을 것인지를 설정합니다. |
| HideInHierarchy | Hierarchy에 표시될지를 설정합니다. 빌드에서는 아무런 기능을 하지 않습니다. |
| ManualInitialize | 사용자에 의해 수동으로 초기화 할지를 설정합니다. StaticManager를 상속받고 있으면 값은 무조건 false이며 override 될 수 없습니다. |
| Name | Description |
|---|---|
| ThreadAwaiter | 해당 시간만큼 이 메소드가 실행된 스레드를 sleep 합니다. |
| Name | Description |
|---|---|
| Awake | 유니티 Awake입니다. 이 메소드를 사용하려면 override 를 하고, base.Awake() 를 남겨놓으세요. |
| Name | Description |
|---|---|
| Initialize | 초기화 함수입니다. |
| OnInitialize | 초기화 될 때 실행될 함수입니다. |
| OnStart | 초기화가 다 끝나고 실행될 함수입니다. |
| Name | Description |
|---|---|
| InstanceGroupTr | 인스턴스 매니저들이 부모로 삼는 최상위 Transform 입니다. |
| ManagerLock | 사용하지마세요 |
| Name | Description |
|---|---|
| MainThread | 유니티 메인 스레드를 반환합니다. |
| BackgroundThread | 백그라운드 스레드를 반환합니다. |
| Name | Description |
|---|---|
| IsMainthread | 이 메소드가 실행된 스레드가 유니티 메인스레드인지 반환합니다. |
| Name | Description |
|---|---|
| StartUnityUpdate | 입력한 iterator를 유니티 메인 스레드에서 iteration 합니다. |
| StartBackgroundUpdate | 입력한 iterator를 백그라운드 스레드에서 iteration 합니다. |
| StopUnityUpdate | 입력한 CoreRoutine을 정지합니다. |
| StopBackgroundUpdate | 입력한 CoreRoutine을 정지합니다. |
- Interfaces
- Enums
- SystemFlag
- CoreSystemExceptionFlag
- UserTagFlag
- CustomTagFlag
- ObValueDetection
- ConsoleFlag
- CommandSetting
- Attributes
- Abstract Classes
- Classes
- CoreSystem
- CoreSystemSettings
- PrefabManager
- PrefabList
- RenderManager
- RenderController
-
ConsoleWindow
- CommandDefinition
- CommandField
- CommandRequires
- FMODSystem
- UserTagNameModule
- CustomTagNameModule
- Timer
- BackgroundJob
- ForegroundJob
- WaitForBackgroundJob
- WaitForBackgroundJobWorker
- WaitForForegroundJob
- WaitForTimer
- BackgroundJobWorker
- ObArray
- ObClass
- ObDictionary
- ObList
- ObQueue
- ObValue
- ExtensionMethods
- ThreadSafe
- Structs
- CoreRoutine
- SQLiteDatabase
- SQLiteTable
- SQLiteColumn
- SQLiteVersionInfoTableData
- Bound
- Pole
- Vector2
- Vector3
- Exceptions
- Syadeu.Presentation
- PresentationManager
- SceneList
- EntityDataList
- CustomLoadingScene
- DefaultPresentationGroup
- PresentationGroupEntity
- IPresentationSystemGroup
- PresentationSystemGroup<T>
- PresentationSystem<T>
- PresentationSystem<TGroup, TSystem>
- PresentationSystemEntity<T>
- PresentationSystemModule<TSystem>
- PresentationSystemID
- INotifySystemModule<TModule>
- IExecutable<T>
- PresentationLoop
- PresentationResult
- IReference
- Reference
- SubSystemAttribute
- LoadingSceneSetupEntity
- SceneReference
- SceneSystem
- EntitySystem
- EntityBoundSystem
- EntityRaycastSystem
- EntityExtensionMethods
- AttributeAcceptOnlyAttribute
- EntityAcceptOnlyAttribute
- CoroutineSystem
- CoroutineJob
- ICoroutineJob
- UpdateLoop
- RaycastInfo
- ObjectBase
- ProcessorBase
- WaitForPresentationSystem<T>
- WaitForProxy<T>
- Syadeu.Collections
- AABB
- Plane
- PropertyBlockBase
- PropertyBlock<T>
- ActionWrapper
- BinaryGrid
- CLRContainer
- CLRSingleTone
- CLSTypedDictionary<TValue>
- CLSTypedDictionary<TKey, TValue>
- Direction
- EntityID
- EntityShortID
- IEntityDataID
- IInstance
- IInstance<T>
- Instance
- Instance<T>
- InstanceID
- FixedInstanceList16<T>
- FixedInstanceList64<T>
- IFixedReference
- IFixedReference<T>
- FixedReference
- FixedReference<T>
- FixedReferenceList16<T>
- FixedReferenceList64<T>
- IFixedReferenceList<T>
- FixedListExtensionMethods
- IEntity
- IEntityData
- IAttribute
- IObject
- IEntityComponent
- IPrefabReference
- IPrefabResource
- IEmpty
- IValidation
- FNV1a32
- FNV1a64
- Hash
- Syadeu.Collections.Converters
- Syadeu.Collections.Proxy
- Syadeu.Presentation.Proxy
- Syadeu.Presentation.Internal
- Syadeu.Presentation.Entities
- Syadeu.Presentation.Attributes
- Syadeu.Presentation.Components
- Syadeu.Presentation.Actions
- Syadeu.Presentation.Render
- CameraData
- CameraFrustum
- IntersectionType
- RenderSystem
- WorldCanvasSystem
- Syadeu.Presentation.Data
- DataContainerSystem
- DataObjectBase
- EntityAnimationClipEventData