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
RecycleableDatabase
syadeu edited this page Apr 15, 2021
·
4 revisions
Namespace: Syadeu.Database
public abstract class RecycleableDatabase<T> : IRecycleable, IDisposable, IValidation where T : class재사용 가능 데이터 객체입니다.
Inheritance: System.Object -> RecycleableDatabase
Derived: FMODSound
Implements: IRecycleable, IDisposable, IValidation
- 데이터 기반 객체를 쉽게 풀링할 수 있습니다.
아래는 간단하게 데이터 객체를 정의하고, 해당 객체를 풀링하는 방법에 대해 설명합니다.
// 객체를 정의할때, 이 객체는 여러 코드에서 재사용이 될 객체가 됨으로,
// 생성자를 통해 초기값을 정의하는 것이 아닌,
// override OnInitialize를 통해 초기값을 정의하여야 합니다.
public sealed class TestClass : RecycleableDatabase<TestClass>
{
/*
... Some Datas ...
*/
protected override void OnInitialize()
{
/*
... Some Initialize Codes ...
*/
}
}
public void TestPullingData()
{
Debug.Log($"Instance Count: {TestClass.InstanceCount}");
// 풀링할 인스턴스가 남아있으면 받아옵니다.
// 이 예제에서는 이전에 아무 인스턴스도 만들지 않았으므로 null 를 반환합니다.
TestClass _ins = TestClass.GetDatabase();
if (_ins == null)
{
// new 키워드로 객체를 생성하면 자동으로 해당 객체의
// 풀링 시스템에 편입됩니다.
// 편입된 직후 객체는 Initialize를 호출합니다.
_ins = new TestClass();
}
Debug.Log($"Instance Count: {TestClass.InstanceCount}");
// 사용이 끝나면, 끝났음을 알리고 재사용 풀로 돌려보냅니다.
_ins.Terminate();
}| Name | Description |
|---|---|
| InstanceCount | 이 객체 타입의 총 인스턴스 갯수를 반환합니다. |
| Instances | 이 객체 타입의 인스턴스들을 반환합니다. |
| Name | Description |
|---|---|
| DataIndex | 인스턴스의 고유 인덱스입니다. |
| Activated | 이 객체가 사용 중 인지 반환합니다. |
| Disposed | 이 객체의 메모리가 방출될 예정인지 반환합니다. |
Deprecated transform |
|
Deprecated WaitForDeletion |
| Name | Description |
|---|---|
| GetInstance | |
| GetDatabase |
| Name | Description |
|---|---|
| IsMainThread | 이 메소드가 실행된 스레드가 유니티 메인스레드인지 반환합니다. |
| Name | Description |
|---|---|
| OnInitialize | 이 오브젝트가 재사용 풀에서 대기 중, 요청에 의해 다시 꺼내져왔을때 호출되는 함수입니다. |
| OnTerminate | 이 오브젝트가 사용을 마치고, 재사용 풀로 되돌아 갈때 호출되는 함수입니다. |
| Name | Description |
|---|---|
| Initialize | 이 객체를 초기화합니다. |
| Terminate | 이 오브젝트의 사용이 완료되었음을 알리는 함수입니다. |
| Dispose | 이 객체를 메모리에서 방출합니다. |
| IsValid | 이 객체가 유효한지 반환합니다. |
- 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