From 212f4192acd588105c66614f501704f9c9f74b81 Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Mon, 3 Apr 2023 14:05:14 +0800 Subject: [PATCH] Update Update --- Assets/Scenes/main.unity | 142 +- .../Inspector/ObjectPoolComponentInspector.cs | 140 ++ .../ObjectPoolComponentInspector.cs.meta | 3 + .../Inspector/SettingComponentInspector.cs | 73 + .../SettingComponentInspector.cs.meta | 3 + Assets/TEngine/Editor/Utility/HelperInfo.cs | 89 ++ .../TEngine/Editor/Utility/HelperInfo.cs.meta | 3 + .../Utility/LogScriptingDefineSymbols.cs | 14 +- Assets/TEngine/Editor/Utility/OpenFolder.cs | 10 +- .../Editor/Utility/ProfilerDefineSymbols.cs | 4 +- .../DataStruct/GameFrameworkSerializer.cs | 201 +++ .../GameFrameworkSerializer.cs.meta | 3 + .../Runtime/GameFramework/Debugger.meta | 3 + .../GameFramework/Debugger/Component.meta | 3 + ...rComponent.EnvironmentInformationWindow.cs | 89 ++ ...onent.EnvironmentInformationWindow.cs.meta | 3 + ...ggerComponent.GraphicsInformationWindow.cs | 162 +++ ...omponent.GraphicsInformationWindow.cs.meta | 3 + ...nent.InputAccelerationInformationWindow.cs | 38 + ...InputAccelerationInformationWindow.cs.meta | 3 + ...Component.InputCompassInformationWindow.cs | 41 + ...nent.InputCompassInformationWindow.cs.meta | 3 + ...mponent.InputGyroscopeInformationWindow.cs | 42 + ...nt.InputGyroscopeInformationWindow.cs.meta | 3 + ...omponent.InputLocationInformationWindow.cs | 43 + ...ent.InputLocationInformationWindow.cs.meta | 3 + ...Component.InputSummaryInformationWindow.cs | 32 + ...nent.InputSummaryInformationWindow.cs.meta | 3 + ...erComponent.InputTouchInformationWindow.cs | 42 + ...ponent.InputTouchInformationWindow.cs.meta | 3 + .../Component/DebuggerComponent.LogNode.cs | 117 ++ .../DebuggerComponent.LogNode.cs.meta | 3 + ...erComponent.MemoryPoolInformationWindow.cs | 106 ++ ...ponent.MemoryPoolInformationWindow.cs.meta | 3 + ...uggerComponent.NetworkInformationWindow.cs | 61 + ...Component.NetworkInformationWindow.cs.meta | 3 + ...erComponent.ObjectPoolInformationWindow.cs | 86 ++ ...ponent.ObjectPoolInformationWindow.cs.meta | 3 + .../DebuggerComponent.OperationsWindow.cs | 59 + ...DebuggerComponent.OperationsWindow.cs.meta | 3 + ...DebuggerComponent.PathInformationWindow.cs | 28 + ...gerComponent.PathInformationWindow.cs.meta | 3 + ...ggerComponent.ProfilerInformationWindow.cs | 59 + ...omponent.ProfilerInformationWindow.cs.meta | 3 + ...uggerComponent.QualityInformationWindow.cs | 102 ++ ...Component.QualityInformationWindow.cs.meta | 3 + ...t.RuntimeMemoryInformationWindow.Sample.cs | 60 + ...timeMemoryInformationWindow.Sample.cs.meta | 3 + ...omponent.RuntimeMemoryInformationWindow.cs | 134 ++ ...ent.RuntimeMemoryInformationWindow.cs.meta | 3 + ...onent.RuntimeMemorySummaryWindow.Record.cs | 54 + ....RuntimeMemorySummaryWindow.Record.cs.meta | 3 + ...gerComponent.RuntimeMemorySummaryWindow.cs | 122 ++ ...mponent.RuntimeMemorySummaryWindow.cs.meta | 3 + ...ebuggerComponent.SceneInformationWindow.cs | 37 + ...erComponent.SceneInformationWindow.cs.meta | 3 + ...buggerComponent.ScreenInformationWindow.cs | 87 ++ ...rComponent.ScreenInformationWindow.cs.meta | 3 + ...rComponent.ScrollableDebuggerWindowBase.cs | 92 ++ ...onent.ScrollableDebuggerWindowBase.cs.meta | 3 + .../DebuggerComponent.SettingsWindow.cs | 212 +++ .../DebuggerComponent.SettingsWindow.cs.meta | 3 + ...buggerComponent.SystemInformationWindow.cs | 54 + ...rComponent.SystemInformationWindow.cs.meta | 3 + ...DebuggerComponent.TimeInformationWindow.cs | 68 + ...gerComponent.TimeInformationWindow.cs.meta | 3 + .../Debugger/DebuggerActiveWindowType.cs | 28 + .../Debugger/DebuggerActiveWindowType.cs.meta | 3 + .../DebuggerComponent.ConsoleWindow.cs | 500 +++++++ .../DebuggerComponent.ConsoleWindow.cs.meta | 3 + .../Debugger/DebuggerComponent.FpsCounter.cs | 76 + .../DebuggerComponent.FpsCounter.cs.meta | 3 + .../Debugger/DebuggerComponent.cs | 451 ++++++ .../Debugger/DebuggerComponent.cs.meta | 3 + .../DebuggerManager.DebuggerWindowGroup.cs | 300 ++++ ...ebuggerManager.DebuggerWindowGroup.cs.meta | 3 + .../GameFramework/Debugger/DebuggerManager.cs | 134 ++ .../Debugger/DebuggerManager.cs.meta | 3 + .../Debugger/IDebuggerManager.cs | 54 + .../Debugger/IDebuggerManager.cs.meta | 3 + .../GameFramework/Debugger/IDebuggerWindow.cs | 41 + .../Debugger/IDebuggerWindow.cs.meta | 3 + .../Debugger/IDebuggerWindowGroup.cs | 52 + .../Debugger/IDebuggerWindowGroup.cs.meta | 3 + .../GameFramework/GameFrameworkEntry.cs | 10 +- .../{ => GameFramework}/Localization.meta | 0 .../Localization/Language.cs | 0 .../Localization/Language.cs.meta | 0 .../Runtime/GameFramework/ObjectPool.meta | 3 + .../GameFramework/ObjectPool/IObjectPool.cs | 211 +++ .../ObjectPool/IObjectPool.cs.meta | 3 + .../ObjectPool/IObjectPoolManager.cs | 744 ++++++++++ .../ObjectPool/IObjectPoolManager.cs.meta | 3 + .../GameFramework/ObjectPool/ObjectBase.cs | 200 +++ .../ObjectPool/ObjectBase.cs.meta | 3 + .../GameFramework/ObjectPool/ObjectInfo.cs | 115 ++ .../ObjectPool/ObjectInfo.cs.meta | 3 + .../ObjectPool/ObjectPoolBase.cs | 145 ++ .../ObjectPool/ObjectPoolBase.cs.meta | 3 + .../ObjectPool/ObjectPoolComponent.cs | 1023 +++++++++++++ .../ObjectPool/ObjectPoolComponent.cs.meta | 3 + .../ObjectPool/ObjectPoolManager.Object.cs | 189 +++ .../ObjectPoolManager.Object.cs.meta | 3 + .../ObjectPoolManager.ObjectPool.cs | 630 ++++++++ .../ObjectPoolManager.ObjectPool.cs.meta | 3 + .../ObjectPool/ObjectPoolManager.cs | 1296 +++++++++++++++++ .../ObjectPool/ObjectPoolManager.cs.meta | 3 + .../ObjectPool/ReleaseObjectFilterCallback.cs | 15 + .../ReleaseObjectFilterCallback.cs.meta | 3 + .../Runtime/{ => GameFramework}/Resource.meta | 0 .../{ => GameFramework}/Resource/Constant.cs | 0 .../Resource/Constant.cs.meta | 0 .../Resource/HasAssetResult.cs | 0 .../Resource/HasAssetResult.cs.meta | 0 .../Resource/IResourceManager.cs | 0 .../Resource/IResourceManager.cs.meta | 0 .../Resource/Operation.meta | 0 .../Operation/LoadAssetsByTagOperation.cs | 0 .../LoadAssetsByTagOperation.cs.meta | 0 .../Resource/ReadWritePathType.cs | 0 .../Resource/ReadWritePathType.cs.meta | 0 .../Resource/ResourceComponent.cs | 29 + .../Resource/ResourceComponent.cs.meta | 3 + .../Resource/ResourceManager.Services.cs | 0 .../Resource/ResourceManager.Services.cs.meta | 0 .../ResourceManager.StreamingAssetsHelper.cs | 0 ...ourceManager.StreamingAssetsHelper.cs.meta | 0 .../Resource/ResourceManager.cs | 0 .../Resource/ResourceManager.cs.meta | 0 .../Resource/YooAsset.meta | 0 .../Resource/YooAsset/AssetReference.cs | 0 .../Resource/YooAsset/AssetReference.cs.meta | 0 .../Resource/YooAsset/AssetSystem.meta | 0 .../YooAsset/AssetSystem/AssetSystem.cs | 0 .../YooAsset/AssetSystem/AssetSystem.cs.meta | 0 .../YooAsset/AssetSystem/Handles.meta | 0 .../Handles/AssetOperationHandle.cs | 0 .../Handles/AssetOperationHandle.cs.meta | 0 .../Handles/OperationHandleBase.cs | 0 .../Handles/OperationHandleBase.cs.meta | 0 .../Handles/RawFileOperationHandle.cs | 0 .../Handles/RawFileOperationHandle.cs.meta | 0 .../Handles/SceneOperationHandle.cs | 0 .../Handles/SceneOperationHandle.cs.meta | 0 .../Handles/SubAssetsOperationHandle.cs | 0 .../Handles/SubAssetsOperationHandle.cs.meta | 0 .../Resource/YooAsset/AssetSystem/Loader.meta | 0 .../Loader/AssetBundleFileLoader.cs | 0 .../Loader/AssetBundleFileLoader.cs.meta | 0 .../Loader/AssetBundleWebLoader.cs | 0 .../Loader/AssetBundleWebLoader.cs.meta | 0 .../AssetSystem/Loader/BundleLoaderBase.cs | 0 .../Loader/BundleLoaderBase.cs.meta | 0 .../Loader/DependAssetBundleGrouper.cs | 0 .../Loader/DependAssetBundleGrouper.cs.meta | 0 .../AssetSystem/Loader/EBundleLoadMethod.cs | 0 .../Loader/EBundleLoadMethod.cs.meta | 0 .../AssetSystem/Loader/RawBundleFileLoader.cs | 0 .../Loader/RawBundleFileLoader.cs.meta | 0 .../AssetSystem/Loader/RawBundleWebLoader.cs | 0 .../Loader/RawBundleWebLoader.cs.meta | 0 .../Loader/VirtualBundleFileLoader.cs | 0 .../Loader/VirtualBundleFileLoader.cs.meta | 0 .../YooAsset/AssetSystem/Operations.meta | 0 .../Operations/InstantiateOperation.cs | 0 .../Operations/InstantiateOperation.cs.meta | 0 .../Operations/UnloadSceneOperation.cs | 0 .../Operations/UnloadSceneOperation.cs.meta | 0 .../YooAsset/AssetSystem/Provider.meta | 0 .../Provider/BundledAssetProvider.cs | 0 .../Provider/BundledAssetProvider.cs.meta | 0 .../Provider/BundledRawFileProvider.cs | 0 .../Provider/BundledRawFileProvider.cs.meta | 0 .../Provider/BundledSceneProvider.cs | 0 .../Provider/BundledSceneProvider.cs.meta | 0 .../Provider/BundledSubAssetsProvider.cs | 0 .../Provider/BundledSubAssetsProvider.cs.meta | 0 .../AssetSystem/Provider/CompletedProvider.cs | 0 .../Provider/CompletedProvider.cs.meta | 0 .../Provider/DatabaseAssetProvider.cs | 0 .../Provider/DatabaseAssetProvider.cs.meta | 0 .../Provider/DatabaseRawFileProvider.cs | 0 .../Provider/DatabaseRawFileProvider.cs.meta | 0 .../Provider/DatabaseSceneProvider.cs | 0 .../Provider/DatabaseSceneProvider.cs.meta | 0 .../Provider/DatabaseSubAssetsProvider.cs | 0 .../DatabaseSubAssetsProvider.cs.meta | 0 .../AssetSystem/Provider/ProviderBase.cs | 0 .../AssetSystem/Provider/ProviderBase.cs.meta | 0 .../Resource/YooAsset/CacheSystem.meta | 0 .../YooAsset/CacheSystem/CacheFileInfo.cs | 0 .../CacheSystem/CacheFileInfo.cs.meta | 0 .../YooAsset/CacheSystem/CacheSystem.cs | 0 .../YooAsset/CacheSystem/CacheSystem.cs.meta | 0 .../YooAsset/CacheSystem/EVerifyLevel.cs | 0 .../YooAsset/CacheSystem/EVerifyLevel.cs.meta | 0 .../YooAsset/CacheSystem/EVerifyResult.cs | 0 .../CacheSystem/EVerifyResult.cs.meta | 0 .../YooAsset/CacheSystem/Operations.meta | 0 .../ClearUnusedCacheFilesOperation.cs | 0 .../ClearUnusedCacheFilesOperation.cs.meta | 0 .../CacheSystem/Operations/Internal.meta | 0 .../Internal/FindCacheFilesOperation.cs | 0 .../Internal/FindCacheFilesOperation.cs.meta | 0 .../Internal/VerifyCacheFilesOperation.cs | 0 .../VerifyCacheFilesOperation.cs.meta | 0 .../Internal/VerifyTempFileOperation.cs | 0 .../Internal/VerifyTempFileOperation.cs.meta | 0 .../Operations/PackageCachingOperation.cs | 0 .../PackageCachingOperation.cs.meta | 0 .../YooAsset/CacheSystem/PackageCache.cs | 0 .../YooAsset/CacheSystem/PackageCache.cs.meta | 0 .../YooAsset/CacheSystem/VerifyElement.cs | 0 .../CacheSystem/VerifyElement.cs.meta | 0 .../Resource/YooAsset/DiagnosticSystem.meta | 0 .../DiagnosticSystem/DebugBundleInfo.cs | 0 .../DiagnosticSystem/DebugBundleInfo.cs.meta | 0 .../DiagnosticSystem/DebugPackageData.cs | 0 .../DiagnosticSystem/DebugPackageData.cs.meta | 0 .../DiagnosticSystem/DebugProviderInfo.cs | 0 .../DebugProviderInfo.cs.meta | 0 .../YooAsset/DiagnosticSystem/DebugReport.cs | 0 .../DiagnosticSystem/DebugReport.cs.meta | 0 .../DiagnosticSystem/RemoteCommand.cs | 0 .../DiagnosticSystem/RemoteCommand.cs.meta | 0 .../DiagnosticSystem/RemoteDebuggerDefine.cs | 0 .../RemoteDebuggerDefine.cs.meta | 0 .../RemoteDebuggerInRuntime.cs | 0 .../RemoteDebuggerInRuntime.cs.meta | 0 .../Resource/YooAsset/DownloadSystem.meta | 0 .../YooAsset/DownloadSystem/DownloadReport.cs | 0 .../DownloadSystem/DownloadReport.cs.meta | 0 .../YooAsset/DownloadSystem/DownloadSystem.cs | 0 .../DownloadSystem/DownloadSystem.cs.meta | 0 .../YooAsset/DownloadSystem/Downloader.meta | 0 .../Downloader/DownloadHandlerFileRange.cs | 0 .../DownloadHandlerFileRange.cs.meta | 0 .../Downloader/DownloaderBase.cs | 0 .../Downloader/DownloaderBase.cs.meta | 0 .../Downloader/FileDownloader.cs | 0 .../Downloader/FileDownloader.cs.meta | 0 .../Downloader/TempDownloader.cs | 0 .../Downloader/TempDownloader.cs.meta | 0 .../DownloadSystem/ThreadSyncContext.cs | 0 .../DownloadSystem/ThreadSyncContext.cs.meta | 0 .../DownloadSystem/UnityWebDataRequester.cs | 0 .../UnityWebDataRequester.cs.meta | 0 .../DownloadSystem/UnityWebFileRequester.cs | 0 .../UnityWebFileRequester.cs.meta | 0 .../Resource/YooAsset/InitializeParameters.cs | 0 .../YooAsset/InitializeParameters.cs.meta | 0 .../Resource/YooAsset/OperationSystem.meta | 0 .../OperationSystem/AsyncOperationBase.cs | 0 .../AsyncOperationBase.cs.meta | 0 .../OperationSystem/EOperationStatus.cs | 0 .../OperationSystem/EOperationStatus.cs.meta | 0 .../OperationSystem/GameAsyncOperation.cs | 0 .../GameAsyncOperation.cs.meta | 0 .../OperationSystem/OperationSystem.cs | 0 .../OperationSystem/OperationSystem.cs.meta | 0 .../Resource/YooAsset/PackageSystem.meta | 0 .../YooAsset/PackageSystem/AssetInfo.cs | 0 .../YooAsset/PackageSystem/AssetInfo.cs.meta | 0 .../YooAsset/PackageSystem/BundleInfo.cs | 0 .../YooAsset/PackageSystem/BundleInfo.cs.meta | 0 .../YooAsset/PackageSystem/ManifestTools.cs | 0 .../PackageSystem/ManifestTools.cs.meta | 0 .../YooAsset/PackageSystem/Operations.meta | 0 .../Operations/DownloaderOperation.cs | 0 .../Operations/DownloaderOperation.cs.meta | 0 .../Operations/InitializationOperation.cs | 0 .../InitializationOperation.cs.meta | 0 .../PackageSystem/Operations/Internal.meta | 0 .../Internal/DeserializeManifestOperation.cs | 0 .../DeserializeManifestOperation.cs.meta | 0 .../Internal/DownloadManifestOperation.cs | 0 .../DownloadManifestOperation.cs.meta | 0 .../Internal/LoadBuildinManifestOperation.cs | 0 .../LoadBuildinManifestOperation.cs.meta | 0 .../Internal/LoadCacheManifestOperation.cs | 0 .../LoadCacheManifestOperation.cs.meta | 0 .../Internal/LoadEditorManifestOperation.cs | 0 .../LoadEditorManifestOperation.cs.meta | 0 .../QueryBuildinPackageVersionOperation.cs | 0 ...ueryBuildinPackageVersionOperation.cs.meta | 0 .../QueryCachePackageHashOperation.cs | 0 .../QueryCachePackageHashOperation.cs.meta | 0 .../QueryCachePackageVersionOperation.cs | 0 .../QueryCachePackageVersionOperation.cs.meta | 0 .../QueryRemotePackageVersionOperation.cs | 0 ...QueryRemotePackageVersionOperation.cs.meta | 0 .../UnpackBuildinManifestOperation.cs | 0 .../UnpackBuildinManifestOperation.cs.meta | 0 .../Operations/PreDownloadContentOperation.cs | 0 .../PreDownloadContentOperation.cs.meta | 0 .../UpdatePackageManifestOperation.cs | 0 .../UpdatePackageManifestOperation.cs.meta | 0 .../UpdatePackageVersionOperation.cs | 0 .../UpdatePackageVersionOperation.cs.meta | 0 .../YooAsset/PackageSystem/PackageAsset.cs | 0 .../PackageSystem/PackageAsset.cs.meta | 0 .../YooAsset/PackageSystem/PackageBundle.cs | 0 .../PackageSystem/PackageBundle.cs.meta | 0 .../YooAsset/PackageSystem/PackageManifest.cs | 0 .../PackageSystem/PackageManifest.cs.meta | 0 .../YooAsset/PackageSystem/PlayMode.meta | 0 .../PlayMode/EditorSimulateModeHelper.cs | 0 .../PlayMode/EditorSimulateModeHelper.cs.meta | 0 .../PlayMode/EditorSimulateModeImpl.cs | 0 .../PlayMode/EditorSimulateModeImpl.cs.meta | 0 .../PlayMode/HostPlayModeImpl.cs | 0 .../PlayMode/HostPlayModeImpl.cs.meta | 0 .../PlayMode/OfflinePlayModeImpl.cs | 0 .../PlayMode/OfflinePlayModeImpl.cs.meta | 0 .../Resource/YooAsset/Properties.meta | 0 .../YooAsset/Properties/AssemblyInfo.cs | 0 .../YooAsset/Properties/AssemblyInfo.cs.meta | 0 .../Resource/YooAsset/ResourcePackage.cs | 0 .../Resource/YooAsset/ResourcePackage.cs.meta | 0 .../Resource/YooAsset/Services.meta | 0 .../YooAsset/Services/IDecryptionServices.cs | 0 .../Services/IDecryptionServices.cs.meta | 0 .../YooAsset/Services/IEncryptionServices.cs | 0 .../Services/IEncryptionServices.cs.meta | 0 .../YooAsset/Services/IQueryServices.cs | 0 .../YooAsset/Services/IQueryServices.cs.meta | 0 .../Resource/YooAsset/Services/Internal.meta | 0 .../Services/Internal/IBundleServices.cs | 0 .../Services/Internal/IBundleServices.cs.meta | 0 .../Services/Internal/IPlayModeServices.cs | 0 .../Internal/IPlayModeServices.cs.meta | 0 .../Services/Internal/IRemoteServices.cs | 0 .../Services/Internal/IRemoteServices.cs.meta | 0 .../Resource/YooAsset/Settings.meta | 0 .../YooAsset/Settings/YooAssetSettings.cs | 0 .../Settings/YooAssetSettings.cs.meta | 0 .../YooAsset/Settings/YooAssetSettingsData.cs | 0 .../Settings/YooAssetSettingsData.cs.meta | 0 .../Resource/YooAsset/Utility.meta | 0 .../Resource/YooAsset/Utility/BufferReader.cs | 0 .../YooAsset/Utility/BufferReader.cs.meta | 0 .../Resource/YooAsset/Utility/BufferWriter.cs | 0 .../YooAsset/Utility/BufferWriter.cs.meta | 0 .../YooAsset/Utility/CRC32Algorithm.cs | 0 .../YooAsset/Utility/CRC32Algorithm.cs.meta | 0 .../Resource/YooAsset/Utility/YooHelper.cs | 0 .../YooAsset/Utility/YooHelper.cs.meta | 0 .../Resource/YooAsset/Utility/YooLogger.cs | 0 .../YooAsset/Utility/YooLogger.cs.meta | 0 .../Resource/YooAsset/Utility/YooUtility.cs | 0 .../YooAsset/Utility/YooUtility.cs.meta | 0 .../Resource/YooAsset/YooAssets.cs | 0 .../Resource/YooAsset/YooAssets.cs.meta | 0 .../Resource/YooAsset/YooAssetsDriver.cs | 0 .../Resource/YooAsset/YooAssetsDriver.cs.meta | 0 .../Resource/YooAsset/YooAssetsExtension.cs | 0 .../YooAsset/YooAssetsExtension.cs.meta | 0 .../Resource/YooAsset/YooAssetsLogger.cs | 0 .../Resource/YooAsset/YooAssetsLogger.cs.meta | 0 .../Runtime/GameFramework/Setting.meta | 3 + .../GameFramework/Setting/DefaultSetting.cs | 305 ++++ .../Setting/DefaultSetting.cs.meta | 3 + .../Setting/DefaultSettingHelper.cs | 379 +++++ .../Setting/DefaultSettingHelper.cs.meta | 3 + .../Setting/DefaultSettingSerializer.cs | 26 + .../Setting/DefaultSettingSerializer.cs.meta | 3 + .../GameFramework/Setting/ISettingHelper.cs | 199 +++ .../Setting/ISettingHelper.cs.meta | 3 + .../GameFramework/Setting/ISettingManager.cs | 205 +++ .../Setting/ISettingManager.cs.meta | 3 + .../Setting/PlayerPrefsSettingHelper.cs | 304 ++++ .../Setting/PlayerPrefsSettingHelper.cs.meta | 3 + .../GameFramework/Setting/SettingComponent.cs | 318 ++++ .../Setting/SettingComponent.cs.meta | 3 + .../Setting/SettingHelperBase.cs | 200 +++ .../Setting/SettingHelperBase.cs.meta | 3 + .../GameFramework/Setting/SettingManager.cs | 558 +++++++ .../Setting/SettingManager.cs.meta | 3 + 378 files changed, 11605 insertions(+), 21 deletions(-) create mode 100644 Assets/TEngine/Editor/Inspector/ObjectPoolComponentInspector.cs create mode 100644 Assets/TEngine/Editor/Inspector/ObjectPoolComponentInspector.cs.meta create mode 100644 Assets/TEngine/Editor/Inspector/SettingComponentInspector.cs create mode 100644 Assets/TEngine/Editor/Inspector/SettingComponentInspector.cs.meta create mode 100644 Assets/TEngine/Editor/Utility/HelperInfo.cs create mode 100644 Assets/TEngine/Editor/Utility/HelperInfo.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/DataStruct/GameFrameworkSerializer.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/DataStruct/GameFrameworkSerializer.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.EnvironmentInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.EnvironmentInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.GraphicsInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.GraphicsInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputAccelerationInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputAccelerationInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputCompassInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputCompassInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputGyroscopeInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputGyroscopeInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputLocationInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputLocationInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputSummaryInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputSummaryInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputTouchInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputTouchInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.LogNode.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.LogNode.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.MemoryPoolInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.MemoryPoolInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.NetworkInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.NetworkInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ObjectPoolInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ObjectPoolInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.OperationsWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.OperationsWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.PathInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.PathInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ProfilerInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ProfilerInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.QualityInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.QualityInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.Sample.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.Sample.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.Record.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.Record.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SceneInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SceneInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScreenInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScreenInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScrollableDebuggerWindowBase.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScrollableDebuggerWindowBase.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SettingsWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SettingsWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SystemInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SystemInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.TimeInformationWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.TimeInformationWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerActiveWindowType.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerActiveWindowType.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.ConsoleWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.ConsoleWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.FpsCounter.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.FpsCounter.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerManager.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerManager.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindow.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindow.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindowGroup.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindowGroup.cs.meta rename Assets/TEngine/Runtime/{ => GameFramework}/Localization.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Localization/Language.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Localization/Language.cs.meta (100%) create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPool.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPool.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPoolManager.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPoolManager.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectBase.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectBase.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectInfo.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectInfo.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolBase.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolBase.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolComponent.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolComponent.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.Object.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.Object.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ReleaseObjectFilterCallback.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/ObjectPool/ReleaseObjectFilterCallback.cs.meta rename Assets/TEngine/Runtime/{ => GameFramework}/Resource.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/Constant.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/Constant.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/HasAssetResult.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/HasAssetResult.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/IResourceManager.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/IResourceManager.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/Operation.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/Operation/LoadAssetsByTagOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/Operation/LoadAssetsByTagOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/ReadWritePathType.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/ReadWritePathType.cs.meta (100%) create mode 100644 Assets/TEngine/Runtime/GameFramework/Resource/ResourceComponent.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Resource/ResourceComponent.cs.meta rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/ResourceManager.Services.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/ResourceManager.Services.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/ResourceManager.StreamingAssetsHelper.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/ResourceManager.StreamingAssetsHelper.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/ResourceManager.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/ResourceManager.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetReference.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetReference.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/AssetSystem.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/AssetSystem.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Operations.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/CacheFileInfo.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/CacheFileInfo.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/CacheSystem.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/CacheSystem.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/EVerifyLevel.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/EVerifyLevel.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/EVerifyResult.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/EVerifyResult.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/Internal.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/PackageCache.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/PackageCache.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/VerifyElement.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/CacheSystem/VerifyElement.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/DebugReport.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/DebugReport.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/DownloadReport.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/DownloadReport.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/DownloadSystem.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/DownloadSystem.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/InitializeParameters.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/InitializeParameters.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem/EOperationStatus.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem/EOperationStatus.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem/OperationSystem.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/OperationSystem/OperationSystem.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/AssetInfo.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/AssetInfo.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/BundleInfo.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/BundleInfo.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/ManifestTools.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/ManifestTools.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PackageAsset.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PackageAsset.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PackageBundle.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PackageBundle.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PackageManifest.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PackageManifest.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Properties.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Properties/AssemblyInfo.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Properties/AssemblyInfo.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/ResourcePackage.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/ResourcePackage.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/IDecryptionServices.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/IDecryptionServices.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/IEncryptionServices.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/IEncryptionServices.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/IQueryServices.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/IQueryServices.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/Internal.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/Internal/IBundleServices.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/Internal/IBundleServices.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/Internal/IPlayModeServices.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/Internal/IPlayModeServices.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/Internal/IRemoteServices.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Services/Internal/IRemoteServices.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Settings.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Settings/YooAssetSettings.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Settings/YooAssetSettings.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Settings/YooAssetSettingsData.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Settings/YooAssetSettingsData.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/BufferReader.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/BufferReader.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/BufferWriter.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/BufferWriter.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/CRC32Algorithm.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/CRC32Algorithm.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/YooHelper.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/YooHelper.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/YooLogger.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/YooLogger.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/YooUtility.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/Utility/YooUtility.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/YooAssets.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/YooAssets.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/YooAssetsDriver.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/YooAssetsDriver.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/YooAssetsExtension.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/YooAssetsExtension.cs.meta (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/YooAssetsLogger.cs (100%) rename Assets/TEngine/Runtime/{ => GameFramework}/Resource/YooAsset/YooAssetsLogger.cs.meta (100%) create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/DefaultSetting.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/DefaultSetting.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingHelper.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingHelper.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingSerializer.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingSerializer.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/ISettingHelper.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/ISettingHelper.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/ISettingManager.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/ISettingManager.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/PlayerPrefsSettingHelper.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/PlayerPrefsSettingHelper.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/SettingComponent.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/SettingComponent.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/SettingHelperBase.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/SettingHelperBase.cs.meta create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/SettingManager.cs create mode 100644 Assets/TEngine/Runtime/GameFramework/Setting/SettingManager.cs.meta diff --git a/Assets/Scenes/main.unity b/Assets/Scenes/main.unity index 55d90a79..6f9ea4fd 100644 --- a/Assets/Scenes/main.unity +++ b/Assets/Scenes/main.unity @@ -213,6 +213,49 @@ Transform: m_Father: {fileID: 2061060682} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1176880017 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1176880018} + - component: {fileID: 1176880019} + m_Layer: 0 + m_Name: ObjectPool + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1176880018 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1176880017} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2061060682} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1176880019 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1176880017} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da10a6ed68a3439b8a2df5384febd504, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1513514422 GameObject: m_ObjectHideFlags: 0 @@ -222,6 +265,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1513514423} + - component: {fileID: 1513514424} m_Layer: 0 m_Name: Setting m_TagString: Untagged @@ -243,6 +287,20 @@ Transform: m_Father: {fileID: 2061060682} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1513514424 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513514422} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 352db63f3a7b449bac6e5de8bb32141a, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SettingHelperTypeName: TEngine.PlayerPrefsSettingHelper + m_CustomSettingHelper: {fileID: 0} --- !u!1 &1947304784 GameObject: m_ObjectHideFlags: 0 @@ -272,7 +330,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 2061060682} - m_RootOrder: 4 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1947304786 MonoBehaviour: @@ -370,6 +428,49 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2049602905 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2049602906} + - component: {fileID: 2049602907} + m_Layer: 0 + m_Name: Resource + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2049602906 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2049602905} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2061060682} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2049602907 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2049602905} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 77d67944806247f99024bf5307adc918, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &2061060681 GameObject: m_ObjectHideFlags: 0 @@ -402,6 +503,8 @@ Transform: - {fileID: 43232120} - {fileID: 23410075} - {fileID: 1513514423} + - {fileID: 2049602906} + - {fileID: 1176880018} - {fileID: 1947304785} - {fileID: 2108959336} m_Father: {fileID: 0} @@ -438,6 +541,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 2108959336} + - component: {fileID: 2108959337} m_Layer: 0 m_Name: Debugger m_TagString: Untagged @@ -457,5 +561,39 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 2061060682} - m_RootOrder: 5 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2108959337 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2108959335} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d58978a9ed0f473ca3cc5a302c3bf87b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Skin: {fileID: 11400000, guid: a06a4c0455d3ccb45baf4d805cab535a, type: 2} + m_ActiveWindow: 0 + m_ShowFullWindow: 0 + m_ConsoleWindow: + m_LockScroll: 1 + m_MaxLine: 100 + m_InfoFilter: 1 + m_WarningFilter: 1 + m_ErrorFilter: 1 + m_FatalFilter: 1 + m_InfoColor: + serializedVersion: 2 + rgba: 4294967295 + m_WarningColor: + serializedVersion: 2 + rgba: 4278512639 + m_ErrorColor: + serializedVersion: 2 + rgba: 4278190335 + m_FatalColor: + serializedVersion: 2 + rgba: 4281545650 diff --git a/Assets/TEngine/Editor/Inspector/ObjectPoolComponentInspector.cs b/Assets/TEngine/Editor/Inspector/ObjectPoolComponentInspector.cs new file mode 100644 index 00000000..daf4fb96 --- /dev/null +++ b/Assets/TEngine/Editor/Inspector/ObjectPoolComponentInspector.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using UnityEditor; +using UnityEngine; + +namespace TEngine.Editor.Inspector +{ + [CustomEditor(typeof(ObjectPoolComponent))] + internal sealed class ObjectPoolComponentInspector : GameFrameworkInspector + { + private readonly HashSet m_OpenedItems = new HashSet(); + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + if (!EditorApplication.isPlaying) + { + EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info); + return; + } + + ObjectPoolComponent t = (ObjectPoolComponent)target; + + if (IsPrefabInHierarchy(t.gameObject)) + { + EditorGUILayout.LabelField("Object Pool Count", t.Count.ToString()); + + ObjectPoolBase[] objectPools = t.GetAllObjectPools(true); + foreach (ObjectPoolBase objectPool in objectPools) + { + DrawObjectPool(objectPool); + } + } + + Repaint(); + } + + private void OnEnable() + { + } + + private void DrawObjectPool(ObjectPoolBase objectPool) + { + bool lastState = m_OpenedItems.Contains(objectPool.FullName); + bool currentState = EditorGUILayout.Foldout(lastState, objectPool.FullName); + if (currentState != lastState) + { + if (currentState) + { + m_OpenedItems.Add(objectPool.FullName); + } + else + { + m_OpenedItems.Remove(objectPool.FullName); + } + } + + if (currentState) + { + EditorGUILayout.BeginVertical("box"); + { + EditorGUILayout.LabelField("Name", objectPool.Name); + EditorGUILayout.LabelField("Type", objectPool.ObjectType.FullName); + EditorGUILayout.LabelField("Auto Release Interval", objectPool.AutoReleaseInterval.ToString()); + EditorGUILayout.LabelField("Capacity", objectPool.Capacity.ToString()); + EditorGUILayout.LabelField("Used Count", objectPool.Count.ToString()); + EditorGUILayout.LabelField("Can Release Count", objectPool.CanReleaseCount.ToString()); + EditorGUILayout.LabelField("Expire Time", objectPool.ExpireTime.ToString()); + EditorGUILayout.LabelField("Priority", objectPool.Priority.ToString()); + ObjectInfo[] objectInfos = objectPool.GetAllObjectInfos(); + if (objectInfos.Length > 0) + { + EditorGUILayout.LabelField("Name", + objectPool.AllowMultiSpawn ? "Locked\tCount\tFlag\tPriority\tLast Use Time" : "Locked\tIn Use\tFlag\tPriority\tLast Use Time"); + foreach (ObjectInfo objectInfo in objectInfos) + { + EditorGUILayout.LabelField(string.IsNullOrEmpty(objectInfo.Name) ? "" : objectInfo.Name, + objectPool.AllowMultiSpawn + ? Utility.Text.Format("{0}\t{1}\t{2}\t{3}\t{4:yyyy-MM-dd HH:mm:ss}", objectInfo.Locked, objectInfo.SpawnCount, objectInfo.CustomCanReleaseFlag, + objectInfo.Priority, objectInfo.LastUseTime.ToLocalTime()) + : Utility.Text.Format("{0}\t{1}\t{2}\t{3}\t{4:yyyy-MM-dd HH:mm:ss}", objectInfo.Locked, objectInfo.IsInUse, objectInfo.CustomCanReleaseFlag, + objectInfo.Priority, objectInfo.LastUseTime.ToLocalTime())); + } + + if (GUILayout.Button("Release")) + { + objectPool.Release(); + } + + if (GUILayout.Button("Release All Unused")) + { + objectPool.ReleaseAllUnused(); + } + + if (GUILayout.Button("Export CSV Data")) + { + string exportFileName = EditorUtility.SaveFilePanel("Export CSV Data", string.Empty, Utility.Text.Format("Object Pool Data - {0}.csv", objectPool.Name), + string.Empty); + if (!string.IsNullOrEmpty(exportFileName)) + { + try + { + int index = 0; + string[] data = new string[objectInfos.Length + 1]; + data[index++] = Utility.Text.Format("Name,Locked,{0},Custom Can Release Flag,Priority,Last Use Time", + objectPool.AllowMultiSpawn ? "Count" : "In Use"); + foreach (ObjectInfo objectInfo in objectInfos) + { + data[index++] = objectPool.AllowMultiSpawn + ? Utility.Text.Format("{0},{1},{2},{3},{4},{5:yyyy-MM-dd HH:mm:ss}", objectInfo.Name, objectInfo.Locked, objectInfo.SpawnCount, + objectInfo.CustomCanReleaseFlag, objectInfo.Priority, objectInfo.LastUseTime.ToLocalTime()) + : Utility.Text.Format("{0},{1},{2},{3},{4},{5:yyyy-MM-dd HH:mm:ss}", objectInfo.Name, objectInfo.Locked, objectInfo.IsInUse, + objectInfo.CustomCanReleaseFlag, objectInfo.Priority, objectInfo.LastUseTime.ToLocalTime()); + } + + File.WriteAllLines(exportFileName, data, Encoding.UTF8); + Debug.Log(Utility.Text.Format("Export object pool CSV data to '{0}' success.", exportFileName)); + } + catch (Exception exception) + { + Debug.LogError(Utility.Text.Format("Export object pool CSV data to '{0}' failure, exception is '{1}'.", exportFileName, exception)); + } + } + } + } + else + { + GUILayout.Label("Object Pool is Empty ..."); + } + } + EditorGUILayout.EndVertical(); + + EditorGUILayout.Separator(); + } + } + } +} \ No newline at end of file diff --git a/Assets/TEngine/Editor/Inspector/ObjectPoolComponentInspector.cs.meta b/Assets/TEngine/Editor/Inspector/ObjectPoolComponentInspector.cs.meta new file mode 100644 index 00000000..cbb89234 --- /dev/null +++ b/Assets/TEngine/Editor/Inspector/ObjectPoolComponentInspector.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 19febee9477a4fbabaa6edb9ea6b6a00 +timeCreated: 1680501264 \ No newline at end of file diff --git a/Assets/TEngine/Editor/Inspector/SettingComponentInspector.cs b/Assets/TEngine/Editor/Inspector/SettingComponentInspector.cs new file mode 100644 index 00000000..8f973913 --- /dev/null +++ b/Assets/TEngine/Editor/Inspector/SettingComponentInspector.cs @@ -0,0 +1,73 @@ +using UnityEditor; +using UnityEngine; + +namespace TEngine.Editor.Inspector +{ + [CustomEditor(typeof(SettingComponent))] + internal sealed class SettingComponentInspector : GameFrameworkInspector + { + private HelperInfo m_SettingHelperInfo = new HelperInfo("Setting"); + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + SettingComponent t = (SettingComponent)target; + + EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); + { + m_SettingHelperInfo.Draw(); + } + EditorGUI.EndDisabledGroup(); + + if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject)) + { + EditorGUILayout.LabelField("Setting Count", t.Count >= 0 ? t.Count.ToString() : ""); + if (t.Count > 0) + { + string[] settingNames = t.GetAllSettingNames(); + foreach (string settingName in settingNames) + { + EditorGUILayout.LabelField(settingName, t.GetString(settingName)); + } + } + } + + if (EditorApplication.isPlaying) + { + if (GUILayout.Button("Save Settings")) + { + t.Save(); + } + if (GUILayout.Button("Remove All Settings")) + { + t.RemoveAllSettings(); + } + } + + serializedObject.ApplyModifiedProperties(); + + Repaint(); + } + + protected override void OnCompileComplete() + { + base.OnCompileComplete(); + + RefreshTypeNames(); + } + + private void OnEnable() + { + m_SettingHelperInfo.Init(serializedObject); + + RefreshTypeNames(); + } + + private void RefreshTypeNames() + { + m_SettingHelperInfo.Refresh(); + serializedObject.ApplyModifiedProperties(); + } + } +} diff --git a/Assets/TEngine/Editor/Inspector/SettingComponentInspector.cs.meta b/Assets/TEngine/Editor/Inspector/SettingComponentInspector.cs.meta new file mode 100644 index 00000000..faf812ed --- /dev/null +++ b/Assets/TEngine/Editor/Inspector/SettingComponentInspector.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 74b840f402134b97b07f730eb60228f6 +timeCreated: 1680494479 \ No newline at end of file diff --git a/Assets/TEngine/Editor/Utility/HelperInfo.cs b/Assets/TEngine/Editor/Utility/HelperInfo.cs new file mode 100644 index 00000000..72305ad1 --- /dev/null +++ b/Assets/TEngine/Editor/Utility/HelperInfo.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; +using System.Text.RegularExpressions; +using UnityEditor; +using UnityEngine; + +namespace TEngine.Editor +{ + internal sealed class HelperInfo where T : MonoBehaviour + { + private const string CustomOptionName = ""; + + private readonly string m_Name; + + private SerializedProperty m_HelperTypeName; + private SerializedProperty m_CustomHelper; + private string[] m_HelperTypeNames; + private int m_HelperTypeNameIndex; + + public HelperInfo(string name) + { + m_Name = name; + + m_HelperTypeName = null; + m_CustomHelper = null; + m_HelperTypeNames = null; + m_HelperTypeNameIndex = 0; + } + + public void Init(SerializedObject serializedObject) + { + m_HelperTypeName = serializedObject.FindProperty(Utility.Text.Format("m_{0}HelperTypeName", m_Name)); + m_CustomHelper = serializedObject.FindProperty(Utility.Text.Format("m_Custom{0}Helper", m_Name)); + } + + public void Draw() + { + string displayName = FieldNameForDisplay(m_Name); + int selectedIndex = EditorGUILayout.Popup(Utility.Text.Format("{0} Helper", displayName), m_HelperTypeNameIndex, m_HelperTypeNames); + if (selectedIndex != m_HelperTypeNameIndex) + { + m_HelperTypeNameIndex = selectedIndex; + m_HelperTypeName.stringValue = selectedIndex <= 0 ? null : m_HelperTypeNames[selectedIndex]; + } + + if (m_HelperTypeNameIndex <= 0) + { + EditorGUILayout.PropertyField(m_CustomHelper); + if (m_CustomHelper.objectReferenceValue == null) + { + EditorGUILayout.HelpBox(Utility.Text.Format("You must set Custom {0} Helper.", displayName), MessageType.Error); + } + } + } + + public void Refresh() + { + List helperTypeNameList = new List + { + CustomOptionName + }; + + helperTypeNameList.AddRange(Type.GetRuntimeTypeNames(typeof(T))); + m_HelperTypeNames = helperTypeNameList.ToArray(); + + m_HelperTypeNameIndex = 0; + if (!string.IsNullOrEmpty(m_HelperTypeName.stringValue)) + { + m_HelperTypeNameIndex = helperTypeNameList.IndexOf(m_HelperTypeName.stringValue); + if (m_HelperTypeNameIndex <= 0) + { + m_HelperTypeNameIndex = 0; + m_HelperTypeName.stringValue = null; + } + } + } + + private string FieldNameForDisplay(string fieldName) + { + if (string.IsNullOrEmpty(fieldName)) + { + return string.Empty; + } + + string str = Regex.Replace(fieldName, @"^m_", string.Empty); + str = Regex.Replace(str, @"((?<=[a-z])[A-Z]|[A-Z](?=[a-z]))", @" $1").TrimStart(); + return str; + } + } +} diff --git a/Assets/TEngine/Editor/Utility/HelperInfo.cs.meta b/Assets/TEngine/Editor/Utility/HelperInfo.cs.meta new file mode 100644 index 00000000..d8529466 --- /dev/null +++ b/Assets/TEngine/Editor/Utility/HelperInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d2341dcdab9f45559064663e38061622 +timeCreated: 1680494517 \ No newline at end of file diff --git a/Assets/TEngine/Editor/Utility/LogScriptingDefineSymbols.cs b/Assets/TEngine/Editor/Utility/LogScriptingDefineSymbols.cs index 46db70dc..2c51a616 100644 --- a/Assets/TEngine/Editor/Utility/LogScriptingDefineSymbols.cs +++ b/Assets/TEngine/Editor/Utility/LogScriptingDefineSymbols.cs @@ -40,7 +40,7 @@ namespace TEngine.Editor /// /// 禁用所有日志脚本宏定义。 /// - [MenuItem("Game Framework/Log Scripting Define Symbols/Disable All Logs", false, 30)] + [MenuItem("TEngine/Log Scripting Define Symbols/Disable All Logs", false, 30)] public static void DisableAllLogs() { ScriptingDefineSymbols.RemoveScriptingDefineSymbol(EnableLogScriptingDefineSymbol); @@ -59,7 +59,7 @@ namespace TEngine.Editor /// /// 开启所有日志脚本宏定义。 /// - [MenuItem("Game Framework/Log Scripting Define Symbols/Enable All Logs", false, 31)] + [MenuItem("TEngine/Log Scripting Define Symbols/Enable All Logs", false, 31)] public static void EnableAllLogs() { DisableAllLogs(); @@ -69,7 +69,7 @@ namespace TEngine.Editor /// /// 开启调试及以上级别的日志脚本宏定义。 /// - [MenuItem("Game Framework/Log Scripting Define Symbols/Enable Debug And Above Logs", false, 32)] + [MenuItem("TEngine/Log Scripting Define Symbols/Enable Debug And Above Logs", false, 32)] public static void EnableDebugAndAboveLogs() { SetAboveLogScriptingDefineSymbol(EnableDebugAndAboveLogScriptingDefineSymbol); @@ -78,7 +78,7 @@ namespace TEngine.Editor /// /// 开启信息及以上级别的日志脚本宏定义。 /// - [MenuItem("Game Framework/Log Scripting Define Symbols/Enable Info And Above Logs", false, 33)] + [MenuItem("TEngine/Log Scripting Define Symbols/Enable Info And Above Logs", false, 33)] public static void EnableInfoAndAboveLogs() { SetAboveLogScriptingDefineSymbol(EnableInfoAndAboveLogScriptingDefineSymbol); @@ -87,7 +87,7 @@ namespace TEngine.Editor /// /// 开启警告及以上级别的日志脚本宏定义。 /// - [MenuItem("Game Framework/Log Scripting Define Symbols/Enable Warning And Above Logs", false, 34)] + [MenuItem("TEngine/Log Scripting Define Symbols/Enable Warning And Above Logs", false, 34)] public static void EnableWarningAndAboveLogs() { SetAboveLogScriptingDefineSymbol(EnableWarningAndAboveLogScriptingDefineSymbol); @@ -96,7 +96,7 @@ namespace TEngine.Editor /// /// 开启错误及以上级别的日志脚本宏定义。 /// - [MenuItem("Game Framework/Log Scripting Define Symbols/Enable Error And Above Logs", false, 35)] + [MenuItem("TEngine/Log Scripting Define Symbols/Enable Error And Above Logs", false, 35)] public static void EnableErrorAndAboveLogs() { SetAboveLogScriptingDefineSymbol(EnableErrorAndAboveLogScriptingDefineSymbol); @@ -105,7 +105,7 @@ namespace TEngine.Editor /// /// 开启严重错误及以上级别的日志脚本宏定义。 /// - [MenuItem("Game Framework/Log Scripting Define Symbols/Enable Fatal And Above Logs", false, 36)] + [MenuItem("TEngine/Log Scripting Define Symbols/Enable Fatal And Above Logs", false, 36)] public static void EnableFatalAndAboveLogs() { SetAboveLogScriptingDefineSymbol(EnableFatalAndAboveLogScriptingDefineSymbol); diff --git a/Assets/TEngine/Editor/Utility/OpenFolder.cs b/Assets/TEngine/Editor/Utility/OpenFolder.cs index 1b128b2e..a3fa82fa 100644 --- a/Assets/TEngine/Editor/Utility/OpenFolder.cs +++ b/Assets/TEngine/Editor/Utility/OpenFolder.cs @@ -13,7 +13,7 @@ namespace TEngine.Editor /// /// 打开 Data Path 文件夹。 /// - [MenuItem("Game Framework/Open Folder/Data Path", false, 10)] + [MenuItem("TEngine/Open Folder/Data Path", false, 10)] public static void OpenFolderDataPath() { Execute(Application.dataPath); @@ -22,7 +22,7 @@ namespace TEngine.Editor /// /// 打开 Persistent Data Path 文件夹。 /// - [MenuItem("Game Framework/Open Folder/Persistent Data Path", false, 11)] + [MenuItem("TEngine/Open Folder/Persistent Data Path", false, 11)] public static void OpenFolderPersistentDataPath() { Execute(Application.persistentDataPath); @@ -31,7 +31,7 @@ namespace TEngine.Editor /// /// 打开 Streaming Assets Path 文件夹。 /// - [MenuItem("Game Framework/Open Folder/Streaming Assets Path", false, 12)] + [MenuItem("TEngine/Open Folder/Streaming Assets Path", false, 12)] public static void OpenFolderStreamingAssetsPath() { Execute(Application.streamingAssetsPath); @@ -40,7 +40,7 @@ namespace TEngine.Editor /// /// 打开 Temporary Cache Path 文件夹。 /// - [MenuItem("Game Framework/Open Folder/Temporary Cache Path", false, 13)] + [MenuItem("TEngine/Open Folder/Temporary Cache Path", false, 13)] public static void OpenFolderTemporaryCachePath() { Execute(Application.temporaryCachePath); @@ -51,7 +51,7 @@ namespace TEngine.Editor /// /// 打开 Console Log Path 文件夹。 /// - [MenuItem("Game Framework/Open Folder/Console Log Path", false, 14)] + [MenuItem("TEngine/Open Folder/Console Log Path", false, 14)] public static void OpenFolderConsoleLogPath() { Execute(System.IO.Path.GetDirectoryName(Application.consoleLogPath)); diff --git a/Assets/TEngine/Editor/Utility/ProfilerDefineSymbols.cs b/Assets/TEngine/Editor/Utility/ProfilerDefineSymbols.cs index 3fdd5cd6..676e7a13 100644 --- a/Assets/TEngine/Editor/Utility/ProfilerDefineSymbols.cs +++ b/Assets/TEngine/Editor/Utility/ProfilerDefineSymbols.cs @@ -16,7 +16,7 @@ namespace TEngine.Editor /// /// 禁用所有日志脚本宏定义。 /// - [MenuItem("Game Framework/Profiler Define Symbols/Disable All Logs", false, 30)] + [MenuItem("TEngine/Profiler Define Symbols/Disable All Logs", false, 30)] public static void DisableAllLogs() { foreach (string aboveLogScriptingDefineSymbol in AllProfilerDefineSymbols) @@ -28,7 +28,7 @@ namespace TEngine.Editor /// /// 开启所有日志脚本宏定义。 /// - [MenuItem("Game Framework/Profiler Define Symbols/Enable All Logs", false, 31)] + [MenuItem("TEngine/Profiler Define Symbols/Enable All Logs", false, 31)] public static void EnableAllLogs() { DisableAllLogs(); diff --git a/Assets/TEngine/Runtime/GameFramework/DataStruct/GameFrameworkSerializer.cs b/Assets/TEngine/Runtime/GameFramework/DataStruct/GameFrameworkSerializer.cs new file mode 100644 index 00000000..a03560c4 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/DataStruct/GameFrameworkSerializer.cs @@ -0,0 +1,201 @@ +using System.Collections.Generic; +using System.IO; + +namespace TEngine +{ + /// + /// 游戏框架序列化器基类。 + /// + /// 要序列化的数据类型。 + public abstract class GameFrameworkSerializer + { + private readonly Dictionary m_SerializeCallbacks; + private readonly Dictionary m_DeserializeCallbacks; + private readonly Dictionary m_TryGetValueCallbacks; + private byte m_LatestSerializeCallbackVersion; + + /// + /// 初始化游戏框架序列化器基类的新实例。 + /// + public GameFrameworkSerializer() + { + m_SerializeCallbacks = new Dictionary(); + m_DeserializeCallbacks = new Dictionary(); + m_TryGetValueCallbacks = new Dictionary(); + m_LatestSerializeCallbackVersion = 0; + } + + /// + /// 序列化回调函数。 + /// + /// 目标流。 + /// 要序列化的数据。 + /// 是否序列化数据成功。 + public delegate bool SerializeCallback(Stream stream, T data); + + /// + /// 反序列化回调函数。 + /// + /// 指定流。 + /// 反序列化的数据。 + public delegate T DeserializeCallback(Stream stream); + + /// + /// 尝试从指定流获取指定键的值回调函数。 + /// + /// 指定流。 + /// 指定键。 + /// 指定键的值。 + /// 是否从指定流获取指定键的值成功。 + public delegate bool TryGetValueCallback(Stream stream, string key, out object value); + + /// + /// 注册序列化回调函数。 + /// + /// 序列化回调函数的版本。 + /// 序列化回调函数。 + public void RegisterSerializeCallback(byte version, SerializeCallback callback) + { + if (callback == null) + { + throw new GameFrameworkException("Serialize callback is invalid."); + } + + m_SerializeCallbacks[version] = callback; + if (version > m_LatestSerializeCallbackVersion) + { + m_LatestSerializeCallbackVersion = version; + } + } + + /// + /// 注册反序列化回调函数。 + /// + /// 反序列化回调函数的版本。 + /// 反序列化回调函数。 + public void RegisterDeserializeCallback(byte version, DeserializeCallback callback) + { + if (callback == null) + { + throw new GameFrameworkException("Deserialize callback is invalid."); + } + + m_DeserializeCallbacks[version] = callback; + } + + /// + /// 注册尝试从指定流获取指定键的值回调函数。 + /// + /// 尝试从指定流获取指定键的值回调函数的版本。 + /// 尝试从指定流获取指定键的值回调函数。 + public void RegisterTryGetValueCallback(byte version, TryGetValueCallback callback) + { + if (callback == null) + { + throw new GameFrameworkException("Try get value callback is invalid."); + } + + m_TryGetValueCallbacks[version] = callback; + } + + /// + /// 序列化数据到目标流中。 + /// + /// 目标流。 + /// 要序列化的数据。 + /// 是否序列化数据成功。 + public bool Serialize(Stream stream, T data) + { + if (m_SerializeCallbacks.Count <= 0) + { + throw new GameFrameworkException("No serialize callback registered."); + } + + return Serialize(stream, data, m_LatestSerializeCallbackVersion); + } + + /// + /// 序列化数据到目标流中。 + /// + /// 目标流。 + /// 要序列化的数据。 + /// 序列化回调函数的版本。 + /// 是否序列化数据成功。 + public bool Serialize(Stream stream, T data, byte version) + { + byte[] header = GetHeader(); + stream.WriteByte(header[0]); + stream.WriteByte(header[1]); + stream.WriteByte(header[2]); + stream.WriteByte(version); + SerializeCallback callback = null; + if (!m_SerializeCallbacks.TryGetValue(version, out callback)) + { + throw new GameFrameworkException(Utility.Text.Format("Serialize callback '{0}' is not exist.", version)); + } + + return callback(stream, data); + } + + /// + /// 从指定流反序列化数据。 + /// + /// 指定流。 + /// 反序列化的数据。 + public T Deserialize(Stream stream) + { + byte[] header = GetHeader(); + byte header0 = (byte)stream.ReadByte(); + byte header1 = (byte)stream.ReadByte(); + byte header2 = (byte)stream.ReadByte(); + if (header0 != header[0] || header1 != header[1] || header2 != header[2]) + { + throw new GameFrameworkException(Utility.Text.Format("Header is invalid, need '{0}{1}{2}', current '{3}{4}{5}'.", (char)header[0], (char)header[1], (char)header[2], (char)header0, (char)header1, (char)header2)); + } + + byte version = (byte)stream.ReadByte(); + DeserializeCallback callback = null; + if (!m_DeserializeCallbacks.TryGetValue(version, out callback)) + { + throw new GameFrameworkException(Utility.Text.Format("Deserialize callback '{0}' is not exist.", version)); + } + + return callback(stream); + } + + /// + /// 尝试从指定流获取指定键的值。 + /// + /// 指定流。 + /// 指定键。 + /// 指定键的值。 + /// 是否从指定流获取指定键的值成功。 + public bool TryGetValue(Stream stream, string key, out object value) + { + value = null; + byte[] header = GetHeader(); + byte header0 = (byte)stream.ReadByte(); + byte header1 = (byte)stream.ReadByte(); + byte header2 = (byte)stream.ReadByte(); + if (header0 != header[0] || header1 != header[1] || header2 != header[2]) + { + return false; + } + + byte version = (byte)stream.ReadByte(); + TryGetValueCallback callback = null; + if (!m_TryGetValueCallbacks.TryGetValue(version, out callback)) + { + return false; + } + + return callback(stream, key, out value); + } + + /// + /// 获取数据头标识。 + /// + /// 数据头标识。 + protected abstract byte[] GetHeader(); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/DataStruct/GameFrameworkSerializer.cs.meta b/Assets/TEngine/Runtime/GameFramework/DataStruct/GameFrameworkSerializer.cs.meta new file mode 100644 index 00000000..6290c71b --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/DataStruct/GameFrameworkSerializer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1d21d1882be542d0b73cb85f7cfa226c +timeCreated: 1680494414 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger.meta b/Assets/TEngine/Runtime/GameFramework/Debugger.meta new file mode 100644 index 00000000..6ca9e082 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 88f259bd9cbe449da273e6ea3aeab2e4 +timeCreated: 1680489578 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component.meta new file mode 100644 index 00000000..6d758fd5 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9871da9e5bc640969d89e4bd1efd8b4d +timeCreated: 1680489758 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.EnvironmentInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.EnvironmentInformationWindow.cs new file mode 100644 index 00000000..852fe2d2 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.EnvironmentInformationWindow.cs @@ -0,0 +1,89 @@ +using UnityEngine; +#if UNITY_5_5_OR_NEWER +using UnityEngine.Rendering; +#endif + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class EnvironmentInformationWindow : ScrollableDebuggerWindowBase + { + private RootComponent m_RootComponent = null; + + private ResourceComponent m_ResourceComponent = null; + + public override void Initialize(params object[] args) + { + m_RootComponent = GameEntry.GetComponent(); + if (m_RootComponent == null) + { + Log.Fatal("Base component is invalid."); + return; + } + + m_ResourceComponent = GameEntry.GetComponent(); + if (m_ResourceComponent == null) + { + Log.Fatal("Resource component is invalid."); + return; + } + } + + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Environment Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Product Name", Application.productName); + DrawItem("Company Name", Application.companyName); +#if UNITY_5_6_OR_NEWER + DrawItem("Game Identifier", Application.identifier); +#else + DrawItem("Game Identifier", Application.bundleIdentifier); +#endif + DrawItem("Game Framework Version", Version.GameFrameworkVersion); + DrawItem("Game Version", Utility.Text.Format("{0} ({1})", Version.GameVersion, Version.InternalGameVersion)); + DrawItem("Resource Version", (string.IsNullOrEmpty(m_ResourceComponent.ApplicableGameVersion) ? "Unknown" : Utility.Text.Format("{0} ({1})", m_ResourceComponent.ApplicableGameVersion, m_ResourceComponent.InternalResourceVersion))); + DrawItem("Application Version", Application.version); + DrawItem("Unity Version", Application.unityVersion); + DrawItem("Platform", Application.platform.ToString()); + DrawItem("System Language", Application.systemLanguage.ToString()); + DrawItem("Cloud Project Id", Application.cloudProjectId); +#if UNITY_5_6_OR_NEWER + DrawItem("Build Guid", Application.buildGUID); +#endif + DrawItem("Target Frame Rate", Application.targetFrameRate.ToString()); + DrawItem("Internet Reachability", Application.internetReachability.ToString()); + DrawItem("Background Loading Priority", Application.backgroundLoadingPriority.ToString()); + DrawItem("Is Playing", Application.isPlaying.ToString()); +#if UNITY_5_5_OR_NEWER + DrawItem("Splash Screen Is Finished", SplashScreen.isFinished.ToString()); +#else + DrawItem("Is Showing Splash Screen", Application.isShowingSplashScreen.ToString()); +#endif + DrawItem("Run In Background", Application.runInBackground.ToString()); +#if UNITY_5_5_OR_NEWER + DrawItem("Install Name", Application.installerName); +#endif + DrawItem("Install Mode", Application.installMode.ToString()); + DrawItem("Sandbox Type", Application.sandboxType.ToString()); + DrawItem("Is Mobile Platform", Application.isMobilePlatform.ToString()); + DrawItem("Is Console Platform", Application.isConsolePlatform.ToString()); + DrawItem("Is Editor", Application.isEditor.ToString()); + DrawItem("Is Debug Build", Debug.isDebugBuild.ToString()); +#if UNITY_5_6_OR_NEWER + DrawItem("Is Focused", Application.isFocused.ToString()); +#endif +#if UNITY_2018_2_OR_NEWER + DrawItem("Is Batch Mode", Application.isBatchMode.ToString()); +#endif +#if UNITY_5_3 + DrawItem("Stack Trace Log Type", Application.stackTraceLogType.ToString()); +#endif + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.EnvironmentInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.EnvironmentInformationWindow.cs.meta new file mode 100644 index 00000000..56fd055a --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.EnvironmentInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 117d1215a84c42189328f73f5e9eac2d +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.GraphicsInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.GraphicsInformationWindow.cs new file mode 100644 index 00000000..57514c27 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.GraphicsInformationWindow.cs @@ -0,0 +1,162 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class GraphicsInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Graphics Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Device ID", SystemInfo.graphicsDeviceID.ToString()); + DrawItem("Device Name", SystemInfo.graphicsDeviceName); + DrawItem("Device Vendor ID", SystemInfo.graphicsDeviceVendorID.ToString()); + DrawItem("Device Vendor", SystemInfo.graphicsDeviceVendor); + DrawItem("Device Type", SystemInfo.graphicsDeviceType.ToString()); + DrawItem("Device Version", SystemInfo.graphicsDeviceVersion); + DrawItem("Memory Size", Utility.Text.Format("{0} MB", SystemInfo.graphicsMemorySize)); + DrawItem("Multi Threaded", SystemInfo.graphicsMultiThreaded.ToString()); +#if UNITY_2019_3_OR_NEWER + DrawItem("Rendering Threading Mode", SystemInfo.renderingThreadingMode.ToString()); +#endif +#if UNITY_2020_1_OR_NEWER + DrawItem("HRD Display Support Flags", SystemInfo.hdrDisplaySupportFlags.ToString()); +#endif + DrawItem("Shader Level", GetShaderLevelString(SystemInfo.graphicsShaderLevel)); + DrawItem("Global Maximum LOD", Shader.globalMaximumLOD.ToString()); +#if UNITY_5_6_OR_NEWER + DrawItem("Global Render Pipeline", Shader.globalRenderPipeline); +#endif +#if UNITY_2020_2_OR_NEWER + DrawItem("Min OpenGLES Version", Graphics.minOpenGLESVersion.ToString()); +#endif +#if UNITY_5_5_OR_NEWER + DrawItem("Active Tier", Graphics.activeTier.ToString()); +#endif +#if UNITY_2017_2_OR_NEWER + DrawItem("Active Color Gamut", Graphics.activeColorGamut.ToString()); +#endif +#if UNITY_2019_2_OR_NEWER + DrawItem("Preserve Frame Buffer Alpha", Graphics.preserveFramebufferAlpha.ToString()); +#endif + DrawItem("NPOT Support", SystemInfo.npotSupport.ToString()); + DrawItem("Max Texture Size", SystemInfo.maxTextureSize.ToString()); + DrawItem("Supported Render Target Count", SystemInfo.supportedRenderTargetCount.ToString()); +#if UNITY_2019_3_OR_NEWER + DrawItem("Supported Random Write Target Count", SystemInfo.supportedRandomWriteTargetCount.ToString()); +#endif +#if UNITY_5_4_OR_NEWER + DrawItem("Copy Texture Support", SystemInfo.copyTextureSupport.ToString()); +#endif +#if UNITY_5_5_OR_NEWER + DrawItem("Uses Reversed ZBuffer", SystemInfo.usesReversedZBuffer.ToString()); +#endif +#if UNITY_5_6_OR_NEWER + DrawItem("Max Cubemap Size", SystemInfo.maxCubemapSize.ToString()); + DrawItem("Graphics UV Starts At Top", SystemInfo.graphicsUVStartsAtTop.ToString()); +#endif +#if UNITY_2020_2_OR_NEWER + DrawItem("Constant Buffer Offset Alignment", SystemInfo.constantBufferOffsetAlignment.ToString()); +#elif UNITY_2019_1_OR_NEWER + DrawItem("Min Constant Buffer Offset Alignment", SystemInfo.minConstantBufferOffsetAlignment.ToString()); +#endif +#if UNITY_2018_3_OR_NEWER + DrawItem("Has Hidden Surface Removal On GPU", SystemInfo.hasHiddenSurfaceRemovalOnGPU.ToString()); + DrawItem("Has Dynamic Uniform Array Indexing In Fragment Shaders", SystemInfo.hasDynamicUniformArrayIndexingInFragmentShaders.ToString()); +#endif +#if UNITY_2019_2_OR_NEWER + DrawItem("Has Mip Max Level", SystemInfo.hasMipMaxLevel.ToString()); +#endif +#if UNITY_2019_3_OR_NEWER + DrawItem("Uses Load Store Actions", SystemInfo.usesLoadStoreActions.ToString()); + DrawItem("Max Compute Buffer Inputs Compute", SystemInfo.maxComputeBufferInputsCompute.ToString()); + DrawItem("Max Compute Buffer Inputs Domain", SystemInfo.maxComputeBufferInputsDomain.ToString()); + DrawItem("Max Compute Buffer Inputs Fragment", SystemInfo.maxComputeBufferInputsFragment.ToString()); + DrawItem("Max Compute Buffer Inputs Geometry", SystemInfo.maxComputeBufferInputsGeometry.ToString()); + DrawItem("Max Compute Buffer Inputs Hull", SystemInfo.maxComputeBufferInputsHull.ToString()); + DrawItem("Max Compute Buffer Inputs Vertex", SystemInfo.maxComputeBufferInputsVertex.ToString()); + DrawItem("Max Compute Work Group Size", SystemInfo.maxComputeWorkGroupSize.ToString()); + DrawItem("Max Compute Work Group Size X", SystemInfo.maxComputeWorkGroupSizeX.ToString()); + DrawItem("Max Compute Work Group Size Y", SystemInfo.maxComputeWorkGroupSizeY.ToString()); + DrawItem("Max Compute Work Group Size Z", SystemInfo.maxComputeWorkGroupSizeZ.ToString()); +#endif +#if UNITY_5_3 || UNITY_5_4 + DrawItem("Supports Stencil", SystemInfo.supportsStencil.ToString()); + DrawItem("Supports Render Textures", SystemInfo.supportsRenderTextures.ToString()); +#endif + DrawItem("Supports Sparse Textures", SystemInfo.supportsSparseTextures.ToString()); + DrawItem("Supports 3D Textures", SystemInfo.supports3DTextures.ToString()); + DrawItem("Supports Shadows", SystemInfo.supportsShadows.ToString()); + DrawItem("Supports Raw Shadow Depth Sampling", SystemInfo.supportsRawShadowDepthSampling.ToString()); +#if !UNITY_2019_1_OR_NEWER + DrawItem("Supports Render To Cubemap", SystemInfo.supportsRenderToCubemap.ToString()); + DrawItem("Supports Image Effects", SystemInfo.supportsImageEffects.ToString()); +#endif + DrawItem("Supports Compute Shader", SystemInfo.supportsComputeShaders.ToString()); + DrawItem("Supports Instancing", SystemInfo.supportsInstancing.ToString()); +#if UNITY_5_4_OR_NEWER + DrawItem("Supports 2D Array Textures", SystemInfo.supports2DArrayTextures.ToString()); + DrawItem("Supports Motion Vectors", SystemInfo.supportsMotionVectors.ToString()); +#endif +#if UNITY_5_5_OR_NEWER + DrawItem("Supports Cubemap Array Textures", SystemInfo.supportsCubemapArrayTextures.ToString()); +#endif +#if UNITY_5_6_OR_NEWER + DrawItem("Supports 3D Render Textures", SystemInfo.supports3DRenderTextures.ToString()); +#endif +#if UNITY_2017_2_OR_NEWER && !UNITY_2017_2_0 || UNITY_2017_1_4 + DrawItem("Supports Texture Wrap Mirror Once", SystemInfo.supportsTextureWrapMirrorOnce.ToString()); +#endif +#if UNITY_2019_1_OR_NEWER + DrawItem("Supports Graphics Fence", SystemInfo.supportsGraphicsFence.ToString()); +#elif UNITY_2017_3_OR_NEWER + DrawItem("Supports GPU Fence", SystemInfo.supportsGPUFence.ToString()); +#endif +#if UNITY_2017_3_OR_NEWER + DrawItem("Supports Async Compute", SystemInfo.supportsAsyncCompute.ToString()); + DrawItem("Supports Multi-sampled Textures", SystemInfo.supportsMultisampledTextures.ToString()); +#endif +#if UNITY_2018_1_OR_NEWER + DrawItem("Supports Async GPU Readback", SystemInfo.supportsAsyncGPUReadback.ToString()); + DrawItem("Supports 32bits Index Buffer", SystemInfo.supports32bitsIndexBuffer.ToString()); + DrawItem("Supports Hardware Quad Topology", SystemInfo.supportsHardwareQuadTopology.ToString()); +#endif +#if UNITY_2018_2_OR_NEWER + DrawItem("Supports Mip Streaming", SystemInfo.supportsMipStreaming.ToString()); + DrawItem("Supports Multi-sample Auto Resolve", SystemInfo.supportsMultisampleAutoResolve.ToString()); +#endif +#if UNITY_2018_3_OR_NEWER + DrawItem("Supports Separated Render Targets Blend", SystemInfo.supportsSeparatedRenderTargetsBlend.ToString()); +#endif +#if UNITY_2019_1_OR_NEWER + DrawItem("Supports Set Constant Buffer", SystemInfo.supportsSetConstantBuffer.ToString()); +#endif +#if UNITY_2019_3_OR_NEWER + DrawItem("Supports Geometry Shaders", SystemInfo.supportsGeometryShaders.ToString()); + DrawItem("Supports Ray Tracing", SystemInfo.supportsRayTracing.ToString()); + DrawItem("Supports Tessellation Shaders", SystemInfo.supportsTessellationShaders.ToString()); +#endif +#if UNITY_2020_1_OR_NEWER + DrawItem("Supports Compressed 3D Textures", SystemInfo.supportsCompressed3DTextures.ToString()); + DrawItem("Supports Conservative Raster", SystemInfo.supportsConservativeRaster.ToString()); + DrawItem("Supports GPU Recorder", SystemInfo.supportsGpuRecorder.ToString()); +#endif +#if UNITY_2020_2_OR_NEWER + DrawItem("Supports Multi-sampled 2D Array Textures", SystemInfo.supportsMultisampled2DArrayTextures.ToString()); + DrawItem("Supports Multiview", SystemInfo.supportsMultiview.ToString()); + DrawItem("Supports Render Target Array Index From Vertex Shader", SystemInfo.supportsRenderTargetArrayIndexFromVertexShader.ToString()); +#endif + } + GUILayout.EndVertical(); + } + + private string GetShaderLevelString(int shaderLevel) + { + return Utility.Text.Format("Shader Model {0}.{1}", shaderLevel / 10, shaderLevel % 10); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.GraphicsInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.GraphicsInformationWindow.cs.meta new file mode 100644 index 00000000..a8c3d00a --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.GraphicsInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b257b0e038194eb480632d81e640058e +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputAccelerationInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputAccelerationInformationWindow.cs new file mode 100644 index 00000000..4281c589 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputAccelerationInformationWindow.cs @@ -0,0 +1,38 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class InputAccelerationInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Input Acceleration Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Acceleration", Input.acceleration.ToString()); + DrawItem("Acceleration Event Count", Input.accelerationEventCount.ToString()); + DrawItem("Acceleration Events", GetAccelerationEventsString(Input.accelerationEvents)); + } + GUILayout.EndVertical(); + } + + private string GetAccelerationEventString(AccelerationEvent accelerationEvent) + { + return Utility.Text.Format("{0}, {1}", accelerationEvent.acceleration, accelerationEvent.deltaTime); + } + + private string GetAccelerationEventsString(AccelerationEvent[] accelerationEvents) + { + string[] accelerationEventStrings = new string[accelerationEvents.Length]; + for (int i = 0; i < accelerationEvents.Length; i++) + { + accelerationEventStrings[i] = GetAccelerationEventString(accelerationEvents[i]); + } + + return string.Join("; ", accelerationEventStrings); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputAccelerationInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputAccelerationInformationWindow.cs.meta new file mode 100644 index 00000000..cf45344b --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputAccelerationInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 88685f3bc75649dc8c198de19ae84c3e +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputCompassInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputCompassInformationWindow.cs new file mode 100644 index 00000000..e2bb895c --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputCompassInformationWindow.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class InputCompassInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Input Compass Information"); + GUILayout.BeginVertical("box"); + { + GUILayout.BeginHorizontal(); + { + if (GUILayout.Button("Enable", GUILayout.Height(30f))) + { + Input.compass.enabled = true; + } + if (GUILayout.Button("Disable", GUILayout.Height(30f))) + { + Input.compass.enabled = false; + } + } + GUILayout.EndHorizontal(); + + DrawItem("Enabled", Input.compass.enabled.ToString()); + if (Input.compass.enabled) + { + DrawItem("Heading Accuracy", Input.compass.headingAccuracy.ToString()); + DrawItem("Magnetic Heading", Input.compass.magneticHeading.ToString()); + DrawItem("Raw Vector", Input.compass.rawVector.ToString()); + DrawItem("Timestamp", Input.compass.timestamp.ToString()); + DrawItem("True Heading", Input.compass.trueHeading.ToString()); + } + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputCompassInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputCompassInformationWindow.cs.meta new file mode 100644 index 00000000..b3d0cfd9 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputCompassInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dfbb3d3f61b041d9a0fa135a7cac876a +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputGyroscopeInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputGyroscopeInformationWindow.cs new file mode 100644 index 00000000..69b14ebc --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputGyroscopeInformationWindow.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class InputGyroscopeInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Input Gyroscope Information"); + GUILayout.BeginVertical("box"); + { + GUILayout.BeginHorizontal(); + { + if (GUILayout.Button("Enable", GUILayout.Height(30f))) + { + Input.gyro.enabled = true; + } + if (GUILayout.Button("Disable", GUILayout.Height(30f))) + { + Input.gyro.enabled = false; + } + } + GUILayout.EndHorizontal(); + + DrawItem("Enabled", Input.gyro.enabled.ToString()); + if (Input.gyro.enabled) + { + DrawItem("Update Interval", Input.gyro.updateInterval.ToString()); + DrawItem("Attitude", Input.gyro.attitude.eulerAngles.ToString()); + DrawItem("Gravity", Input.gyro.gravity.ToString()); + DrawItem("Rotation Rate", Input.gyro.rotationRate.ToString()); + DrawItem("Rotation Rate Unbiased", Input.gyro.rotationRateUnbiased.ToString()); + DrawItem("User Acceleration", Input.gyro.userAcceleration.ToString()); + } + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputGyroscopeInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputGyroscopeInformationWindow.cs.meta new file mode 100644 index 00000000..5b5afcaf --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputGyroscopeInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 153ce8ea1c9b400c82c4ec742d8aa6b7 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputLocationInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputLocationInformationWindow.cs new file mode 100644 index 00000000..c0083672 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputLocationInformationWindow.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class InputLocationInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Input Location Information"); + GUILayout.BeginVertical("box"); + { + GUILayout.BeginHorizontal(); + { + if (GUILayout.Button("Enable", GUILayout.Height(30f))) + { + Input.location.Start(); + } + if (GUILayout.Button("Disable", GUILayout.Height(30f))) + { + Input.location.Stop(); + } + } + GUILayout.EndHorizontal(); + + DrawItem("Is Enabled By User", Input.location.isEnabledByUser.ToString()); + DrawItem("Status", Input.location.status.ToString()); + if (Input.location.status == LocationServiceStatus.Running) + { + DrawItem("Horizontal Accuracy", Input.location.lastData.horizontalAccuracy.ToString()); + DrawItem("Vertical Accuracy", Input.location.lastData.verticalAccuracy.ToString()); + DrawItem("Longitude", Input.location.lastData.longitude.ToString()); + DrawItem("Latitude", Input.location.lastData.latitude.ToString()); + DrawItem("Altitude", Input.location.lastData.altitude.ToString()); + DrawItem("Timestamp", Input.location.lastData.timestamp.ToString()); + } + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputLocationInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputLocationInformationWindow.cs.meta new file mode 100644 index 00000000..d6d26238 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputLocationInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 04628888fa364b2b97b4cb77dcbbdd44 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputSummaryInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputSummaryInformationWindow.cs new file mode 100644 index 00000000..9307d068 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputSummaryInformationWindow.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class InputSummaryInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Input Summary Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Back Button Leaves App", Input.backButtonLeavesApp.ToString()); + DrawItem("Device Orientation", Input.deviceOrientation.ToString()); + DrawItem("Mouse Present", Input.mousePresent.ToString()); + DrawItem("Mouse Position", Input.mousePosition.ToString()); + DrawItem("Mouse Scroll Delta", Input.mouseScrollDelta.ToString()); + DrawItem("Any Key", Input.anyKey.ToString()); + DrawItem("Any Key Down", Input.anyKeyDown.ToString()); + DrawItem("Input String", Input.inputString); + DrawItem("IME Is Selected", Input.imeIsSelected.ToString()); + DrawItem("IME Composition Mode", Input.imeCompositionMode.ToString()); + DrawItem("Compensate Sensors", Input.compensateSensors.ToString()); + DrawItem("Composition Cursor Position", Input.compositionCursorPos.ToString()); + DrawItem("Composition String", Input.compositionString); + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputSummaryInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputSummaryInformationWindow.cs.meta new file mode 100644 index 00000000..86cb5d1e --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputSummaryInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ada3bed2bef9413a85c890e907e0e449 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputTouchInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputTouchInformationWindow.cs new file mode 100644 index 00000000..e43540a8 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputTouchInformationWindow.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class InputTouchInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Input Touch Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Touch Supported", Input.touchSupported.ToString()); + DrawItem("Touch Pressure Supported", Input.touchPressureSupported.ToString()); + DrawItem("Stylus Touch Supported", Input.stylusTouchSupported.ToString()); + DrawItem("Simulate Mouse With Touches", Input.simulateMouseWithTouches.ToString()); + DrawItem("Multi Touch Enabled", Input.multiTouchEnabled.ToString()); + DrawItem("Touch Count", Input.touchCount.ToString()); + DrawItem("Touches", GetTouchesString(Input.touches)); + } + GUILayout.EndVertical(); + } + + private string GetTouchString(Touch touch) + { + return Utility.Text.Format("{0}, {1}, {2}, {3}, {4}", touch.position, touch.deltaPosition, touch.rawPosition, touch.pressure, touch.phase); + } + + private string GetTouchesString(Touch[] touches) + { + string[] touchStrings = new string[touches.Length]; + for (int i = 0; i < touches.Length; i++) + { + touchStrings[i] = GetTouchString(touches[i]); + } + + return string.Join("; ", touchStrings); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputTouchInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputTouchInformationWindow.cs.meta new file mode 100644 index 00000000..c2bdc78a --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.InputTouchInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1a54fc6c38204d28b511fe8747b4151d +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.LogNode.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.LogNode.cs new file mode 100644 index 00000000..45cfba89 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.LogNode.cs @@ -0,0 +1,117 @@ +using System; +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + /// + /// 日志记录结点。 + /// + public sealed class LogNode : IMemory + { + private DateTime m_LogTime; + private int m_LogFrameCount; + private LogType m_LogType; + private string m_LogMessage; + private string m_StackTrack; + + /// + /// 初始化日志记录结点的新实例。 + /// + public LogNode() + { + m_LogTime = default(DateTime); + m_LogFrameCount = 0; + m_LogType = LogType.Error; + m_LogMessage = null; + m_StackTrack = null; + } + + /// + /// 获取日志时间。 + /// + public DateTime LogTime + { + get + { + return m_LogTime; + } + } + + /// + /// 获取日志帧计数。 + /// + public int LogFrameCount + { + get + { + return m_LogFrameCount; + } + } + + /// + /// 获取日志类型。 + /// + public LogType LogType + { + get + { + return m_LogType; + } + } + + /// + /// 获取日志内容。 + /// + public string LogMessage + { + get + { + return m_LogMessage; + } + } + + /// + /// 获取日志堆栈信息。 + /// + public string StackTrack + { + get + { + return m_StackTrack; + } + } + + /// + /// 创建日志记录结点。 + /// + /// 日志类型。 + /// 日志内容。 + /// 日志堆栈信息。 + /// 创建的日志记录结点。 + public static LogNode Create(LogType logType, string logMessage, string stackTrack) + { + LogNode logNode = MemoryPool.Acquire(); + logNode.m_LogTime = DateTime.UtcNow; + logNode.m_LogFrameCount = Time.frameCount; + logNode.m_LogType = logType; + logNode.m_LogMessage = logMessage; + logNode.m_StackTrack = stackTrack; + return logNode; + } + + /// + /// 清理日志记录结点。 + /// + public void Clear() + { + m_LogTime = default(DateTime); + m_LogFrameCount = 0; + m_LogType = LogType.Error; + m_LogMessage = null; + m_StackTrack = null; + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.LogNode.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.LogNode.cs.meta new file mode 100644 index 00000000..2df706d6 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.LogNode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e7135a7b2bbe46f8a69c3b6b9b4cf2be +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.MemoryPoolInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.MemoryPoolInformationWindow.cs new file mode 100644 index 00000000..917b0ced --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.MemoryPoolInformationWindow.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class MemoryPoolPoolInformationWindow : ScrollableDebuggerWindowBase + { + private readonly Dictionary> m_MemoryPoolInfos = new Dictionary>(StringComparer.Ordinal); + private readonly Comparison m_NormalClassNameComparer = NormalClassNameComparer; + private readonly Comparison m_FullClassNameComparer = FullClassNameComparer; + private bool m_ShowFullClassName = false; + + public override void Initialize(params object[] args) + { + } + + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Memory Pool Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Enable Strict Check", MemoryPool.EnableStrictCheck.ToString()); + DrawItem("Memory Pool Count", MemoryPool.Count.ToString()); + } + GUILayout.EndVertical(); + + m_ShowFullClassName = GUILayout.Toggle(m_ShowFullClassName, "Show Full Class Name"); + m_MemoryPoolInfos.Clear(); + MemoryPoolInfo[] memoryPoolInfos = MemoryPool.GetAllMemoryPoolInfos(); + foreach (MemoryPoolInfo memoryPoolInfo in memoryPoolInfos) + { + string assemblyName = memoryPoolInfo.Type.Assembly.GetName().Name; + List results = null; + if (!m_MemoryPoolInfos.TryGetValue(assemblyName, out results)) + { + results = new List(); + m_MemoryPoolInfos.Add(assemblyName, results); + } + + results.Add(memoryPoolInfo); + } + + foreach (KeyValuePair> assemblyMemoryPoolInfo in m_MemoryPoolInfos) + { + GUILayout.Label(Utility.Text.Format("Assembly: {0}", assemblyMemoryPoolInfo.Key)); + GUILayout.BeginVertical("box"); + { + GUILayout.BeginHorizontal(); + { + GUILayout.Label(m_ShowFullClassName ? "Full Class Name" : "Class Name"); + GUILayout.Label("Unused", GUILayout.Width(60f)); + GUILayout.Label("Using", GUILayout.Width(60f)); + GUILayout.Label("Acquire", GUILayout.Width(60f)); + GUILayout.Label("Release", GUILayout.Width(60f)); + GUILayout.Label("Add", GUILayout.Width(60f)); + GUILayout.Label("Remove", GUILayout.Width(60f)); + } + GUILayout.EndHorizontal(); + + if (assemblyMemoryPoolInfo.Value.Count > 0) + { + assemblyMemoryPoolInfo.Value.Sort(m_ShowFullClassName ? m_FullClassNameComparer : m_NormalClassNameComparer); + foreach (MemoryPoolInfo memoryPoolInfo in assemblyMemoryPoolInfo.Value) + { + DrawMemoryPoolInfo(memoryPoolInfo); + } + } + else + { + GUILayout.Label("Memory Pool is Empty ..."); + } + } + GUILayout.EndVertical(); + } + } + + private void DrawMemoryPoolInfo(MemoryPoolInfo memoryPoolInfo) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Label(m_ShowFullClassName ? memoryPoolInfo.Type.FullName : memoryPoolInfo.Type.Name); + GUILayout.Label(memoryPoolInfo.UnusedMemoryCount.ToString(), GUILayout.Width(60f)); + GUILayout.Label(memoryPoolInfo.UsingMemoryCount.ToString(), GUILayout.Width(60f)); + GUILayout.Label(memoryPoolInfo.AcquireMemoryCount.ToString(), GUILayout.Width(60f)); + GUILayout.Label(memoryPoolInfo.ReleaseMemoryCount.ToString(), GUILayout.Width(60f)); + GUILayout.Label(memoryPoolInfo.AddMemoryCount.ToString(), GUILayout.Width(60f)); + GUILayout.Label(memoryPoolInfo.RemoveMemoryCount.ToString(), GUILayout.Width(60f)); + } + GUILayout.EndHorizontal(); + } + + private static int NormalClassNameComparer(MemoryPoolInfo a, MemoryPoolInfo b) + { + return a.Type.Name.CompareTo(b.Type.Name); + } + + private static int FullClassNameComparer(MemoryPoolInfo a, MemoryPoolInfo b) + { + return a.Type.FullName.CompareTo(b.Type.FullName); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.MemoryPoolInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.MemoryPoolInformationWindow.cs.meta new file mode 100644 index 00000000..adf51a4f --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.MemoryPoolInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 71ce9435de5c41b3a582614d4ea71512 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.NetworkInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.NetworkInformationWindow.cs new file mode 100644 index 00000000..2ae456ef --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.NetworkInformationWindow.cs @@ -0,0 +1,61 @@ +// using UnityEngine; +// +// namespace TEngine +// { +// public sealed partial class DebuggerComponent : GameFrameworkComponent +// { +// private sealed class NetworkInformationWindow : ScrollableDebuggerWindowBase +// { +// private NetworkComponent m_NetworkComponent = null; +// +// public override void Initialize(params object[] args) +// { +// m_NetworkComponent = GameEntry.GetComponent(); +// if (m_NetworkComponent == null) +// { +// Log.Fatal("Network component is invalid."); +// return; +// } +// } +// +// protected override void OnDrawScrollableWindow() +// { +// GUILayout.Label("Network Information"); +// GUILayout.BeginVertical("box"); +// { +// DrawItem("Network Channel Count", m_NetworkComponent.NetworkChannelCount.ToString()); +// } +// GUILayout.EndVertical(); +// INetworkChannel[] networkChannels = m_NetworkComponent.GetAllNetworkChannels(); +// for (int i = 0; i < networkChannels.Length; i++) +// { +// DrawNetworkChannel(networkChannels[i]); +// } +// } +// +// private void DrawNetworkChannel(INetworkChannel networkChannel) +// { +// GUILayout.Label(Utility.Text.Format("Network Channel: {0} ({1})", networkChannel.Name, networkChannel.Connected ? "Connected" : "Disconnected")); +// GUILayout.BeginVertical("box"); +// { +// DrawItem("Service Type", networkChannel.ServiceType.ToString()); +// DrawItem("Address Family", networkChannel.AddressFamily.ToString()); +// DrawItem("Local Address", networkChannel.Connected ? networkChannel.Socket.LocalEndPoint.ToString() : "Unavailable"); +// DrawItem("Remote Address", networkChannel.Connected ? networkChannel.Socket.RemoteEndPoint.ToString() : "Unavailable"); +// DrawItem("Send Packet", Utility.Text.Format("{0} / {1}", networkChannel.SendPacketCount, networkChannel.SentPacketCount)); +// DrawItem("Receive Packet", Utility.Text.Format("{0} / {1}", networkChannel.ReceivePacketCount, networkChannel.ReceivedPacketCount)); +// DrawItem("Miss Heart Beat Count", networkChannel.MissHeartBeatCount.ToString()); +// DrawItem("Heart Beat", Utility.Text.Format("{0:F2} / {1:F2}", networkChannel.HeartBeatElapseSeconds, networkChannel.HeartBeatInterval)); +// if (networkChannel.Connected) +// { +// if (GUILayout.Button("Disconnect", GUILayout.Height(30f))) +// { +// networkChannel.Close(); +// } +// } +// } +// GUILayout.EndVertical(); +// } +// } +// } +// } diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.NetworkInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.NetworkInformationWindow.cs.meta new file mode 100644 index 00000000..7d7440b2 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.NetworkInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 91eb2683b03a4eb0afdd2edd034df2cc +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ObjectPoolInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ObjectPoolInformationWindow.cs new file mode 100644 index 00000000..faace2ef --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ObjectPoolInformationWindow.cs @@ -0,0 +1,86 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class ObjectPoolInformationWindow : ScrollableDebuggerWindowBase + { + private ObjectPoolComponent m_ObjectPoolComponent = null; + + public override void Initialize(params object[] args) + { + m_ObjectPoolComponent = GameEntry.GetComponent(); + if (m_ObjectPoolComponent == null) + { + Log.Fatal("Object pool component is invalid."); + return; + } + } + + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Object Pool Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Object Pool Count", m_ObjectPoolComponent.Count.ToString()); + } + GUILayout.EndVertical(); + ObjectPoolBase[] objectPools = m_ObjectPoolComponent.GetAllObjectPools(true); + for (int i = 0; i < objectPools.Length; i++) + { + DrawObjectPool(objectPools[i]); + } + } + + private void DrawObjectPool(ObjectPoolBase objectPool) + { + GUILayout.Label(Utility.Text.Format("Object Pool: {0}", objectPool.FullName)); + GUILayout.BeginVertical("box"); + { + DrawItem("Name", objectPool.Name); + DrawItem("Type", objectPool.ObjectType.FullName); + DrawItem("Auto Release Interval", objectPool.AutoReleaseInterval.ToString()); + DrawItem("Capacity", objectPool.Capacity.ToString()); + DrawItem("Used Count", objectPool.Count.ToString()); + DrawItem("Can Release Count", objectPool.CanReleaseCount.ToString()); + DrawItem("Expire Time", objectPool.ExpireTime.ToString()); + DrawItem("Priority", objectPool.Priority.ToString()); + ObjectInfo[] objectInfos = objectPool.GetAllObjectInfos(); + GUILayout.BeginHorizontal(); + { + GUILayout.Label("Name"); + GUILayout.Label("Locked", GUILayout.Width(60f)); + GUILayout.Label(objectPool.AllowMultiSpawn ? "Count" : "In Use", GUILayout.Width(60f)); + GUILayout.Label("Flag", GUILayout.Width(60f)); + GUILayout.Label("Priority", GUILayout.Width(60f)); + GUILayout.Label("Last Use Time", GUILayout.Width(120f)); + } + GUILayout.EndHorizontal(); + + if (objectInfos.Length > 0) + { + for (int i = 0; i < objectInfos.Length; i++) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Label(string.IsNullOrEmpty(objectInfos[i].Name) ? "" : objectInfos[i].Name); + GUILayout.Label(objectInfos[i].Locked.ToString(), GUILayout.Width(60f)); + GUILayout.Label(objectPool.AllowMultiSpawn ? objectInfos[i].SpawnCount.ToString() : objectInfos[i].IsInUse.ToString(), GUILayout.Width(60f)); + GUILayout.Label(objectInfos[i].CustomCanReleaseFlag.ToString(), GUILayout.Width(60f)); + GUILayout.Label(objectInfos[i].Priority.ToString(), GUILayout.Width(60f)); + GUILayout.Label(objectInfos[i].LastUseTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), GUILayout.Width(120f)); + } + GUILayout.EndHorizontal(); + } + } + else + { + GUILayout.Label("Object Pool is Empty ..."); + } + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ObjectPoolInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ObjectPoolInformationWindow.cs.meta new file mode 100644 index 00000000..e86dbdf4 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ObjectPoolInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2f669ce069054868b72a95ebf28d8042 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.OperationsWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.OperationsWindow.cs new file mode 100644 index 00000000..faa3c04f --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.OperationsWindow.cs @@ -0,0 +1,59 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class OperationsWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Operations"); + GUILayout.BeginVertical("box"); + { + ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent(); + if (objectPoolComponent != null) + { + if (GUILayout.Button("Object Pool Release", GUILayout.Height(30f))) + { + objectPoolComponent.Release(); + } + + if (GUILayout.Button("Object Pool Release All Unused", GUILayout.Height(30f))) + { + objectPoolComponent.ReleaseAllUnused(); + } + } + + ResourceComponent resourceCompoent = GameEntry.GetComponent(); + if (resourceCompoent != null) + { + if (GUILayout.Button("Unload Unused Assets", GUILayout.Height(30f))) + { + resourceCompoent.ForceUnloadUnusedAssets(false); + } + + if (GUILayout.Button("Unload Unused Assets and Garbage Collect", GUILayout.Height(30f))) + { + resourceCompoent.ForceUnloadUnusedAssets(true); + } + } + + if (GUILayout.Button("Shutdown Game Framework (None)", GUILayout.Height(30f))) + { + GameEntry.Shutdown(ShutdownType.None); + } + if (GUILayout.Button("Shutdown Game Framework (Restart)", GUILayout.Height(30f))) + { + GameEntry.Shutdown(ShutdownType.Restart); + } + if (GUILayout.Button("Shutdown Game Framework (Quit)", GUILayout.Height(30f))) + { + GameEntry.Shutdown(ShutdownType.Quit); + } + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.OperationsWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.OperationsWindow.cs.meta new file mode 100644 index 00000000..a126cdc9 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.OperationsWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 88ba6493eca64e6f8e8135b305f4eaf0 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.PathInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.PathInformationWindow.cs new file mode 100644 index 00000000..7e896ec0 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.PathInformationWindow.cs @@ -0,0 +1,28 @@ +using System; +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class PathInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Path Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Current Directory", Utility.Path.GetRegularPath(Environment.CurrentDirectory)); + DrawItem("Data Path", Utility.Path.GetRegularPath(Application.dataPath)); + DrawItem("Persistent Data Path", Utility.Path.GetRegularPath(Application.persistentDataPath)); + DrawItem("Streaming Assets Path", Utility.Path.GetRegularPath(Application.streamingAssetsPath)); + DrawItem("Temporary Cache Path", Utility.Path.GetRegularPath(Application.temporaryCachePath)); +#if UNITY_2018_3_OR_NEWER + DrawItem("Console Log Path", Utility.Path.GetRegularPath(Application.consoleLogPath)); +#endif + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.PathInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.PathInformationWindow.cs.meta new file mode 100644 index 00000000..d0b1df17 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.PathInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6d2a77c65d5e472792cf84e5c52894b8 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ProfilerInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ProfilerInformationWindow.cs new file mode 100644 index 00000000..eb6662ed --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ProfilerInformationWindow.cs @@ -0,0 +1,59 @@ +using UnityEngine; +#if UNITY_5_5_OR_NEWER +using UnityEngine.Profiling; +#endif + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class ProfilerInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Profiler Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Supported", Profiler.supported.ToString()); + DrawItem("Enabled", Profiler.enabled.ToString()); + DrawItem("Enable Binary Log", Profiler.enableBinaryLog ? Utility.Text.Format("True, {0}", Profiler.logFile) : "False"); +#if UNITY_2019_3_OR_NEWER + DrawItem("Enable Allocation Callstacks", Profiler.enableAllocationCallstacks.ToString()); +#endif +#if UNITY_2018_3_OR_NEWER + DrawItem("Area Count", Profiler.areaCount.ToString()); +#endif +#if UNITY_5_3 || UNITY_5_4 + DrawItem("Max Samples Number Per Frame", Profiler.maxNumberOfSamplesPerFrame.ToString()); +#endif +#if UNITY_2018_3_OR_NEWER + DrawItem("Max Used Memory", GetByteLengthString(Profiler.maxUsedMemory)); +#endif +#if UNITY_5_6_OR_NEWER + DrawItem("Mono Used Size", GetByteLengthString(Profiler.GetMonoUsedSizeLong())); + DrawItem("Mono Heap Size", GetByteLengthString(Profiler.GetMonoHeapSizeLong())); + DrawItem("Used Heap Size", GetByteLengthString(Profiler.usedHeapSizeLong)); + DrawItem("Total Allocated Memory", GetByteLengthString(Profiler.GetTotalAllocatedMemoryLong())); + DrawItem("Total Reserved Memory", GetByteLengthString(Profiler.GetTotalReservedMemoryLong())); + DrawItem("Total Unused Reserved Memory", GetByteLengthString(Profiler.GetTotalUnusedReservedMemoryLong())); +#else + DrawItem("Mono Used Size", GetByteLengthString(Profiler.GetMonoUsedSize())); + DrawItem("Mono Heap Size", GetByteLengthString(Profiler.GetMonoHeapSize())); + DrawItem("Used Heap Size", GetByteLengthString(Profiler.usedHeapSize)); + DrawItem("Total Allocated Memory", GetByteLengthString(Profiler.GetTotalAllocatedMemory())); + DrawItem("Total Reserved Memory", GetByteLengthString(Profiler.GetTotalReservedMemory())); + DrawItem("Total Unused Reserved Memory", GetByteLengthString(Profiler.GetTotalUnusedReservedMemory())); +#endif +#if UNITY_2018_1_OR_NEWER + DrawItem("Allocated Memory For Graphics Driver", GetByteLengthString(Profiler.GetAllocatedMemoryForGraphicsDriver())); +#endif +#if UNITY_5_5_OR_NEWER + DrawItem("Temp Allocator Size", GetByteLengthString(Profiler.GetTempAllocatorSize())); +#endif + DrawItem("Marshal Cached HGlobal Size", GetByteLengthString(Utility.Marshal.CachedHGlobalSize)); + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ProfilerInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ProfilerInformationWindow.cs.meta new file mode 100644 index 00000000..f412ce2d --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ProfilerInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 10a0760b9718472586a653a79646f05d +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.QualityInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.QualityInformationWindow.cs new file mode 100644 index 00000000..ba78a67a --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.QualityInformationWindow.cs @@ -0,0 +1,102 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class QualityInformationWindow : ScrollableDebuggerWindowBase + { + private bool m_ApplyExpensiveChanges = false; + + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Quality Level"); + GUILayout.BeginVertical("box"); + { + int currentQualityLevel = QualitySettings.GetQualityLevel(); + + DrawItem("Current Quality Level", QualitySettings.names[currentQualityLevel]); + m_ApplyExpensiveChanges = GUILayout.Toggle(m_ApplyExpensiveChanges, "Apply expensive changes on quality level change."); + + int newQualityLevel = GUILayout.SelectionGrid(currentQualityLevel, QualitySettings.names, 3, "toggle"); + if (newQualityLevel != currentQualityLevel) + { + QualitySettings.SetQualityLevel(newQualityLevel, m_ApplyExpensiveChanges); + } + } + GUILayout.EndVertical(); + + GUILayout.Label("Rendering Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Active Color Space", QualitySettings.activeColorSpace.ToString()); + DrawItem("Desired Color Space", QualitySettings.desiredColorSpace.ToString()); + DrawItem("Max Queued Frames", QualitySettings.maxQueuedFrames.ToString()); + DrawItem("Pixel Light Count", QualitySettings.pixelLightCount.ToString()); + DrawItem("Master Texture Limit", QualitySettings.masterTextureLimit.ToString()); + DrawItem("Anisotropic Filtering", QualitySettings.anisotropicFiltering.ToString()); + DrawItem("Anti Aliasing", QualitySettings.antiAliasing.ToString()); +#if UNITY_5_5_OR_NEWER + DrawItem("Soft Particles", QualitySettings.softParticles.ToString()); +#endif + DrawItem("Soft Vegetation", QualitySettings.softVegetation.ToString()); + DrawItem("Realtime Reflection Probes", QualitySettings.realtimeReflectionProbes.ToString()); + DrawItem("Billboards Face Camera Position", QualitySettings.billboardsFaceCameraPosition.ToString()); +#if UNITY_2017_1_OR_NEWER + DrawItem("Resolution Scaling Fixed DPI Factor", QualitySettings.resolutionScalingFixedDPIFactor.ToString()); +#endif +#if UNITY_2018_2_OR_NEWER + DrawItem("Texture Streaming Enabled", QualitySettings.streamingMipmapsActive.ToString()); + DrawItem("Texture Streaming Add All Cameras", QualitySettings.streamingMipmapsAddAllCameras.ToString()); + DrawItem("Texture Streaming Memory Budget", QualitySettings.streamingMipmapsMemoryBudget.ToString()); + DrawItem("Texture Streaming Renderers Per Frame", QualitySettings.streamingMipmapsRenderersPerFrame.ToString()); + DrawItem("Texture Streaming Max Level Reduction", QualitySettings.streamingMipmapsMaxLevelReduction.ToString()); + DrawItem("Texture Streaming Max File IO Requests", QualitySettings.streamingMipmapsMaxFileIORequests.ToString()); +#endif + } + GUILayout.EndVertical(); + + GUILayout.Label("Shadows Information"); + GUILayout.BeginVertical("box"); + { +#if UNITY_2017_1_OR_NEWER + DrawItem("Shadowmask Mode", QualitySettings.shadowmaskMode.ToString()); +#endif +#if UNITY_5_5_OR_NEWER + DrawItem("Shadow Quality", QualitySettings.shadows.ToString()); +#endif +#if UNITY_5_4_OR_NEWER + DrawItem("Shadow Resolution", QualitySettings.shadowResolution.ToString()); +#endif + DrawItem("Shadow Projection", QualitySettings.shadowProjection.ToString()); + DrawItem("Shadow Distance", QualitySettings.shadowDistance.ToString()); + DrawItem("Shadow Near Plane Offset", QualitySettings.shadowNearPlaneOffset.ToString()); + DrawItem("Shadow Cascades", QualitySettings.shadowCascades.ToString()); + DrawItem("Shadow Cascade 2 Split", QualitySettings.shadowCascade2Split.ToString()); + DrawItem("Shadow Cascade 4 Split", QualitySettings.shadowCascade4Split.ToString()); + } + GUILayout.EndVertical(); + + GUILayout.Label("Other Information"); + GUILayout.BeginVertical("box"); + { +#if UNITY_2019_1_OR_NEWER + DrawItem("Skin Weights", QualitySettings.skinWeights.ToString()); +#else + DrawItem("Blend Weights", QualitySettings.blendWeights.ToString()); +#endif + DrawItem("VSync Count", QualitySettings.vSyncCount.ToString()); + DrawItem("LOD Bias", QualitySettings.lodBias.ToString()); + DrawItem("Maximum LOD Level", QualitySettings.maximumLODLevel.ToString()); + DrawItem("Particle Raycast Budget", QualitySettings.particleRaycastBudget.ToString()); + DrawItem("Async Upload Time Slice", Utility.Text.Format("{0} ms", QualitySettings.asyncUploadTimeSlice)); + DrawItem("Async Upload Buffer Size", Utility.Text.Format("{0} MB", QualitySettings.asyncUploadBufferSize)); +#if UNITY_2018_3_OR_NEWER + DrawItem("Async Upload Persistent Buffer", QualitySettings.asyncUploadPersistentBuffer.ToString()); +#endif + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.QualityInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.QualityInformationWindow.cs.meta new file mode 100644 index 00000000..5ff5715b --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.QualityInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9e0be8441f814651a4a238586278df12 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.Sample.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.Sample.cs new file mode 100644 index 00000000..2e541369 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.Sample.cs @@ -0,0 +1,60 @@ +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed partial class RuntimeMemoryInformationWindow : ScrollableDebuggerWindowBase where T : UnityEngine.Object + { + private sealed class Sample + { + private readonly string m_Name; + private readonly string m_Type; + private readonly long m_Size; + private bool m_Highlight; + + public Sample(string name, string type, long size) + { + m_Name = name; + m_Type = type; + m_Size = size; + m_Highlight = false; + } + + public string Name + { + get + { + return m_Name; + } + } + + public string Type + { + get + { + return m_Type; + } + } + + public long Size + { + get + { + return m_Size; + } + } + + public bool Highlight + { + get + { + return m_Highlight; + } + set + { + m_Highlight = value; + } + } + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.Sample.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.Sample.cs.meta new file mode 100644 index 00000000..f39141bd --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.Sample.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c056a5278fb046c693656d9b3c5d1639 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.cs new file mode 100644 index 00000000..dc36640e --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +#if UNITY_5_5_OR_NEWER +using UnityEngine.Profiling; +#endif + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed partial class RuntimeMemoryInformationWindow : ScrollableDebuggerWindowBase where T : UnityEngine.Object + { + private const int ShowSampleCount = 300; + + private readonly List m_Samples = new List(); + private readonly Comparison m_SampleComparer = SampleComparer; + private DateTime m_SampleTime = DateTime.MinValue; + private long m_SampleSize = 0L; + private long m_DuplicateSampleSize = 0L; + private int m_DuplicateSimpleCount = 0; + + protected override void OnDrawScrollableWindow() + { + string typeName = typeof(T).Name; + GUILayout.Label(Utility.Text.Format("{0} Runtime Memory Information", typeName)); + GUILayout.BeginVertical("box"); + { + if (GUILayout.Button(Utility.Text.Format("Take Sample for {0}", typeName), GUILayout.Height(30f))) + { + TakeSample(); + } + + if (m_SampleTime <= DateTime.MinValue) + { + GUILayout.Label(Utility.Text.Format("Please take sample for {0} first.", typeName)); + } + else + { + if (m_DuplicateSimpleCount > 0) + { + GUILayout.Label(Utility.Text.Format("{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}, while {4} {1}s ({5}) might be duplicated.", m_Samples.Count, typeName, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime(), m_DuplicateSimpleCount, GetByteLengthString(m_DuplicateSampleSize))); + } + else + { + GUILayout.Label(Utility.Text.Format("{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}.", m_Samples.Count, typeName, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime())); + } + + if (m_Samples.Count > 0) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Label(Utility.Text.Format("{0} Name", typeName)); + GUILayout.Label("Type", GUILayout.Width(240f)); + GUILayout.Label("Size", GUILayout.Width(80f)); + } + GUILayout.EndHorizontal(); + } + + int count = 0; + for (int i = 0; i < m_Samples.Count; i++) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("{0}", m_Samples[i].Name) : m_Samples[i].Name); + GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("{0}", m_Samples[i].Type) : m_Samples[i].Type, GUILayout.Width(240f)); + GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("{0}", GetByteLengthString(m_Samples[i].Size)) : GetByteLengthString(m_Samples[i].Size), GUILayout.Width(80f)); + } + GUILayout.EndHorizontal(); + + count++; + if (count >= ShowSampleCount) + { + break; + } + } + } + } + GUILayout.EndVertical(); + } + + private void TakeSample() + { + m_SampleTime = DateTime.UtcNow; + m_SampleSize = 0L; + m_DuplicateSampleSize = 0L; + m_DuplicateSimpleCount = 0; + m_Samples.Clear(); + + T[] samples = Resources.FindObjectsOfTypeAll(); + for (int i = 0; i < samples.Length; i++) + { + long sampleSize = 0L; +#if UNITY_5_6_OR_NEWER + sampleSize = Profiler.GetRuntimeMemorySizeLong(samples[i]); +#else + sampleSize = Profiler.GetRuntimeMemorySize(samples[i]); +#endif + m_SampleSize += sampleSize; + m_Samples.Add(new Sample(samples[i].name, samples[i].GetType().Name, sampleSize)); + } + + m_Samples.Sort(m_SampleComparer); + + for (int i = 1; i < m_Samples.Count; i++) + { + if (m_Samples[i].Name == m_Samples[i - 1].Name && m_Samples[i].Type == m_Samples[i - 1].Type && m_Samples[i].Size == m_Samples[i - 1].Size) + { + m_Samples[i].Highlight = true; + m_DuplicateSampleSize += m_Samples[i].Size; + m_DuplicateSimpleCount++; + } + } + } + + private static int SampleComparer(Sample a, Sample b) + { + int result = b.Size.CompareTo(a.Size); + if (result != 0) + { + return result; + } + + result = a.Type.CompareTo(b.Type); + if (result != 0) + { + return result; + } + + return a.Name.CompareTo(b.Name); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.cs.meta new file mode 100644 index 00000000..3f3a4395 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemoryInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c46a0358d21f41a1bffbeb15874b7986 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.Record.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.Record.cs new file mode 100644 index 00000000..4bd613fd --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.Record.cs @@ -0,0 +1,54 @@ +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed partial class RuntimeMemorySummaryWindow : ScrollableDebuggerWindowBase + { + private sealed class Record + { + private readonly string m_Name; + private int m_Count; + private long m_Size; + + public Record(string name) + { + m_Name = name; + m_Count = 0; + m_Size = 0L; + } + + public string Name + { + get + { + return m_Name; + } + } + + public int Count + { + get + { + return m_Count; + } + set + { + m_Count = value; + } + } + + public long Size + { + get + { + return m_Size; + } + set + { + m_Size = value; + } + } + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.Record.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.Record.cs.meta new file mode 100644 index 00000000..2c1f1f89 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.Record.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0fe142cd19ea404092e714667f5e75d1 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.cs new file mode 100644 index 00000000..9970aad9 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +#if UNITY_5_5_OR_NEWER +using UnityEngine.Profiling; +#endif + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed partial class RuntimeMemorySummaryWindow : ScrollableDebuggerWindowBase + { + private readonly List m_Records = new List(); + private readonly Comparison m_RecordComparer = RecordComparer; + private DateTime m_SampleTime = DateTime.MinValue; + private int m_SampleCount = 0; + private long m_SampleSize = 0L; + + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Runtime Memory Summary"); + GUILayout.BeginVertical("box"); + { + if (GUILayout.Button("Take Sample", GUILayout.Height(30f))) + { + TakeSample(); + } + + if (m_SampleTime <= DateTime.MinValue) + { + GUILayout.Label("Please take sample first."); + } + else + { + GUILayout.Label(Utility.Text.Format("{0} Objects ({1}) obtained at {2:yyyy-MM-dd HH:mm:ss}.", m_SampleCount, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime())); + + GUILayout.BeginHorizontal(); + { + GUILayout.Label("Type"); + GUILayout.Label("Count", GUILayout.Width(120f)); + GUILayout.Label("Size", GUILayout.Width(120f)); + } + GUILayout.EndHorizontal(); + + for (int i = 0; i < m_Records.Count; i++) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Label(m_Records[i].Name); + GUILayout.Label(m_Records[i].Count.ToString(), GUILayout.Width(120f)); + GUILayout.Label(GetByteLengthString(m_Records[i].Size), GUILayout.Width(120f)); + } + GUILayout.EndHorizontal(); + } + } + } + GUILayout.EndVertical(); + } + + private void TakeSample() + { + m_Records.Clear(); + m_SampleTime = DateTime.UtcNow; + m_SampleCount = 0; + m_SampleSize = 0L; + + UnityEngine.Object[] samples = Resources.FindObjectsOfTypeAll(); + for (int i = 0; i < samples.Length; i++) + { + long sampleSize = 0L; +#if UNITY_5_6_OR_NEWER + sampleSize = Profiler.GetRuntimeMemorySizeLong(samples[i]); +#else + sampleSize = Profiler.GetRuntimeMemorySize(samples[i]); +#endif + string name = samples[i].GetType().Name; + m_SampleCount++; + m_SampleSize += sampleSize; + + Record record = null; + foreach (Record r in m_Records) + { + if (r.Name == name) + { + record = r; + break; + } + } + + if (record == null) + { + record = new Record(name); + m_Records.Add(record); + } + + record.Count++; + record.Size += sampleSize; + } + + m_Records.Sort(m_RecordComparer); + } + + private static int RecordComparer(Record a, Record b) + { + int result = b.Size.CompareTo(a.Size); + if (result != 0) + { + return result; + } + + result = a.Count.CompareTo(b.Count); + if (result != 0) + { + return result; + } + + return a.Name.CompareTo(b.Name); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.cs.meta new file mode 100644 index 00000000..b341c6a8 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.RuntimeMemorySummaryWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 57978b9ccd8246c8a63d3384f9010078 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SceneInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SceneInformationWindow.cs new file mode 100644 index 00000000..fc4d918a --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SceneInformationWindow.cs @@ -0,0 +1,37 @@ +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class SceneInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Scene Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Scene Count", SceneManager.sceneCount.ToString()); + DrawItem("Scene Count In Build Settings", SceneManager.sceneCountInBuildSettings.ToString()); + + Scene activeScene = SceneManager.GetActiveScene(); +#if UNITY_2018_3_OR_NEWER + DrawItem("Active Scene Handle", activeScene.handle.ToString()); +#endif + DrawItem("Active Scene Name", activeScene.name); + DrawItem("Active Scene Path", activeScene.path); + DrawItem("Active Scene Build Index", activeScene.buildIndex.ToString()); + DrawItem("Active Scene Is Dirty", activeScene.isDirty.ToString()); + DrawItem("Active Scene Is Loaded", activeScene.isLoaded.ToString()); + DrawItem("Active Scene Is Valid", activeScene.IsValid().ToString()); + DrawItem("Active Scene Root Count", activeScene.rootCount.ToString()); +#if UNITY_2019_1_OR_NEWER + DrawItem("Active Scene Is Sub Scene", activeScene.isSubScene.ToString()); +#endif + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SceneInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SceneInformationWindow.cs.meta new file mode 100644 index 00000000..a1eec3fe --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SceneInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 23188b9cc7074bbfaeb3023f6a2e317e +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScreenInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScreenInformationWindow.cs new file mode 100644 index 00000000..dfff26a9 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScreenInformationWindow.cs @@ -0,0 +1,87 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class ScreenInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Screen Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Current Resolution", GetResolutionString(Screen.currentResolution)); + DrawItem("Screen Width", Utility.Text.Format("{0} px / {1:F2} in / {2:F2} cm", Screen.width, Utility.Converter.GetInchesFromPixels(Screen.width), Utility.Converter.GetCentimetersFromPixels(Screen.width))); + DrawItem("Screen Height", Utility.Text.Format("{0} px / {1:F2} in / {2:F2} cm", Screen.height, Utility.Converter.GetInchesFromPixels(Screen.height), Utility.Converter.GetCentimetersFromPixels(Screen.height))); + DrawItem("Screen DPI", Screen.dpi.ToString("F2")); + DrawItem("Screen Orientation", Screen.orientation.ToString()); + DrawItem("Is Full Screen", Screen.fullScreen.ToString()); +#if UNITY_2018_1_OR_NEWER + DrawItem("Full Screen Mode", Screen.fullScreenMode.ToString()); +#endif + DrawItem("Sleep Timeout", GetSleepTimeoutDescription(Screen.sleepTimeout)); +#if UNITY_2019_2_OR_NEWER + DrawItem("Brightness", Screen.brightness.ToString("F2")); +#endif + DrawItem("Cursor Visible", Cursor.visible.ToString()); + DrawItem("Cursor Lock State", Cursor.lockState.ToString()); + DrawItem("Auto Landscape Left", Screen.autorotateToLandscapeLeft.ToString()); + DrawItem("Auto Landscape Right", Screen.autorotateToLandscapeRight.ToString()); + DrawItem("Auto Portrait", Screen.autorotateToPortrait.ToString()); + DrawItem("Auto Portrait Upside Down", Screen.autorotateToPortraitUpsideDown.ToString()); +#if UNITY_2017_2_OR_NEWER && !UNITY_2017_2_0 + DrawItem("Safe Area", Screen.safeArea.ToString()); +#endif +#if UNITY_2019_2_OR_NEWER + DrawItem("Cutouts", GetCutoutsString(Screen.cutouts)); +#endif + DrawItem("Support Resolutions", GetResolutionsString(Screen.resolutions)); + } + GUILayout.EndVertical(); + } + + private string GetSleepTimeoutDescription(int sleepTimeout) + { + if (sleepTimeout == SleepTimeout.NeverSleep) + { + return "Never Sleep"; + } + + if (sleepTimeout == SleepTimeout.SystemSetting) + { + return "System Setting"; + } + + return sleepTimeout.ToString(); + } + + private string GetResolutionString(Resolution resolution) + { + return Utility.Text.Format("{0} x {1} @ {2}Hz", resolution.width, resolution.height, resolution.refreshRate); + } + + private string GetCutoutsString(Rect[] cutouts) + { + string[] cutoutStrings = new string[cutouts.Length]; + for (int i = 0; i < cutouts.Length; i++) + { + cutoutStrings[i] = cutouts[i].ToString(); + } + + return string.Join("; ", cutoutStrings); + } + + private string GetResolutionsString(Resolution[] resolutions) + { + string[] resolutionStrings = new string[resolutions.Length]; + for (int i = 0; i < resolutions.Length; i++) + { + resolutionStrings[i] = GetResolutionString(resolutions[i]); + } + + return string.Join("; ", resolutionStrings); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScreenInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScreenInformationWindow.cs.meta new file mode 100644 index 00000000..47c405ac --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScreenInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b2e9629c3200474c83a384685f1b32d0 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScrollableDebuggerWindowBase.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScrollableDebuggerWindowBase.cs new file mode 100644 index 00000000..8d034214 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScrollableDebuggerWindowBase.cs @@ -0,0 +1,92 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private abstract class ScrollableDebuggerWindowBase : IDebuggerWindow + { + private const float TitleWidth = 240f; + private Vector2 m_ScrollPosition = Vector2.zero; + + public virtual void Initialize(params object[] args) + { + } + + public virtual void Shutdown() + { + } + + public virtual void OnEnter() + { + } + + public virtual void OnLeave() + { + } + + public virtual void OnUpdate(float elapseSeconds, float realElapseSeconds) + { + } + + public void OnDraw() + { + m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition); + { + OnDrawScrollableWindow(); + } + GUILayout.EndScrollView(); + } + + protected abstract void OnDrawScrollableWindow(); + + protected static void DrawItem(string title, string content) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Label(title, GUILayout.Width(TitleWidth)); + if (GUILayout.Button(content, "label")) + { + CopyToClipboard(content); + } + } + GUILayout.EndHorizontal(); + } + + protected static string GetByteLengthString(long byteLength) + { + if (byteLength < 1024L) // 2 ^ 10 + { + return Utility.Text.Format("{0} Bytes", byteLength); + } + + if (byteLength < 1048576L) // 2 ^ 20 + { + return Utility.Text.Format("{0:F2} KB", byteLength / 1024f); + } + + if (byteLength < 1073741824L) // 2 ^ 30 + { + return Utility.Text.Format("{0:F2} MB", byteLength / 1048576f); + } + + if (byteLength < 1099511627776L) // 2 ^ 40 + { + return Utility.Text.Format("{0:F2} GB", byteLength / 1073741824f); + } + + if (byteLength < 1125899906842624L) // 2 ^ 50 + { + return Utility.Text.Format("{0:F2} TB", byteLength / 1099511627776f); + } + + if (byteLength < 1152921504606846976L) // 2 ^ 60 + { + return Utility.Text.Format("{0:F2} PB", byteLength / 1125899906842624f); + } + + return Utility.Text.Format("{0:F2} EB", byteLength / 1152921504606846976f); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScrollableDebuggerWindowBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScrollableDebuggerWindowBase.cs.meta new file mode 100644 index 00000000..4daea339 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.ScrollableDebuggerWindowBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1ab46898981a41189c05d040d7c9291e +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SettingsWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SettingsWindow.cs new file mode 100644 index 00000000..bffddfb0 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SettingsWindow.cs @@ -0,0 +1,212 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class SettingsWindow : ScrollableDebuggerWindowBase + { + private DebuggerComponent m_DebuggerComponent = null; + private SettingComponent m_SettingComponent = null; + private float m_LastIconX = 0f; + private float m_LastIconY = 0f; + private float m_LastWindowX = 0f; + private float m_LastWindowY = 0f; + private float m_LastWindowWidth = 0f; + private float m_LastWindowHeight = 0f; + private float m_LastWindowScale = 0f; + + public override void Initialize(params object[] args) + { + m_DebuggerComponent = GameEntry.GetComponent(); + if (m_DebuggerComponent == null) + { + Log.Fatal("Debugger component is invalid."); + return; + } + + m_SettingComponent = GameEntry.GetComponent(); + if (m_SettingComponent == null) + { + Log.Fatal("Setting component is invalid."); + return; + } + + m_LastIconX = m_SettingComponent.GetFloat("Debugger.Icon.X", DefaultIconRect.x); + m_LastIconY = m_SettingComponent.GetFloat("Debugger.Icon.Y", DefaultIconRect.y); + m_LastWindowX = m_SettingComponent.GetFloat("Debugger.Window.X", DefaultWindowRect.x); + m_LastWindowY = m_SettingComponent.GetFloat("Debugger.Window.Y", DefaultWindowRect.y); + m_LastWindowWidth = m_SettingComponent.GetFloat("Debugger.Window.Width", DefaultWindowRect.width); + m_LastWindowHeight = m_SettingComponent.GetFloat("Debugger.Window.Height", DefaultWindowRect.height); + m_DebuggerComponent.WindowScale = m_LastWindowScale = m_SettingComponent.GetFloat("Debugger.Window.Scale", DefaultWindowScale); + m_DebuggerComponent.IconRect = new Rect(m_LastIconX, m_LastIconY, DefaultIconRect.width, DefaultIconRect.height); + m_DebuggerComponent.WindowRect = new Rect(m_LastWindowX, m_LastWindowY, m_LastWindowWidth, m_LastWindowHeight); + } + + public override void OnUpdate(float elapseSeconds, float realElapseSeconds) + { + if (m_LastIconX != m_DebuggerComponent.IconRect.x) + { + m_LastIconX = m_DebuggerComponent.IconRect.x; + m_SettingComponent.SetFloat("Debugger.Icon.X", m_DebuggerComponent.IconRect.x); + } + + if (m_LastIconY != m_DebuggerComponent.IconRect.y) + { + m_LastIconY = m_DebuggerComponent.IconRect.y; + m_SettingComponent.SetFloat("Debugger.Icon.Y", m_DebuggerComponent.IconRect.y); + } + + if (m_LastWindowX != m_DebuggerComponent.WindowRect.x) + { + m_LastWindowX = m_DebuggerComponent.WindowRect.x; + m_SettingComponent.SetFloat("Debugger.Window.X", m_DebuggerComponent.WindowRect.x); + } + + if (m_LastWindowY != m_DebuggerComponent.WindowRect.y) + { + m_LastWindowY = m_DebuggerComponent.WindowRect.y; + m_SettingComponent.SetFloat("Debugger.Window.Y", m_DebuggerComponent.WindowRect.y); + } + + if (m_LastWindowWidth != m_DebuggerComponent.WindowRect.width) + { + m_LastWindowWidth = m_DebuggerComponent.WindowRect.width; + m_SettingComponent.SetFloat("Debugger.Window.Width", m_DebuggerComponent.WindowRect.width); + } + + if (m_LastWindowHeight != m_DebuggerComponent.WindowRect.height) + { + m_LastWindowHeight = m_DebuggerComponent.WindowRect.height; + m_SettingComponent.SetFloat("Debugger.Window.Height", m_DebuggerComponent.WindowRect.height); + } + + if (m_LastWindowScale != m_DebuggerComponent.WindowScale) + { + m_LastWindowScale = m_DebuggerComponent.WindowScale; + m_SettingComponent.SetFloat("Debugger.Window.Scale", m_DebuggerComponent.WindowScale); + } + } + + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Window Settings"); + GUILayout.BeginVertical("box"); + { + GUILayout.BeginHorizontal(); + { + GUILayout.Label("Position:", GUILayout.Width(60f)); + GUILayout.Label("Drag window caption to move position."); + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + { + float width = m_DebuggerComponent.WindowRect.width; + GUILayout.Label("Width:", GUILayout.Width(60f)); + if (GUILayout.RepeatButton("-", GUILayout.Width(30f))) + { + width--; + } + width = GUILayout.HorizontalSlider(width, 100f, Screen.width - 20f); + if (GUILayout.RepeatButton("+", GUILayout.Width(30f))) + { + width++; + } + width = Mathf.Clamp(width, 100f, Screen.width - 20f); + if (width != m_DebuggerComponent.WindowRect.width) + { + m_DebuggerComponent.WindowRect = new Rect(m_DebuggerComponent.WindowRect.x, m_DebuggerComponent.WindowRect.y, width, m_DebuggerComponent.WindowRect.height); + } + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + { + float height = m_DebuggerComponent.WindowRect.height; + GUILayout.Label("Height:", GUILayout.Width(60f)); + if (GUILayout.RepeatButton("-", GUILayout.Width(30f))) + { + height--; + } + height = GUILayout.HorizontalSlider(height, 100f, Screen.height - 20f); + if (GUILayout.RepeatButton("+", GUILayout.Width(30f))) + { + height++; + } + height = Mathf.Clamp(height, 100f, Screen.height - 20f); + if (height != m_DebuggerComponent.WindowRect.height) + { + m_DebuggerComponent.WindowRect = new Rect(m_DebuggerComponent.WindowRect.x, m_DebuggerComponent.WindowRect.y, m_DebuggerComponent.WindowRect.width, height); + } + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + { + float scale = m_DebuggerComponent.WindowScale; + GUILayout.Label("Scale:", GUILayout.Width(60f)); + if (GUILayout.RepeatButton("-", GUILayout.Width(30f))) + { + scale -= 0.01f; + } + scale = GUILayout.HorizontalSlider(scale, 0.5f, 4f); + if (GUILayout.RepeatButton("+", GUILayout.Width(30f))) + { + scale += 0.01f; + } + scale = Mathf.Clamp(scale, 0.5f, 4f); + if (scale != m_DebuggerComponent.WindowScale) + { + m_DebuggerComponent.WindowScale = scale; + } + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + { + if (GUILayout.Button("0.5x", GUILayout.Height(60f))) + { + m_DebuggerComponent.WindowScale = 0.5f; + } + if (GUILayout.Button("1.0x", GUILayout.Height(60f))) + { + m_DebuggerComponent.WindowScale = 1f; + } + if (GUILayout.Button("1.5x", GUILayout.Height(60f))) + { + m_DebuggerComponent.WindowScale = 1.5f; + } + if (GUILayout.Button("2.0x", GUILayout.Height(60f))) + { + m_DebuggerComponent.WindowScale = 2f; + } + if (GUILayout.Button("2.5x", GUILayout.Height(60f))) + { + m_DebuggerComponent.WindowScale = 2.5f; + } + if (GUILayout.Button("3.0x", GUILayout.Height(60f))) + { + m_DebuggerComponent.WindowScale = 3f; + } + if (GUILayout.Button("3.5x", GUILayout.Height(60f))) + { + m_DebuggerComponent.WindowScale = 3.5f; + } + if (GUILayout.Button("4.0x", GUILayout.Height(60f))) + { + m_DebuggerComponent.WindowScale = 4f; + } + } + GUILayout.EndHorizontal(); + + if (GUILayout.Button("Reset Layout", GUILayout.Height(30f))) + { + m_DebuggerComponent.ResetLayout(); + } + } + GUILayout.EndVertical(); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SettingsWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SettingsWindow.cs.meta new file mode 100644 index 00000000..7c240bf5 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SettingsWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d6cd4faabca74c3f9af9cd407d4663d5 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SystemInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SystemInformationWindow.cs new file mode 100644 index 00000000..8759dc30 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SystemInformationWindow.cs @@ -0,0 +1,54 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class SystemInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("System Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Device Unique ID", SystemInfo.deviceUniqueIdentifier); + DrawItem("Device Name", SystemInfo.deviceName); + DrawItem("Device Type", SystemInfo.deviceType.ToString()); + DrawItem("Device Model", SystemInfo.deviceModel); + DrawItem("Processor Type", SystemInfo.processorType); + DrawItem("Processor Count", SystemInfo.processorCount.ToString()); + DrawItem("Processor Frequency", Utility.Text.Format("{0} MHz", SystemInfo.processorFrequency)); + DrawItem("System Memory Size", Utility.Text.Format("{0} MB", SystemInfo.systemMemorySize)); +#if UNITY_5_5_OR_NEWER + DrawItem("Operating System Family", SystemInfo.operatingSystemFamily.ToString()); +#endif + DrawItem("Operating System", SystemInfo.operatingSystem); +#if UNITY_5_6_OR_NEWER + DrawItem("Battery Status", SystemInfo.batteryStatus.ToString()); + DrawItem("Battery Level", GetBatteryLevelString(SystemInfo.batteryLevel)); +#endif +#if UNITY_5_4_OR_NEWER + DrawItem("Supports Audio", SystemInfo.supportsAudio.ToString()); +#endif + DrawItem("Supports Location Service", SystemInfo.supportsLocationService.ToString()); + DrawItem("Supports Accelerometer", SystemInfo.supportsAccelerometer.ToString()); + DrawItem("Supports Gyroscope", SystemInfo.supportsGyroscope.ToString()); + DrawItem("Supports Vibration", SystemInfo.supportsVibration.ToString()); + DrawItem("Genuine", Application.genuine.ToString()); + DrawItem("Genuine Check Available", Application.genuineCheckAvailable.ToString()); + } + GUILayout.EndVertical(); + } + + private string GetBatteryLevelString(float batteryLevel) + { + if (batteryLevel < 0f) + { + return "Unavailable"; + } + + return batteryLevel.ToString("P0"); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SystemInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SystemInformationWindow.cs.meta new file mode 100644 index 00000000..24652fd6 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.SystemInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dce6d86504004300ae4dbbd204f53f8b +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.TimeInformationWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.TimeInformationWindow.cs new file mode 100644 index 00000000..d9a06f91 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.TimeInformationWindow.cs @@ -0,0 +1,68 @@ +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class TimeInformationWindow : ScrollableDebuggerWindowBase + { + protected override void OnDrawScrollableWindow() + { + GUILayout.Label("Time Information"); + GUILayout.BeginVertical("box"); + { + DrawItem("Time Scale", Utility.Text.Format("{0} [{1}]", Time.timeScale, GetTimeScaleDescription(Time.timeScale))); + DrawItem("Realtime Since Startup", Time.realtimeSinceStartup.ToString()); + DrawItem("Time Since Level Load", Time.timeSinceLevelLoad.ToString()); + DrawItem("Time", Time.time.ToString()); + DrawItem("Fixed Time", Time.fixedTime.ToString()); + DrawItem("Unscaled Time", Time.unscaledTime.ToString()); +#if UNITY_5_6_OR_NEWER + DrawItem("Fixed Unscaled Time", Time.fixedUnscaledTime.ToString()); +#endif + DrawItem("Delta Time", Time.deltaTime.ToString()); + DrawItem("Fixed Delta Time", Time.fixedDeltaTime.ToString()); + DrawItem("Unscaled Delta Time", Time.unscaledDeltaTime.ToString()); +#if UNITY_5_6_OR_NEWER + DrawItem("Fixed Unscaled Delta Time", Time.fixedUnscaledDeltaTime.ToString()); +#endif + DrawItem("Smooth Delta Time", Time.smoothDeltaTime.ToString()); + DrawItem("Maximum Delta Time", Time.maximumDeltaTime.ToString()); +#if UNITY_5_5_OR_NEWER + DrawItem("Maximum Particle Delta Time", Time.maximumParticleDeltaTime.ToString()); +#endif + DrawItem("Frame Count", Time.frameCount.ToString()); + DrawItem("Rendered Frame Count", Time.renderedFrameCount.ToString()); + DrawItem("Capture Framerate", Time.captureFramerate.ToString()); +#if UNITY_2019_2_OR_NEWER + DrawItem("Capture Delta Time", Time.captureDeltaTime.ToString()); +#endif +#if UNITY_5_6_OR_NEWER + DrawItem("In Fixed Time Step", Time.inFixedTimeStep.ToString()); +#endif + } + GUILayout.EndVertical(); + } + + private string GetTimeScaleDescription(float timeScale) + { + if (timeScale <= 0f) + { + return "Pause"; + } + + if (timeScale < 1f) + { + return "Slower"; + } + + if (timeScale > 1f) + { + return "Faster"; + } + + return "Normal"; + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.TimeInformationWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.TimeInformationWindow.cs.meta new file mode 100644 index 00000000..2d144445 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/Component/DebuggerComponent.TimeInformationWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 49e6de7a5fa043ba9c489ac67147bbee +timeCreated: 1680489775 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerActiveWindowType.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerActiveWindowType.cs new file mode 100644 index 00000000..c6850b25 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerActiveWindowType.cs @@ -0,0 +1,28 @@ +namespace TEngine +{ + /// + /// 调试器激活窗口类型。 + /// + public enum DebuggerActiveWindowType : byte + { + /// + /// 总是打开。 + /// + AlwaysOpen = 0, + + /// + /// 仅在开发模式时打开。 + /// + OnlyOpenWhenDevelopment, + + /// + /// 仅在编辑器中打开。 + /// + OnlyOpenInEditor, + + /// + /// 总是关闭。 + /// + AlwaysClose, + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerActiveWindowType.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerActiveWindowType.cs.meta new file mode 100644 index 00000000..38680341 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerActiveWindowType.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 71186a1869d3486e8a8b47c9053623c5 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.ConsoleWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.ConsoleWindow.cs new file mode 100644 index 00000000..8ff5e710 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.ConsoleWindow.cs @@ -0,0 +1,500 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + [Serializable] + private sealed class ConsoleWindow : IDebuggerWindow + { + private readonly Queue m_LogNodes = new Queue(); + + private SettingComponent m_SettingComponent = null; + private Vector2 m_LogScrollPosition = Vector2.zero; + private Vector2 m_StackScrollPosition = Vector2.zero; + private int m_InfoCount = 0; + private int m_WarningCount = 0; + private int m_ErrorCount = 0; + private int m_FatalCount = 0; + private LogNode m_SelectedNode = null; + private bool m_LastLockScroll = true; + private bool m_LastInfoFilter = true; + private bool m_LastWarningFilter = true; + private bool m_LastErrorFilter = true; + private bool m_LastFatalFilter = true; + + [SerializeField] + private bool m_LockScroll = true; + + [SerializeField] + private int m_MaxLine = 100; + + [SerializeField] + private bool m_InfoFilter = true; + + [SerializeField] + private bool m_WarningFilter = true; + + [SerializeField] + private bool m_ErrorFilter = true; + + [SerializeField] + private bool m_FatalFilter = true; + + [SerializeField] + private Color32 m_InfoColor = Color.white; + + [SerializeField] + private Color32 m_WarningColor = Color.yellow; + + [SerializeField] + private Color32 m_ErrorColor = Color.red; + + [SerializeField] + private Color32 m_FatalColor = new Color(0.7f, 0.2f, 0.2f); + + public bool LockScroll + { + get + { + return m_LockScroll; + } + set + { + m_LockScroll = value; + } + } + + public int MaxLine + { + get + { + return m_MaxLine; + } + set + { + m_MaxLine = value; + } + } + + public bool InfoFilter + { + get + { + return m_InfoFilter; + } + set + { + m_InfoFilter = value; + } + } + + public bool WarningFilter + { + get + { + return m_WarningFilter; + } + set + { + m_WarningFilter = value; + } + } + + public bool ErrorFilter + { + get + { + return m_ErrorFilter; + } + set + { + m_ErrorFilter = value; + } + } + + public bool FatalFilter + { + get + { + return m_FatalFilter; + } + set + { + m_FatalFilter = value; + } + } + + public int InfoCount + { + get + { + return m_InfoCount; + } + } + + public int WarningCount + { + get + { + return m_WarningCount; + } + } + + public int ErrorCount + { + get + { + return m_ErrorCount; + } + } + + public int FatalCount + { + get + { + return m_FatalCount; + } + } + + public Color32 InfoColor + { + get + { + return m_InfoColor; + } + set + { + m_InfoColor = value; + } + } + + public Color32 WarningColor + { + get + { + return m_WarningColor; + } + set + { + m_WarningColor = value; + } + } + + public Color32 ErrorColor + { + get + { + return m_ErrorColor; + } + set + { + m_ErrorColor = value; + } + } + + public Color32 FatalColor + { + get + { + return m_FatalColor; + } + set + { + m_FatalColor = value; + } + } + + public void Initialize(params object[] args) + { + m_SettingComponent = GameEntry.GetComponent(); + if (m_SettingComponent == null) + { + Log.Fatal("Setting component is invalid."); + return; + } + + Application.logMessageReceived += OnLogMessageReceived; + m_LockScroll = m_LastLockScroll = m_SettingComponent.GetBool("Debugger.Console.LockScroll", true); + m_InfoFilter = m_LastInfoFilter = m_SettingComponent.GetBool("Debugger.Console.InfoFilter", true); + m_WarningFilter = m_LastWarningFilter = m_SettingComponent.GetBool("Debugger.Console.WarningFilter", true); + m_ErrorFilter = m_LastErrorFilter = m_SettingComponent.GetBool("Debugger.Console.ErrorFilter", true); + m_FatalFilter = m_LastFatalFilter = m_SettingComponent.GetBool("Debugger.Console.FatalFilter", true); + } + + public void Shutdown() + { + Application.logMessageReceived -= OnLogMessageReceived; + Clear(); + } + + public void OnEnter() + { + } + + public void OnLeave() + { + } + + public void OnUpdate(float elapseSeconds, float realElapseSeconds) + { + if (m_LastLockScroll != m_LockScroll) + { + m_LastLockScroll = m_LockScroll; + m_SettingComponent.SetBool("Debugger.Console.LockScroll", m_LockScroll); + } + + if (m_LastInfoFilter != m_InfoFilter) + { + m_LastInfoFilter = m_InfoFilter; + m_SettingComponent.SetBool("Debugger.Console.InfoFilter", m_InfoFilter); + } + + if (m_LastWarningFilter != m_WarningFilter) + { + m_LastWarningFilter = m_WarningFilter; + m_SettingComponent.SetBool("Debugger.Console.WarningFilter", m_WarningFilter); + } + + if (m_LastErrorFilter != m_ErrorFilter) + { + m_LastErrorFilter = m_ErrorFilter; + m_SettingComponent.SetBool("Debugger.Console.ErrorFilter", m_ErrorFilter); + } + + if (m_LastFatalFilter != m_FatalFilter) + { + m_LastFatalFilter = m_FatalFilter; + m_SettingComponent.SetBool("Debugger.Console.FatalFilter", m_FatalFilter); + } + } + + public void OnDraw() + { + RefreshCount(); + + GUILayout.BeginHorizontal(); + { + if (GUILayout.Button("Clear All", GUILayout.Width(100f))) + { + Clear(); + } + m_LockScroll = GUILayout.Toggle(m_LockScroll, "Lock Scroll", GUILayout.Width(90f)); + GUILayout.FlexibleSpace(); + m_InfoFilter = GUILayout.Toggle(m_InfoFilter, Utility.Text.Format("Info ({0})", m_InfoCount), GUILayout.Width(90f)); + m_WarningFilter = GUILayout.Toggle(m_WarningFilter, Utility.Text.Format("Warning ({0})", m_WarningCount), GUILayout.Width(90f)); + m_ErrorFilter = GUILayout.Toggle(m_ErrorFilter, Utility.Text.Format("Error ({0})", m_ErrorCount), GUILayout.Width(90f)); + m_FatalFilter = GUILayout.Toggle(m_FatalFilter, Utility.Text.Format("Fatal ({0})", m_FatalCount), GUILayout.Width(90f)); + } + GUILayout.EndHorizontal(); + + GUILayout.BeginVertical("box"); + { + if (m_LockScroll) + { + m_LogScrollPosition.y = float.MaxValue; + } + + m_LogScrollPosition = GUILayout.BeginScrollView(m_LogScrollPosition); + { + bool selected = false; + foreach (LogNode logNode in m_LogNodes) + { + switch (logNode.LogType) + { + case LogType.Log: + if (!m_InfoFilter) + { + continue; + } + break; + + case LogType.Warning: + if (!m_WarningFilter) + { + continue; + } + break; + + case LogType.Error: + if (!m_ErrorFilter) + { + continue; + } + break; + + case LogType.Exception: + if (!m_FatalFilter) + { + continue; + } + break; + } + if (GUILayout.Toggle(m_SelectedNode == logNode, GetLogString(logNode))) + { + selected = true; + if (m_SelectedNode != logNode) + { + m_SelectedNode = logNode; + m_StackScrollPosition = Vector2.zero; + } + } + } + if (!selected) + { + m_SelectedNode = null; + } + } + GUILayout.EndScrollView(); + } + GUILayout.EndVertical(); + + GUILayout.BeginVertical("box"); + { + m_StackScrollPosition = GUILayout.BeginScrollView(m_StackScrollPosition, GUILayout.Height(100f)); + { + if (m_SelectedNode != null) + { + Color32 color = GetLogStringColor(m_SelectedNode.LogType); + if (GUILayout.Button(Utility.Text.Format("{4}{6}{6}{5}", color.r, color.g, color.b, color.a, m_SelectedNode.LogMessage, m_SelectedNode.StackTrack, Environment.NewLine), "label")) + { + CopyToClipboard(Utility.Text.Format("{0}{2}{2}{1}", m_SelectedNode.LogMessage, m_SelectedNode.StackTrack, Environment.NewLine)); + } + } + } + GUILayout.EndScrollView(); + } + GUILayout.EndVertical(); + } + + private void Clear() + { + m_LogNodes.Clear(); + } + + public void RefreshCount() + { + m_InfoCount = 0; + m_WarningCount = 0; + m_ErrorCount = 0; + m_FatalCount = 0; + foreach (LogNode logNode in m_LogNodes) + { + switch (logNode.LogType) + { + case LogType.Log: + m_InfoCount++; + break; + + case LogType.Warning: + m_WarningCount++; + break; + + case LogType.Error: + m_ErrorCount++; + break; + + case LogType.Exception: + m_FatalCount++; + break; + } + } + } + + public void GetRecentLogs(List results) + { + if (results == null) + { + Log.Error("Results is invalid."); + return; + } + + results.Clear(); + foreach (LogNode logNode in m_LogNodes) + { + results.Add(logNode); + } + } + + public void GetRecentLogs(List results, int count) + { + if (results == null) + { + Log.Error("Results is invalid."); + return; + } + + if (count <= 0) + { + Log.Error("Count is invalid."); + return; + } + + int position = m_LogNodes.Count - count; + if (position < 0) + { + position = 0; + } + + int index = 0; + results.Clear(); + foreach (LogNode logNode in m_LogNodes) + { + if (index++ < position) + { + continue; + } + + results.Add(logNode); + } + } + + private void OnLogMessageReceived(string logMessage, string stackTrace, LogType logType) + { + if (logType == LogType.Assert) + { + logType = LogType.Error; + } + + m_LogNodes.Enqueue(LogNode.Create(logType, logMessage, stackTrace)); + while (m_LogNodes.Count > m_MaxLine) + { + MemoryPool.Release(m_LogNodes.Dequeue()); + } + } + + private string GetLogString(LogNode logNode) + { + Color32 color = GetLogStringColor(logNode.LogType); + return Utility.Text.Format("[{4:HH:mm:ss.fff}][{5}] {6}", color.r, color.g, color.b, color.a, logNode.LogTime.ToLocalTime(), logNode.LogFrameCount, logNode.LogMessage); + } + + internal Color32 GetLogStringColor(LogType logType) + { + Color32 color = Color.white; + switch (logType) + { + case LogType.Log: + color = m_InfoColor; + break; + + case LogType.Warning: + color = m_WarningColor; + break; + + case LogType.Error: + color = m_ErrorColor; + break; + + case LogType.Exception: + color = m_FatalColor; + break; + } + + return color; + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.ConsoleWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.ConsoleWindow.cs.meta new file mode 100644 index 00000000..9cab1639 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.ConsoleWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dbdea71d14c947dab46792b72d024906 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.FpsCounter.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.FpsCounter.cs new file mode 100644 index 00000000..c90a2343 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.FpsCounter.cs @@ -0,0 +1,76 @@ +namespace TEngine +{ + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + private sealed class FpsCounter + { + private float m_UpdateInterval; + private float m_CurrentFps; + private int m_Frames; + private float m_Accumulator; + private float m_TimeLeft; + + public FpsCounter(float updateInterval) + { + if (updateInterval <= 0f) + { + Log.Error("Update interval is invalid."); + return; + } + + m_UpdateInterval = updateInterval; + Reset(); + } + + public float UpdateInterval + { + get + { + return m_UpdateInterval; + } + set + { + if (value <= 0f) + { + Log.Error("Update interval is invalid."); + return; + } + + m_UpdateInterval = value; + Reset(); + } + } + + public float CurrentFps + { + get + { + return m_CurrentFps; + } + } + + public void Update(float elapseSeconds, float realElapseSeconds) + { + m_Frames++; + m_Accumulator += realElapseSeconds; + m_TimeLeft -= realElapseSeconds; + + if (m_TimeLeft <= 0f) + { + m_CurrentFps = m_Accumulator > 0f ? m_Frames / m_Accumulator : 0f; + m_Frames = 0; + m_Accumulator = 0f; + m_TimeLeft += m_UpdateInterval; + } + } + + private void Reset() + { + m_CurrentFps = 0f; + m_Frames = 0; + m_Accumulator = 0f; + m_TimeLeft = 0f; + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.FpsCounter.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.FpsCounter.cs.meta new file mode 100644 index 00000000..8e23ec01 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.FpsCounter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 37c643db0e8a488ebf3941df04d18c35 +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.cs new file mode 100644 index 00000000..5849f479 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.cs @@ -0,0 +1,451 @@ +using System.Collections.Generic; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace TEngine +{ + /// + /// 调试器组件。 + /// + [DisallowMultipleComponent] + public sealed partial class DebuggerComponent : GameFrameworkComponent + { + /// + /// 默认调试器漂浮框大小。 + /// + internal static readonly Rect DefaultIconRect = new Rect(10f, 10f, 60f, 60f); + + /// + /// 默认调试器窗口大小。 + /// + internal static readonly Rect DefaultWindowRect = new Rect(10f, 10f, 640f, 480f); + + /// + /// 默认调试器窗口缩放比例。 + /// + internal static readonly float DefaultWindowScale = 1.5f; + + private static readonly TextEditor s_TextEditor = new TextEditor(); + private IDebuggerManager m_DebuggerManager = null; + private Rect m_DragRect = new Rect(0f, 0f, float.MaxValue, 25f); + private Rect m_IconRect = DefaultIconRect; + private Rect m_WindowRect = DefaultWindowRect; + private float m_WindowScale = DefaultWindowScale; + + [SerializeField] + private GUISkin m_Skin = null; + + [SerializeField] + private DebuggerActiveWindowType m_ActiveWindow = DebuggerActiveWindowType.AlwaysOpen; + + [SerializeField] + private bool m_ShowFullWindow = false; + + [SerializeField] + private ConsoleWindow m_ConsoleWindow = new ConsoleWindow(); + + private SystemInformationWindow m_SystemInformationWindow = new SystemInformationWindow(); + private EnvironmentInformationWindow m_EnvironmentInformationWindow = new EnvironmentInformationWindow(); + private ScreenInformationWindow m_ScreenInformationWindow = new ScreenInformationWindow(); + private GraphicsInformationWindow m_GraphicsInformationWindow = new GraphicsInformationWindow(); + private InputSummaryInformationWindow m_InputSummaryInformationWindow = new InputSummaryInformationWindow(); + private InputTouchInformationWindow m_InputTouchInformationWindow = new InputTouchInformationWindow(); + private InputLocationInformationWindow m_InputLocationInformationWindow = new InputLocationInformationWindow(); + private InputAccelerationInformationWindow m_InputAccelerationInformationWindow = new InputAccelerationInformationWindow(); + private InputGyroscopeInformationWindow m_InputGyroscopeInformationWindow = new InputGyroscopeInformationWindow(); + private InputCompassInformationWindow m_InputCompassInformationWindow = new InputCompassInformationWindow(); + private PathInformationWindow m_PathInformationWindow = new PathInformationWindow(); + private SceneInformationWindow m_SceneInformationWindow = new SceneInformationWindow(); + private TimeInformationWindow m_TimeInformationWindow = new TimeInformationWindow(); + private QualityInformationWindow m_QualityInformationWindow = new QualityInformationWindow(); + private ProfilerInformationWindow m_ProfilerInformationWindow = new ProfilerInformationWindow(); + private RuntimeMemorySummaryWindow m_RuntimeMemorySummaryWindow = new RuntimeMemorySummaryWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryAllInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryTextureInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryMeshInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryMaterialInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryShaderInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryAnimationClipInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryAudioClipInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryFontInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryTextAssetInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow m_RuntimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow(); + private ObjectPoolInformationWindow m_ObjectPoolInformationWindow = new ObjectPoolInformationWindow(); + private MemoryPoolPoolInformationWindow _mMemoryPoolPoolInformationWindow = new MemoryPoolPoolInformationWindow(); + // private NetworkInformationWindow m_NetworkInformationWindow = new NetworkInformationWindow(); + private SettingsWindow m_SettingsWindow = new SettingsWindow(); + private OperationsWindow m_OperationsWindow = new OperationsWindow(); + + private FpsCounter m_FpsCounter = null; + + /// + /// 获取或设置调试器窗口是否激活。 + /// + public bool ActiveWindow + { + get + { + return m_DebuggerManager.ActiveWindow; + } + set + { + m_DebuggerManager.ActiveWindow = value; + enabled = value; + } + } + + /// + /// 获取或设置是否显示完整调试器界面。 + /// + public bool ShowFullWindow + { + get + { + return m_ShowFullWindow; + } + set + { + m_ShowFullWindow = value; + } + } + + /// + /// 获取或设置调试器漂浮框大小。 + /// + public Rect IconRect + { + get + { + return m_IconRect; + } + set + { + m_IconRect = value; + } + } + + /// + /// 获取或设置调试器窗口大小。 + /// + public Rect WindowRect + { + get + { + return m_WindowRect; + } + set + { + m_WindowRect = value; + } + } + + /// + /// 获取或设置调试器窗口缩放比例。 + /// + public float WindowScale + { + get + { + return m_WindowScale; + } + set + { + m_WindowScale = value; + } + } + + private SettingComponent m_SettingComponent = null; + + /// + /// 游戏框架组件初始化。 + /// + protected override void Awake() + { + base.Awake(); + + m_DebuggerManager = GameFrameworkEntry.GetModule(); + if (m_DebuggerManager == null) + { + Log.Fatal("Debugger manager is invalid."); + return; + } + + m_FpsCounter = new FpsCounter(0.5f); + + m_SettingComponent = GameEntry.GetComponent(); + if (m_SettingComponent == null) + { + Log.Fatal("Setting component is invalid."); + return; + } + + var lastIconX = m_SettingComponent.GetFloat("Debugger.Icon.X", DefaultIconRect.x); + var lastIconY = m_SettingComponent.GetFloat("Debugger.Icon.Y", DefaultIconRect.y); + var lastWindowX = m_SettingComponent.GetFloat("Debugger.Window.X", DefaultWindowRect.x); + var lastWindowY = m_SettingComponent.GetFloat("Debugger.Window.Y", DefaultWindowRect.y); + var lastWindowWidth = m_SettingComponent.GetFloat("Debugger.Window.Width", DefaultWindowRect.width); + var lastWindowHeight = m_SettingComponent.GetFloat("Debugger.Window.Height", DefaultWindowRect.height); + m_WindowScale = m_SettingComponent.GetFloat("Debugger.Window.Scale", DefaultWindowScale); + m_WindowRect = new Rect(lastIconX, lastIconY, DefaultIconRect.width, DefaultIconRect.height); + m_WindowRect = new Rect(lastWindowX, lastWindowY, lastWindowWidth, lastWindowHeight); + } + + private void OnDestroy() + { + if (m_SettingComponent == null) + { + Log.Fatal("Setting component is invalid."); + return; + } + + m_SettingComponent.Save(); + } + + private void Start() + { + RegisterDebuggerWindow("Console", m_ConsoleWindow); + RegisterDebuggerWindow("Information/System", m_SystemInformationWindow); + RegisterDebuggerWindow("Information/Environment", m_EnvironmentInformationWindow); + RegisterDebuggerWindow("Information/Screen", m_ScreenInformationWindow); + RegisterDebuggerWindow("Information/Graphics", m_GraphicsInformationWindow); + RegisterDebuggerWindow("Information/Input/Summary", m_InputSummaryInformationWindow); + RegisterDebuggerWindow("Information/Input/Touch", m_InputTouchInformationWindow); + RegisterDebuggerWindow("Information/Input/Location", m_InputLocationInformationWindow); + RegisterDebuggerWindow("Information/Input/Acceleration", m_InputAccelerationInformationWindow); + RegisterDebuggerWindow("Information/Input/Gyroscope", m_InputGyroscopeInformationWindow); + RegisterDebuggerWindow("Information/Input/Compass", m_InputCompassInformationWindow); + RegisterDebuggerWindow("Information/Other/Scene", m_SceneInformationWindow); + RegisterDebuggerWindow("Information/Other/Path", m_PathInformationWindow); + RegisterDebuggerWindow("Information/Other/Time", m_TimeInformationWindow); + RegisterDebuggerWindow("Information/Other/Quality", m_QualityInformationWindow); + RegisterDebuggerWindow("Profiler/Summary", m_ProfilerInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Summary", m_RuntimeMemorySummaryWindow); + RegisterDebuggerWindow("Profiler/Memory/All", m_RuntimeMemoryAllInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Texture", m_RuntimeMemoryTextureInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Mesh", m_RuntimeMemoryMeshInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Material", m_RuntimeMemoryMaterialInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Shader", m_RuntimeMemoryShaderInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/AnimationClip", m_RuntimeMemoryAnimationClipInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/AudioClip", m_RuntimeMemoryAudioClipInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Font", m_RuntimeMemoryFontInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/TextAsset", m_RuntimeMemoryTextAssetInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", m_RuntimeMemoryScriptableObjectInformationWindow); + RegisterDebuggerWindow("Profiler/Object Pool", m_ObjectPoolInformationWindow); + RegisterDebuggerWindow("Profiler/Reference Pool", _mMemoryPoolPoolInformationWindow); + // RegisterDebuggerWindow("Profiler/Network", m_NetworkInformationWindow); + RegisterDebuggerWindow("Other/Settings", m_SettingsWindow); + RegisterDebuggerWindow("Other/Operations", m_OperationsWindow); + + switch (m_ActiveWindow) + { + case DebuggerActiveWindowType.AlwaysOpen: + ActiveWindow = true; + break; + + case DebuggerActiveWindowType.OnlyOpenWhenDevelopment: + ActiveWindow = Debug.isDebugBuild; + break; + + case DebuggerActiveWindowType.OnlyOpenInEditor: + ActiveWindow = Application.isEditor; + break; + + default: + ActiveWindow = false; + break; + } + } + + private void Update() + { + m_FpsCounter.Update(Time.deltaTime, Time.unscaledDeltaTime); + } + + private void OnGUI() + { + if (m_DebuggerManager == null || !m_DebuggerManager.ActiveWindow) + { + return; + } + + GUISkin cachedGuiSkin = GUI.skin; + Matrix4x4 cachedMatrix = GUI.matrix; + + GUI.skin = m_Skin; + GUI.matrix = Matrix4x4.Scale(new Vector3(m_WindowScale, m_WindowScale, 1f)); + + if (m_ShowFullWindow) + { + m_WindowRect = GUILayout.Window(0, m_WindowRect, DrawWindow, "TENGINE DEBUGGER"); + } + else + { + m_IconRect = GUILayout.Window(0, m_IconRect, DrawDebuggerWindowIcon, "DEBUGGER"); + } + + GUI.matrix = cachedMatrix; + GUI.skin = cachedGuiSkin; + } + + /// + /// 注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要注册的调试器窗口。 + /// 初始化调试器窗口参数。 + public void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow, params object[] args) + { + m_DebuggerManager.RegisterDebuggerWindow(path, debuggerWindow, args); + } + + /// + /// 解除注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 是否解除注册调试器窗口成功。 + public bool UnregisterDebuggerWindow(string path) + { + return m_DebuggerManager.UnregisterDebuggerWindow(path); + } + + /// + /// 获取调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要获取的调试器窗口。 + public IDebuggerWindow GetDebuggerWindow(string path) + { + return m_DebuggerManager.GetDebuggerWindow(path); + } + + /// + /// 选中调试器窗口。 + /// + /// 调试器窗口路径。 + /// 是否成功选中调试器窗口。 + public bool SelectDebuggerWindow(string path) + { + return m_DebuggerManager.SelectDebuggerWindow(path); + } + + /// + /// 还原调试器窗口布局。 + /// + public void ResetLayout() + { + IconRect = DefaultIconRect; + WindowRect = DefaultWindowRect; + WindowScale = DefaultWindowScale; + } + + /// + /// 获取记录的所有日志。 + /// + /// 要获取的日志。 + public void GetRecentLogs(List results) + { + m_ConsoleWindow.GetRecentLogs(results); + } + + /// + /// 获取记录的最近日志。 + /// + /// 要获取的日志。 + /// 要获取最近日志的数量。 + public void GetRecentLogs(List results, int count) + { + m_ConsoleWindow.GetRecentLogs(results, count); + } + + private void DrawWindow(int windowId) + { + GUI.DragWindow(m_DragRect); + DrawDebuggerWindowGroup(m_DebuggerManager.DebuggerWindowRoot); + } + + private void DrawDebuggerWindowGroup(IDebuggerWindowGroup debuggerWindowGroup) + { + if (debuggerWindowGroup == null) + { + return; + } + + List names = new List(); + string[] debuggerWindowNames = debuggerWindowGroup.GetDebuggerWindowNames(); + for (int i = 0; i < debuggerWindowNames.Length; i++) + { + names.Add(Utility.Text.Format("{0}", debuggerWindowNames[i])); + } + + if (debuggerWindowGroup == m_DebuggerManager.DebuggerWindowRoot) + { + names.Add("Close"); + } + + int toolbarIndex = GUILayout.Toolbar(debuggerWindowGroup.SelectedIndex, names.ToArray(), GUILayout.Height(30f), GUILayout.MaxWidth(Screen.width)); + if (toolbarIndex >= debuggerWindowGroup.DebuggerWindowCount) + { + m_ShowFullWindow = false; + return; + } + + if (debuggerWindowGroup.SelectedWindow == null) + { + return; + } + + if (debuggerWindowGroup.SelectedIndex != toolbarIndex) + { + debuggerWindowGroup.SelectedWindow.OnLeave(); + debuggerWindowGroup.SelectedIndex = toolbarIndex; + debuggerWindowGroup.SelectedWindow.OnEnter(); + } + + IDebuggerWindowGroup subDebuggerWindowGroup = debuggerWindowGroup.SelectedWindow as IDebuggerWindowGroup; + if (subDebuggerWindowGroup != null) + { + DrawDebuggerWindowGroup(subDebuggerWindowGroup); + } + + debuggerWindowGroup.SelectedWindow.OnDraw(); + } + + private void DrawDebuggerWindowIcon(int windowId) + { + GUI.DragWindow(m_DragRect); + GUILayout.Space(5); + Color32 color = Color.white; + m_ConsoleWindow.RefreshCount(); + if (m_ConsoleWindow.FatalCount > 0) + { + color = m_ConsoleWindow.GetLogStringColor(LogType.Exception); + } + else if (m_ConsoleWindow.ErrorCount > 0) + { + color = m_ConsoleWindow.GetLogStringColor(LogType.Error); + } + else if (m_ConsoleWindow.WarningCount > 0) + { + color = m_ConsoleWindow.GetLogStringColor(LogType.Warning); + } + else + { + color = m_ConsoleWindow.GetLogStringColor(LogType.Log); + } + + string title = Utility.Text.Format("FPS: {4:F2}", color.r, color.g, color.b, color.a, m_FpsCounter.CurrentFps); + if (GUILayout.Button(title, GUILayout.Width(100f), GUILayout.Height(40f))) + { + m_ShowFullWindow = true; + } + } + + private static void CopyToClipboard(string content) + { + s_TextEditor.text = content; + s_TextEditor.OnFocus(); + s_TextEditor.Copy(); + s_TextEditor.text = string.Empty; + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.cs.meta new file mode 100644 index 00000000..84aeedb7 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d58978a9ed0f473ca3cc5a302c3bf87b +timeCreated: 1680489774 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs new file mode 100644 index 00000000..73118c48 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs @@ -0,0 +1,300 @@ +using System.Collections.Generic; + +namespace TEngine +{ + internal sealed partial class DebuggerManager : GameFrameworkModule, IDebuggerManager + { + /// + /// 调试器窗口组。 + /// + private sealed class DebuggerWindowGroup : IDebuggerWindowGroup + { + private readonly List> m_DebuggerWindows; + private int m_SelectedIndex; + private string[] m_DebuggerWindowNames; + + public DebuggerWindowGroup() + { + m_DebuggerWindows = new List>(); + m_SelectedIndex = 0; + m_DebuggerWindowNames = null; + } + + /// + /// 获取调试器窗口数量。 + /// + public int DebuggerWindowCount + { + get + { + return m_DebuggerWindows.Count; + } + } + + /// + /// 获取或设置当前选中的调试器窗口索引。 + /// + public int SelectedIndex + { + get + { + return m_SelectedIndex; + } + set + { + m_SelectedIndex = value; + } + } + + /// + /// 获取当前选中的调试器窗口。 + /// + public IDebuggerWindow SelectedWindow + { + get + { + if (m_SelectedIndex >= m_DebuggerWindows.Count) + { + return null; + } + + return m_DebuggerWindows[m_SelectedIndex].Value; + } + } + + /// + /// 初始化调试组。 + /// + /// 初始化调试组参数。 + public void Initialize(params object[] args) + { + } + + /// + /// 关闭调试组。 + /// + public void Shutdown() + { + foreach (KeyValuePair debuggerWindow in m_DebuggerWindows) + { + debuggerWindow.Value.Shutdown(); + } + + m_DebuggerWindows.Clear(); + } + + /// + /// 进入调试器窗口。 + /// + public void OnEnter() + { + SelectedWindow.OnEnter(); + } + + /// + /// 离开调试器窗口。 + /// + public void OnLeave() + { + SelectedWindow.OnLeave(); + } + + /// + /// 调试组轮询。 + /// + /// 逻辑流逝时间,以秒为单位。 + /// 真实流逝时间,以秒为单位。 + public void OnUpdate(float elapseSeconds, float realElapseSeconds) + { + SelectedWindow.OnUpdate(elapseSeconds, realElapseSeconds); + } + + /// + /// 调试器窗口绘制。 + /// + public void OnDraw() + { + } + + private void RefreshDebuggerWindowNames() + { + int index = 0; + m_DebuggerWindowNames = new string[m_DebuggerWindows.Count]; + foreach (KeyValuePair debuggerWindow in m_DebuggerWindows) + { + m_DebuggerWindowNames[index++] = debuggerWindow.Key; + } + } + + /// + /// 获取调试组的调试器窗口名称集合。 + /// + public string[] GetDebuggerWindowNames() + { + return m_DebuggerWindowNames; + } + + /// + /// 获取调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要获取的调试器窗口。 + public IDebuggerWindow GetDebuggerWindow(string path) + { + if (string.IsNullOrEmpty(path)) + { + return null; + } + + int pos = path.IndexOf('/'); + if (pos < 0 || pos >= path.Length - 1) + { + return InternalGetDebuggerWindow(path); + } + + string debuggerWindowGroupName = path.Substring(0, pos); + string leftPath = path.Substring(pos + 1); + DebuggerWindowGroup debuggerWindowGroup = (DebuggerWindowGroup)InternalGetDebuggerWindow(debuggerWindowGroupName); + if (debuggerWindowGroup == null) + { + return null; + } + + return debuggerWindowGroup.GetDebuggerWindow(leftPath); + } + + /// + /// 选中调试器窗口。 + /// + /// 调试器窗口路径。 + /// 是否成功选中调试器窗口。 + public bool SelectDebuggerWindow(string path) + { + if (string.IsNullOrEmpty(path)) + { + return false; + } + + int pos = path.IndexOf('/'); + if (pos < 0 || pos >= path.Length - 1) + { + return InternalSelectDebuggerWindow(path); + } + + string debuggerWindowGroupName = path.Substring(0, pos); + string leftPath = path.Substring(pos + 1); + DebuggerWindowGroup debuggerWindowGroup = (DebuggerWindowGroup)InternalGetDebuggerWindow(debuggerWindowGroupName); + if (debuggerWindowGroup == null || !InternalSelectDebuggerWindow(debuggerWindowGroupName)) + { + return false; + } + + return debuggerWindowGroup.SelectDebuggerWindow(leftPath); + } + + /// + /// 注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要注册的调试器窗口。 + public void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow) + { + if (string.IsNullOrEmpty(path)) + { + throw new GameFrameworkException("Path is invalid."); + } + + int pos = path.IndexOf('/'); + if (pos < 0 || pos >= path.Length - 1) + { + if (InternalGetDebuggerWindow(path) != null) + { + throw new GameFrameworkException("Debugger window has been registered."); + } + + m_DebuggerWindows.Add(new KeyValuePair(path, debuggerWindow)); + RefreshDebuggerWindowNames(); + } + else + { + string debuggerWindowGroupName = path.Substring(0, pos); + string leftPath = path.Substring(pos + 1); + DebuggerWindowGroup debuggerWindowGroup = (DebuggerWindowGroup)InternalGetDebuggerWindow(debuggerWindowGroupName); + if (debuggerWindowGroup == null) + { + if (InternalGetDebuggerWindow(debuggerWindowGroupName) != null) + { + throw new GameFrameworkException("Debugger window has been registered, can not create debugger window group."); + } + + debuggerWindowGroup = new DebuggerWindowGroup(); + m_DebuggerWindows.Add(new KeyValuePair(debuggerWindowGroupName, debuggerWindowGroup)); + RefreshDebuggerWindowNames(); + } + + debuggerWindowGroup.RegisterDebuggerWindow(leftPath, debuggerWindow); + } + } + + /// + /// 解除注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 是否解除注册调试器窗口成功。 + public bool UnregisterDebuggerWindow(string path) + { + if (string.IsNullOrEmpty(path)) + { + return false; + } + + int pos = path.IndexOf('/'); + if (pos < 0 || pos >= path.Length - 1) + { + IDebuggerWindow debuggerWindow = InternalGetDebuggerWindow(path); + bool result = m_DebuggerWindows.Remove(new KeyValuePair(path, debuggerWindow)); + debuggerWindow.Shutdown(); + RefreshDebuggerWindowNames(); + return result; + } + + string debuggerWindowGroupName = path.Substring(0, pos); + string leftPath = path.Substring(pos + 1); + DebuggerWindowGroup debuggerWindowGroup = (DebuggerWindowGroup)InternalGetDebuggerWindow(debuggerWindowGroupName); + if (debuggerWindowGroup == null) + { + return false; + } + + return debuggerWindowGroup.UnregisterDebuggerWindow(leftPath); + } + + private IDebuggerWindow InternalGetDebuggerWindow(string name) + { + foreach (KeyValuePair debuggerWindow in m_DebuggerWindows) + { + if (debuggerWindow.Key == name) + { + return debuggerWindow.Value; + } + } + + return null; + } + + private bool InternalSelectDebuggerWindow(string name) + { + for (int i = 0; i < m_DebuggerWindows.Count; i++) + { + if (m_DebuggerWindows[i].Key == name) + { + m_SelectedIndex = i; + return true; + } + } + + return false; + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs.meta new file mode 100644 index 00000000..18fbccf8 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d4a3c5214e924154ad543eae04e6cb7e +timeCreated: 1680489597 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.cs new file mode 100644 index 00000000..06cd2aa8 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.cs @@ -0,0 +1,134 @@ +namespace TEngine +{ + /// + /// 调试器管理器。 + /// + internal sealed partial class DebuggerManager : GameFrameworkModule, IDebuggerManager + { + private readonly DebuggerWindowGroup m_DebuggerWindowRoot; + private bool m_ActiveWindow; + + /// + /// 初始化调试器管理器的新实例。 + /// + public DebuggerManager() + { + m_DebuggerWindowRoot = new DebuggerWindowGroup(); + m_ActiveWindow = false; + } + + /// + /// 获取游戏框架模块优先级。 + /// + /// 优先级较高的模块会优先轮询,并且关闭操作会后进行。 + internal override int Priority + { + get + { + return -1; + } + } + + /// + /// 获取或设置调试器窗口是否激活。 + /// + public bool ActiveWindow + { + get + { + return m_ActiveWindow; + } + set + { + m_ActiveWindow = value; + } + } + + /// + /// 调试器窗口根结点。 + /// + public IDebuggerWindowGroup DebuggerWindowRoot + { + get + { + return m_DebuggerWindowRoot; + } + } + + /// + /// 调试器管理器轮询。 + /// + /// 逻辑流逝时间,以秒为单位。 + /// 真实流逝时间,以秒为单位。 + internal override void Update(float elapseSeconds, float realElapseSeconds) + { + if (!m_ActiveWindow) + { + return; + } + + m_DebuggerWindowRoot.OnUpdate(elapseSeconds, realElapseSeconds); + } + + /// + /// 关闭并清理调试器管理器。 + /// + internal override void Shutdown() + { + m_ActiveWindow = false; + m_DebuggerWindowRoot.Shutdown(); + } + + /// + /// 注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要注册的调试器窗口。 + /// 初始化调试器窗口参数。 + public void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow, params object[] args) + { + if (string.IsNullOrEmpty(path)) + { + throw new GameFrameworkException("Path is invalid."); + } + + if (debuggerWindow == null) + { + throw new GameFrameworkException("Debugger window is invalid."); + } + + m_DebuggerWindowRoot.RegisterDebuggerWindow(path, debuggerWindow); + debuggerWindow.Initialize(args); + } + + /// + /// 解除注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 是否解除注册调试器窗口成功。 + public bool UnregisterDebuggerWindow(string path) + { + return m_DebuggerWindowRoot.UnregisterDebuggerWindow(path); + } + + /// + /// 获取调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要获取的调试器窗口。 + public IDebuggerWindow GetDebuggerWindow(string path) + { + return m_DebuggerWindowRoot.GetDebuggerWindow(path); + } + + /// + /// 选中调试器窗口。 + /// + /// 调试器窗口路径。 + /// 是否成功选中调试器窗口。 + public bool SelectDebuggerWindow(string path) + { + return m_DebuggerWindowRoot.SelectDebuggerWindow(path); + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.cs.meta new file mode 100644 index 00000000..d854079d --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/DebuggerManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9ac1ec4655aa4faba2d1a0ddd044712b +timeCreated: 1680489597 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerManager.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerManager.cs new file mode 100644 index 00000000..5c175c41 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerManager.cs @@ -0,0 +1,54 @@ +namespace TEngine +{ + /// + /// 调试器管理器接口。 + /// + public interface IDebuggerManager + { + /// + /// 获取或设置调试器窗口是否激活。 + /// + bool ActiveWindow + { + get; + set; + } + + /// + /// 调试器窗口根结点。 + /// + IDebuggerWindowGroup DebuggerWindowRoot + { + get; + } + + /// + /// 注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要注册的调试器窗口。 + /// 初始化调试器窗口参数。 + void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow, params object[] args); + + /// + /// 解除注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 是否解除注册调试器窗口成功。 + bool UnregisterDebuggerWindow(string path); + + /// + /// 获取调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要获取的调试器窗口。 + IDebuggerWindow GetDebuggerWindow(string path); + + /// + /// 选中调试器窗口。 + /// + /// 调试器窗口路径。 + /// 是否成功选中调试器窗口。 + bool SelectDebuggerWindow(string path); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerManager.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerManager.cs.meta new file mode 100644 index 00000000..94b9727a --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d27aae441b2a4e299c230c968c76e839 +timeCreated: 1680489597 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindow.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindow.cs new file mode 100644 index 00000000..b219e847 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindow.cs @@ -0,0 +1,41 @@ +namespace TEngine +{ + /// + /// 调试器窗口接口。 + /// + public interface IDebuggerWindow + { + /// + /// 初始化调试器窗口。 + /// + /// 初始化调试器窗口参数。 + void Initialize(params object[] args); + + /// + /// 关闭调试器窗口。 + /// + void Shutdown(); + + /// + /// 进入调试器窗口。 + /// + void OnEnter(); + + /// + /// 离开调试器窗口。 + /// + void OnLeave(); + + /// + /// 调试器窗口轮询。 + /// + /// 逻辑流逝时间,以秒为单位。 + /// 真实流逝时间,以秒为单位。 + void OnUpdate(float elapseSeconds, float realElapseSeconds); + + /// + /// 调试器窗口绘制。 + /// + void OnDraw(); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindow.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindow.cs.meta new file mode 100644 index 00000000..e201e37e --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 41aa48cd603d432d8dffd4edc72f188d +timeCreated: 1680489597 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindowGroup.cs b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindowGroup.cs new file mode 100644 index 00000000..cf438a54 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindowGroup.cs @@ -0,0 +1,52 @@ +namespace TEngine +{ + /// + /// 调试器窗口组接口。 + /// + public interface IDebuggerWindowGroup : IDebuggerWindow + { + /// + /// 获取调试器窗口数量。 + /// + int DebuggerWindowCount + { + get; + } + + /// + /// 获取或设置当前选中的调试器窗口索引。 + /// + int SelectedIndex + { + get; + set; + } + + /// + /// 获取当前选中的调试器窗口。 + /// + IDebuggerWindow SelectedWindow + { + get; + } + + /// + /// 获取调试组的调试器窗口名称集合。 + /// + string[] GetDebuggerWindowNames(); + + /// + /// 获取调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要获取的调试器窗口。 + IDebuggerWindow GetDebuggerWindow(string path); + + /// + /// 注册调试器窗口。 + /// + /// 调试器窗口路径。 + /// 要注册的调试器窗口。 + void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindowGroup.cs.meta b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindowGroup.cs.meta new file mode 100644 index 00000000..fda94bc5 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Debugger/IDebuggerWindowGroup.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2fff84d86dd44f16b3bb44dfa29081c6 +timeCreated: 1680489597 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/GameFrameworkEntry.cs b/Assets/TEngine/Runtime/GameFramework/GameFrameworkEntry.cs index cf71cc09..7833c06a 100644 --- a/Assets/TEngine/Runtime/GameFramework/GameFrameworkEntry.cs +++ b/Assets/TEngine/Runtime/GameFramework/GameFrameworkEntry.cs @@ -48,12 +48,12 @@ namespace TEngine public static T GetModule() where T : class { Type interfaceType = typeof(T); - // if (!interfaceType.IsInterface) - // { - // throw new GameFrameworkException(Utility.Text.Format("You must get module by interface, but '{0}' is not.", interfaceType.FullName)); - // } + if (!interfaceType.IsInterface) + { + throw new GameFrameworkException(Utility.Text.Format("You must get module by interface, but '{0}' is not.", interfaceType.FullName)); + } - if (!interfaceType.FullName.StartsWith("GameFramework.", StringComparison.Ordinal)) + if (!interfaceType.FullName.StartsWith("TEngine.", StringComparison.Ordinal)) { throw new GameFrameworkException(Utility.Text.Format("You must get a Game Framework module, but '{0}' is not.", interfaceType.FullName)); } diff --git a/Assets/TEngine/Runtime/Localization.meta b/Assets/TEngine/Runtime/GameFramework/Localization.meta similarity index 100% rename from Assets/TEngine/Runtime/Localization.meta rename to Assets/TEngine/Runtime/GameFramework/Localization.meta diff --git a/Assets/TEngine/Runtime/Localization/Language.cs b/Assets/TEngine/Runtime/GameFramework/Localization/Language.cs similarity index 100% rename from Assets/TEngine/Runtime/Localization/Language.cs rename to Assets/TEngine/Runtime/GameFramework/Localization/Language.cs diff --git a/Assets/TEngine/Runtime/Localization/Language.cs.meta b/Assets/TEngine/Runtime/GameFramework/Localization/Language.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Localization/Language.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Localization/Language.cs.meta diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool.meta new file mode 100644 index 00000000..614268da --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8236a71bbd2a4ac4997bcb16ebff6f31 +timeCreated: 1680501170 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPool.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPool.cs new file mode 100644 index 00000000..91f59d3e --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPool.cs @@ -0,0 +1,211 @@ +using System; + +namespace TEngine +{ + /// + /// 对象池接口。 + /// + /// 对象类型。 + public interface IObjectPool where T : ObjectBase + { + /// + /// 获取对象池名称。 + /// + string Name + { + get; + } + + /// + /// 获取对象池完整名称。 + /// + string FullName + { + get; + } + + /// + /// 获取对象池对象类型。 + /// + Type ObjectType + { + get; + } + + /// + /// 获取对象池中对象的数量。 + /// + int Count + { + get; + } + + /// + /// 获取对象池中能被释放的对象的数量。 + /// + int CanReleaseCount + { + get; + } + + /// + /// 获取是否允许对象被多次获取。 + /// + bool AllowMultiSpawn + { + get; + } + + /// + /// 获取或设置对象池自动释放可释放对象的间隔秒数。 + /// + float AutoReleaseInterval + { + get; + set; + } + + /// + /// 获取或设置对象池的容量。 + /// + int Capacity + { + get; + set; + } + + /// + /// 获取或设置对象池对象过期秒数。 + /// + float ExpireTime + { + get; + set; + } + + /// + /// 获取或设置对象池的优先级。 + /// + int Priority + { + get; + set; + } + + /// + /// 创建对象。 + /// + /// 对象。 + /// 对象是否已被获取。 + void Register(T obj, bool spawned); + + /// + /// 检查对象。 + /// + /// 要检查的对象是否存在。 + bool CanSpawn(); + + /// + /// 检查对象。 + /// + /// 对象名称。 + /// 要检查的对象是否存在。 + bool CanSpawn(string name); + + /// + /// 获取对象。 + /// + /// 要获取的对象。 + T Spawn(); + + /// + /// 获取对象。 + /// + /// 对象名称。 + /// 要获取的对象。 + T Spawn(string name); + + /// + /// 回收对象。 + /// + /// 要回收的对象。 + void Unspawn(T obj); + + /// + /// 回收对象。 + /// + /// 要回收的对象。 + void Unspawn(object target); + + /// + /// 设置对象是否被加锁。 + /// + /// 要设置被加锁的对象。 + /// 是否被加锁。 + void SetLocked(T obj, bool locked); + + /// + /// 设置对象是否被加锁。 + /// + /// 要设置被加锁的对象。 + /// 是否被加锁。 + void SetLocked(object target, bool locked); + + /// + /// 设置对象的优先级。 + /// + /// 要设置优先级的对象。 + /// 优先级。 + void SetPriority(T obj, int priority); + + /// + /// 设置对象的优先级。 + /// + /// 要设置优先级的对象。 + /// 优先级。 + void SetPriority(object target, int priority); + + /// + /// 释放对象。 + /// + /// 要释放的对象。 + /// 释放对象是否成功。 + bool ReleaseObject(T obj); + + /// + /// 释放对象。 + /// + /// 要释放的对象。 + /// 释放对象是否成功。 + bool ReleaseObject(object target); + + /// + /// 释放对象池中的可释放对象。 + /// + void Release(); + + /// + /// 释放对象池中的可释放对象。 + /// + /// 尝试释放对象数量。 + void Release(int toReleaseCount); + + /// + /// 释放对象池中的可释放对象。 + /// + /// 释放对象筛选函数。 + void Release(ReleaseObjectFilterCallback releaseObjectFilterCallback); + + /// + /// 释放对象池中的可释放对象。 + /// + /// 尝试释放对象数量。 + /// 释放对象筛选函数。 + void Release(int toReleaseCount, ReleaseObjectFilterCallback releaseObjectFilterCallback); + + /// + /// 释放对象池中的所有未使用对象。 + /// + void ReleaseAllUnused(); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPool.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPool.cs.meta new file mode 100644 index 00000000..99dee097 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPool.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1582208c233e48f9b3707a8ebc230df7 +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPoolManager.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPoolManager.cs new file mode 100644 index 00000000..4064e27c --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPoolManager.cs @@ -0,0 +1,744 @@ +using System; +using System.Collections.Generic; + +namespace TEngine +{ + /// + /// 对象池管理器。 + /// + public interface IObjectPoolManager + { + /// + /// 获取对象池数量。 + /// + int Count + { + get; + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 是否存在对象池。 + bool HasObjectPool() where T : ObjectBase; + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 是否存在对象池。 + bool HasObjectPool(Type objectType); + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 是否存在对象池。 + bool HasObjectPool(string name) where T : ObjectBase; + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 是否存在对象池。 + bool HasObjectPool(Type objectType, string name); + + /// + /// 检查是否存在对象池。 + /// + /// 要检查的条件。 + /// 是否存在对象池。 + bool HasObjectPool(Predicate condition); + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 要获取的对象池。 + IObjectPool GetObjectPool() where T : ObjectBase; + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 要获取的对象池。 + ObjectPoolBase GetObjectPool(Type objectType); + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要获取的对象池。 + IObjectPool GetObjectPool(string name) where T : ObjectBase; + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要获取的对象池。 + ObjectPoolBase GetObjectPool(Type objectType, string name); + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + ObjectPoolBase GetObjectPool(Predicate condition); + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + ObjectPoolBase[] GetObjectPools(Predicate condition); + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + void GetObjectPools(Predicate condition, List results); + + /// + /// 获取所有对象池。 + /// + /// 所有对象池。 + ObjectPoolBase[] GetAllObjectPools(); + + /// + /// 获取所有对象池。 + /// + /// 所有对象池。 + void GetAllObjectPools(List results); + + /// + /// 获取所有对象池。 + /// + /// 是否根据对象池的优先级排序。 + /// 所有对象池。 + ObjectPoolBase[] GetAllObjectPools(bool sort); + + /// + /// 获取所有对象池。 + /// + /// 是否根据对象池的优先级排序。 + /// 所有对象池。 + void GetAllObjectPools(bool sort, List results); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool() where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(string name) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(int capacity) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(float expireTime) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, float expireTime); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(string name, int capacity) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(string name, float expireTime) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float expireTime); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(int capacity, float expireTime) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, float expireTime); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(int capacity, int priority) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, int priority); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, float expireTime, int priority); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, float expireTime) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, float expireTime); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, int priority) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, int priority); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(string name, float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float expireTime, int priority); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(int capacity, float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, float expireTime, int priority); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, float expireTime, int priority); + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + IObjectPool CreateSingleSpawnObjectPool(string name, float autoReleaseInterval, int capacity, float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float autoReleaseInterval, int capacity, float expireTime, int priority); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool() where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(string name) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(int capacity) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(float expireTime) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, float expireTime); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(string name, int capacity) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(string name, float expireTime) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float expireTime); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(int capacity, float expireTime) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, float expireTime); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(int capacity, int priority) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, int priority); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, float expireTime, int priority); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, float expireTime) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, float expireTime); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, int priority) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, int priority); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(string name, float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float expireTime, int priority); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(int capacity, float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, float expireTime, int priority); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, float expireTime, int priority); + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + IObjectPool CreateMultiSpawnObjectPool(string name, float autoReleaseInterval, int capacity, float expireTime, int priority) where T : ObjectBase; + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float autoReleaseInterval, int capacity, float expireTime, int priority); + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 是否销毁对象池成功。 + bool DestroyObjectPool() where T : ObjectBase; + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 是否销毁对象池成功。 + bool DestroyObjectPool(Type objectType); + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池名称。 + /// 是否销毁对象池成功。 + bool DestroyObjectPool(string name) where T : ObjectBase; + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池名称。 + /// 是否销毁对象池成功。 + bool DestroyObjectPool(Type objectType, string name); + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池。 + /// 是否销毁对象池成功。 + bool DestroyObjectPool(IObjectPool objectPool) where T : ObjectBase; + + /// + /// 销毁对象池。 + /// + /// 要销毁的对象池。 + /// 是否销毁对象池成功。 + bool DestroyObjectPool(ObjectPoolBase objectPool); + + /// + /// 释放对象池中的可释放对象。 + /// + void Release(); + + /// + /// 释放对象池中的所有未使用对象。 + /// + void ReleaseAllUnused(); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPoolManager.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPoolManager.cs.meta new file mode 100644 index 00000000..24030d9f --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/IObjectPoolManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 669817740b024599b6f700ecc9fd0db8 +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectBase.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectBase.cs new file mode 100644 index 00000000..577c9c17 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectBase.cs @@ -0,0 +1,200 @@ +using System; + +namespace TEngine +{ + /// + /// 对象基类。 + /// + public abstract class ObjectBase : IMemory + { + private string m_Name; + private object m_Target; + private bool m_Locked; + private int m_Priority; + private DateTime m_LastUseTime; + + /// + /// 初始化对象基类的新实例。 + /// + public ObjectBase() + { + m_Name = null; + m_Target = null; + m_Locked = false; + m_Priority = 0; + m_LastUseTime = default(DateTime); + } + + /// + /// 获取对象名称。 + /// + public string Name + { + get + { + return m_Name; + } + } + + /// + /// 获取对象。 + /// + public object Target + { + get + { + return m_Target; + } + } + + /// + /// 获取或设置对象是否被加锁。 + /// + public bool Locked + { + get + { + return m_Locked; + } + set + { + m_Locked = value; + } + } + + /// + /// 获取或设置对象的优先级。 + /// + public int Priority + { + get + { + return m_Priority; + } + set + { + m_Priority = value; + } + } + + /// + /// 获取自定义释放检查标记。 + /// + public virtual bool CustomCanReleaseFlag + { + get + { + return true; + } + } + + /// + /// 获取对象上次使用时间。 + /// + public DateTime LastUseTime + { + get + { + return m_LastUseTime; + } + internal set + { + m_LastUseTime = value; + } + } + + /// + /// 初始化对象基类。 + /// + /// 对象。 + protected void Initialize(object target) + { + Initialize(null, target, false, 0); + } + + /// + /// 初始化对象基类。 + /// + /// 对象名称。 + /// 对象。 + protected void Initialize(string name, object target) + { + Initialize(name, target, false, 0); + } + + /// + /// 初始化对象基类。 + /// + /// 对象名称。 + /// 对象。 + /// 对象是否被加锁。 + protected void Initialize(string name, object target, bool locked) + { + Initialize(name, target, locked, 0); + } + + /// + /// 初始化对象基类。 + /// + /// 对象名称。 + /// 对象。 + /// 对象的优先级。 + protected void Initialize(string name, object target, int priority) + { + Initialize(name, target, false, priority); + } + + /// + /// 初始化对象基类。 + /// + /// 对象名称。 + /// 对象。 + /// 对象是否被加锁。 + /// 对象的优先级。 + protected void Initialize(string name, object target, bool locked, int priority) + { + if (target == null) + { + throw new GameFrameworkException(Utility.Text.Format("Target '{0}' is invalid.", name)); + } + + m_Name = name ?? string.Empty; + m_Target = target; + m_Locked = locked; + m_Priority = priority; + m_LastUseTime = DateTime.UtcNow; + } + + /// + /// 清理对象基类。 + /// + public virtual void Clear() + { + m_Name = null; + m_Target = null; + m_Locked = false; + m_Priority = 0; + m_LastUseTime = default(DateTime); + } + + /// + /// 获取对象时的事件。 + /// + protected internal virtual void OnSpawn() + { + } + + /// + /// 回收对象时的事件。 + /// + protected internal virtual void OnUnspawn() + { + } + + /// + /// 释放对象。 + /// + /// 是否是关闭对象池时触发。 + protected internal abstract void Release(bool isShutdown); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectBase.cs.meta new file mode 100644 index 00000000..1777cf2e --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 524a94dffe1f4918a09b5922fba3778b +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectInfo.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectInfo.cs new file mode 100644 index 00000000..c018992c --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectInfo.cs @@ -0,0 +1,115 @@ +using System; +using System.Runtime.InteropServices; + +namespace TEngine +{ + /// + /// 对象信息。 + /// + [StructLayout(LayoutKind.Auto)] + public struct ObjectInfo + { + private readonly string m_Name; + private readonly bool m_Locked; + private readonly bool m_CustomCanReleaseFlag; + private readonly int m_Priority; + private readonly DateTime m_LastUseTime; + private readonly int m_SpawnCount; + + /// + /// 初始化对象信息的新实例。 + /// + /// 对象名称。 + /// 对象是否被加锁。 + /// 对象自定义释放检查标记。 + /// 对象的优先级。 + /// 对象上次使用时间。 + /// 对象的获取计数。 + public ObjectInfo(string name, bool locked, bool customCanReleaseFlag, int priority, DateTime lastUseTime, int spawnCount) + { + m_Name = name; + m_Locked = locked; + m_CustomCanReleaseFlag = customCanReleaseFlag; + m_Priority = priority; + m_LastUseTime = lastUseTime; + m_SpawnCount = spawnCount; + } + + /// + /// 获取对象名称。 + /// + public string Name + { + get + { + return m_Name; + } + } + + /// + /// 获取对象是否被加锁。 + /// + public bool Locked + { + get + { + return m_Locked; + } + } + + /// + /// 获取对象自定义释放检查标记。 + /// + public bool CustomCanReleaseFlag + { + get + { + return m_CustomCanReleaseFlag; + } + } + + /// + /// 获取对象的优先级。 + /// + public int Priority + { + get + { + return m_Priority; + } + } + + /// + /// 获取对象上次使用时间。 + /// + public DateTime LastUseTime + { + get + { + return m_LastUseTime; + } + } + + /// + /// 获取对象是否正在使用。 + /// + public bool IsInUse + { + get + { + return m_SpawnCount > 0; + } + } + + /// + /// 获取对象的获取计数。 + /// + public int SpawnCount + { + get + { + return m_SpawnCount; + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectInfo.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectInfo.cs.meta new file mode 100644 index 00000000..701ca5c1 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5269851c1924478e8f3150fc57f8d36f +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolBase.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolBase.cs new file mode 100644 index 00000000..2bbcc467 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolBase.cs @@ -0,0 +1,145 @@ +using System; + +namespace TEngine +{ + /// + /// 对象池基类。 + /// + public abstract class ObjectPoolBase + { + private readonly string m_Name; + + /// + /// 初始化对象池基类的新实例。 + /// + public ObjectPoolBase() + : this(null) + { + } + + /// + /// 初始化对象池基类的新实例。 + /// + /// 对象池名称。 + public ObjectPoolBase(string name) + { + m_Name = name ?? string.Empty; + } + + /// + /// 获取对象池名称。 + /// + public string Name + { + get + { + return m_Name; + } + } + + /// + /// 获取对象池完整名称。 + /// + public string FullName + { + get + { + return new TypeNamePair(ObjectType, m_Name).ToString(); + } + } + + /// + /// 获取对象池对象类型。 + /// + public abstract Type ObjectType + { + get; + } + + /// + /// 获取对象池中对象的数量。 + /// + public abstract int Count + { + get; + } + + /// + /// 获取对象池中能被释放的对象的数量。 + /// + public abstract int CanReleaseCount + { + get; + } + + /// + /// 获取是否允许对象被多次获取。 + /// + public abstract bool AllowMultiSpawn + { + get; + } + + /// + /// 获取或设置对象池自动释放可释放对象的间隔秒数。 + /// + public abstract float AutoReleaseInterval + { + get; + set; + } + + /// + /// 获取或设置对象池的容量。 + /// + public abstract int Capacity + { + get; + set; + } + + /// + /// 获取或设置对象池对象过期秒数。 + /// + public abstract float ExpireTime + { + get; + set; + } + + /// + /// 获取或设置对象池的优先级。 + /// + public abstract int Priority + { + get; + set; + } + + /// + /// 释放对象池中的可释放对象。 + /// + public abstract void Release(); + + /// + /// 释放对象池中的可释放对象。 + /// + /// 尝试释放对象数量。 + public abstract void Release(int toReleaseCount); + + /// + /// 释放对象池中的所有未使用对象。 + /// + public abstract void ReleaseAllUnused(); + + /// + /// 获取所有对象信息。 + /// + /// 所有对象信息。 + public abstract ObjectInfo[] GetAllObjectInfos(); + + internal abstract void Update(float elapseSeconds, float realElapseSeconds); + + internal abstract void Shutdown(); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolBase.cs.meta new file mode 100644 index 00000000..10f7822b --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f8ab28e091804ce3ba660e7948f37ca8 +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolComponent.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolComponent.cs new file mode 100644 index 00000000..56b00fd0 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolComponent.cs @@ -0,0 +1,1023 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace TEngine +{ + /// + /// 对象池组件。 + /// + [DisallowMultipleComponent] + public sealed class ObjectPoolComponent : GameFrameworkComponent + { + private IObjectPoolManager m_ObjectPoolManager = null; + + /// + /// 获取对象池数量。 + /// + public int Count + { + get + { + return m_ObjectPoolManager.Count; + } + } + + /// + /// 游戏框架组件初始化。 + /// + protected override void Awake() + { + base.Awake(); + + m_ObjectPoolManager = GameFrameworkEntry.GetModule(); + if (m_ObjectPoolManager == null) + { + Log.Fatal("Object pool manager is invalid."); + return; + } + } + + private void Start() + { + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 是否存在对象池。 + public bool HasObjectPool() where T : ObjectBase + { + return m_ObjectPoolManager.HasObjectPool(); + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 是否存在对象池。 + public bool HasObjectPool(Type objectType) + { + return m_ObjectPoolManager.HasObjectPool(objectType); + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 是否存在对象池。 + public bool HasObjectPool(string name) where T : ObjectBase + { + return m_ObjectPoolManager.HasObjectPool(name); + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 是否存在对象池。 + public bool HasObjectPool(Type objectType, string name) + { + return m_ObjectPoolManager.HasObjectPool(objectType, name); + } + + /// + /// 检查是否存在对象池。 + /// + /// 要检查的条件。 + /// 是否存在对象池。 + public bool HasObjectPool(Predicate condition) + { + return m_ObjectPoolManager.HasObjectPool(condition); + } + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 要获取的对象池。 + public IObjectPool GetObjectPool() where T : ObjectBase + { + return m_ObjectPoolManager.GetObjectPool(); + } + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 要获取的对象池。 + public ObjectPoolBase GetObjectPool(Type objectType) + { + return m_ObjectPoolManager.GetObjectPool(objectType); + } + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要获取的对象池。 + public IObjectPool GetObjectPool(string name) where T : ObjectBase + { + return m_ObjectPoolManager.GetObjectPool(name); + } + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要获取的对象池。 + public ObjectPoolBase GetObjectPool(Type objectType, string name) + { + return m_ObjectPoolManager.GetObjectPool(objectType, name); + } + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + public ObjectPoolBase GetObjectPool(Predicate condition) + { + return m_ObjectPoolManager.GetObjectPool(condition); + } + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + public ObjectPoolBase[] GetObjectPools(Predicate condition) + { + return m_ObjectPoolManager.GetObjectPools(condition); + } + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + public void GetObjectPools(Predicate condition, List results) + { + m_ObjectPoolManager.GetObjectPools(condition, results); + } + + /// + /// 获取所有对象池。 + /// + public ObjectPoolBase[] GetAllObjectPools() + { + return m_ObjectPoolManager.GetAllObjectPools(); + } + + /// + /// 获取所有对象池。 + /// + /// 所有对象池。 + public void GetAllObjectPools(List results) + { + m_ObjectPoolManager.GetAllObjectPools(results); + } + + /// + /// 获取所有对象池。 + /// + /// 是否根据对象池的优先级排序。 + /// 所有对象池。 + public ObjectPoolBase[] GetAllObjectPools(bool sort) + { + return m_ObjectPoolManager.GetAllObjectPools(sort); + } + + /// + /// 获取所有对象池。 + /// + /// 是否根据对象池的优先级排序。 + /// 所有对象池。 + public void GetAllObjectPools(bool sort, List results) + { + m_ObjectPoolManager.GetAllObjectPools(sort, results); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool() where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(name); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, name); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(int capacity) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(capacity); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, capacity); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(float expireTime) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(expireTime); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, float expireTime) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, expireTime); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, int capacity) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(name, capacity); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, name, capacity); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, float expireTime) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(name, expireTime); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float expireTime) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, name, expireTime); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(int capacity, float expireTime) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(capacity, expireTime); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, float expireTime) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, capacity, expireTime); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(int capacity, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(capacity, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, int priority) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, capacity, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, float expireTime) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(name, capacity, expireTime); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, float expireTime) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, name, capacity, expireTime); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(name, capacity, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, int priority) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, name, capacity, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(name, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, name, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(int capacity, float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(name, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, name, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, float autoReleaseInterval, int capacity, float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(name, autoReleaseInterval, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float autoReleaseInterval, int capacity, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateSingleSpawnObjectPool(objectType, name, autoReleaseInterval, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool() where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(name); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, name); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(int capacity) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(capacity); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, capacity); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(float expireTime) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(expireTime); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, float expireTime) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, expireTime); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, int capacity) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(name, capacity); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, name, capacity); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, float expireTime) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(name, expireTime); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float expireTime) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, name, expireTime); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(int capacity, float expireTime) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(capacity, expireTime); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, float expireTime) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, capacity, expireTime); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(int capacity, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(capacity, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, int priority) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, capacity, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, float expireTime) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(name, capacity, expireTime); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, float expireTime) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, name, capacity, expireTime); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(name, capacity, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, int priority) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, name, capacity, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(name, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, name, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(int capacity, float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(name, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, name, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, float autoReleaseInterval, int capacity, float expireTime, int priority) where T : ObjectBase + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(name, autoReleaseInterval, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float autoReleaseInterval, int capacity, float expireTime, int priority) + { + return m_ObjectPoolManager.CreateMultiSpawnObjectPool(objectType, name, autoReleaseInterval, capacity, expireTime, priority); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool() where T : ObjectBase + { + return m_ObjectPoolManager.DestroyObjectPool(); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(Type objectType) + { + return m_ObjectPoolManager.DestroyObjectPool(objectType); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池名称。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(string name) where T : ObjectBase + { + return m_ObjectPoolManager.DestroyObjectPool(name); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池名称。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(Type objectType, string name) + { + return m_ObjectPoolManager.DestroyObjectPool(objectType, name); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(IObjectPool objectPool) where T : ObjectBase + { + return m_ObjectPoolManager.DestroyObjectPool(objectPool); + } + + /// + /// 销毁对象池。 + /// + /// 要销毁的对象池。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(ObjectPoolBase objectPool) + { + return m_ObjectPoolManager.DestroyObjectPool(objectPool); + } + + /// + /// 释放对象池中的可释放对象。 + /// + public void Release() + { + Log.Info("Object pool release..."); + m_ObjectPoolManager.Release(); + } + + /// + /// 释放对象池中的所有未使用对象。 + /// + public void ReleaseAllUnused() + { + Log.Info("Object pool release all unused..."); + m_ObjectPoolManager.ReleaseAllUnused(); + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolComponent.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolComponent.cs.meta new file mode 100644 index 00000000..69fba120 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: da10a6ed68a3439b8a2df5384febd504 +timeCreated: 1680501224 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.Object.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.Object.cs new file mode 100644 index 00000000..8cc7a00d --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.Object.cs @@ -0,0 +1,189 @@ +using System; + +namespace TEngine +{ + internal sealed partial class ObjectPoolManager : GameFrameworkModule, IObjectPoolManager + { + /// + /// 内部对象。 + /// + /// 对象类型。 + private sealed class Object : IMemory where T : ObjectBase + { + private T m_Object; + private int m_SpawnCount; + + /// + /// 初始化内部对象的新实例。 + /// + public Object() + { + m_Object = null; + m_SpawnCount = 0; + } + + /// + /// 获取对象名称。 + /// + public string Name + { + get + { + return m_Object.Name; + } + } + + /// + /// 获取对象是否被加锁。 + /// + public bool Locked + { + get + { + return m_Object.Locked; + } + internal set + { + m_Object.Locked = value; + } + } + + /// + /// 获取对象的优先级。 + /// + public int Priority + { + get + { + return m_Object.Priority; + } + internal set + { + m_Object.Priority = value; + } + } + + /// + /// 获取自定义释放检查标记。 + /// + public bool CustomCanReleaseFlag + { + get + { + return m_Object.CustomCanReleaseFlag; + } + } + + /// + /// 获取对象上次使用时间。 + /// + public DateTime LastUseTime + { + get + { + return m_Object.LastUseTime; + } + } + + /// + /// 获取对象是否正在使用。 + /// + public bool IsInUse + { + get + { + return m_SpawnCount > 0; + } + } + + /// + /// 获取对象的获取计数。 + /// + public int SpawnCount + { + get + { + return m_SpawnCount; + } + } + + /// + /// 创建内部对象。 + /// + /// 对象。 + /// 对象是否已被获取。 + /// 创建的内部对象。 + public static Object Create(T obj, bool spawned) + { + if (obj == null) + { + throw new GameFrameworkException("Object is invalid."); + } + + Object internalObject = MemoryPool.Acquire>(); + internalObject.m_Object = obj; + internalObject.m_SpawnCount = spawned ? 1 : 0; + if (spawned) + { + obj.OnSpawn(); + } + + return internalObject; + } + + /// + /// 清理内部对象。 + /// + public void Clear() + { + m_Object = null; + m_SpawnCount = 0; + } + + /// + /// 查看对象。 + /// + /// 对象。 + public T Peek() + { + return m_Object; + } + + /// + /// 获取对象。 + /// + /// 对象。 + public T Spawn() + { + m_SpawnCount++; + m_Object.LastUseTime = DateTime.UtcNow; + m_Object.OnSpawn(); + return m_Object; + } + + /// + /// 回收对象。 + /// + public void Unspawn() + { + m_Object.OnUnspawn(); + m_Object.LastUseTime = DateTime.UtcNow; + m_SpawnCount--; + if (m_SpawnCount < 0) + { + throw new GameFrameworkException(Utility.Text.Format("Object '{0}' spawn count is less than 0.", Name)); + } + } + + /// + /// 释放对象。 + /// + /// 是否是关闭对象池时触发。 + public void Release(bool isShutdown) + { + m_Object.Release(isShutdown); + MemoryPool.Release(m_Object); + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.Object.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.Object.cs.meta new file mode 100644 index 00000000..2d73bd11 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.Object.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 979efb6cb1ae4b36a4296a8229aea3ff +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs new file mode 100644 index 00000000..6ba8a651 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs @@ -0,0 +1,630 @@ +using System; +using System.Collections.Generic; + +namespace TEngine +{ + internal sealed partial class ObjectPoolManager : GameFrameworkModule, IObjectPoolManager + { + /// + /// 对象池。 + /// + /// 对象类型。 + private sealed class ObjectPool : ObjectPoolBase, IObjectPool where T : ObjectBase + { + private readonly GameFrameworkMultiDictionary> m_Objects; + private readonly Dictionary> m_ObjectMap; + private readonly ReleaseObjectFilterCallback m_DefaultReleaseObjectFilterCallback; + private readonly List m_CachedCanReleaseObjects; + private readonly List m_CachedToReleaseObjects; + private readonly bool m_AllowMultiSpawn; + private float m_AutoReleaseInterval; + private int m_Capacity; + private float m_ExpireTime; + private int m_Priority; + private float m_AutoReleaseTime; + + /// + /// 初始化对象池的新实例。 + /// + /// 对象池名称。 + /// 是否允许对象被多次获取。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + public ObjectPool(string name, bool allowMultiSpawn, float autoReleaseInterval, int capacity, float expireTime, int priority) + : base(name) + { + m_Objects = new GameFrameworkMultiDictionary>(); + m_ObjectMap = new Dictionary>(); + m_DefaultReleaseObjectFilterCallback = DefaultReleaseObjectFilterCallback; + m_CachedCanReleaseObjects = new List(); + m_CachedToReleaseObjects = new List(); + m_AllowMultiSpawn = allowMultiSpawn; + m_AutoReleaseInterval = autoReleaseInterval; + Capacity = capacity; + ExpireTime = expireTime; + m_Priority = priority; + m_AutoReleaseTime = 0f; + } + + /// + /// 获取对象池对象类型。 + /// + public override Type ObjectType + { + get + { + return typeof(T); + } + } + + /// + /// 获取对象池中对象的数量。 + /// + public override int Count + { + get + { + return m_ObjectMap.Count; + } + } + + /// + /// 获取对象池中能被释放的对象的数量。 + /// + public override int CanReleaseCount + { + get + { + GetCanReleaseObjects(m_CachedCanReleaseObjects); + return m_CachedCanReleaseObjects.Count; + } + } + + /// + /// 获取是否允许对象被多次获取。 + /// + public override bool AllowMultiSpawn + { + get + { + return m_AllowMultiSpawn; + } + } + + /// + /// 获取或设置对象池自动释放可释放对象的间隔秒数。 + /// + public override float AutoReleaseInterval + { + get + { + return m_AutoReleaseInterval; + } + set + { + m_AutoReleaseInterval = value; + } + } + + /// + /// 获取或设置对象池的容量。 + /// + public override int Capacity + { + get + { + return m_Capacity; + } + set + { + if (value < 0) + { + throw new GameFrameworkException("Capacity is invalid."); + } + + if (m_Capacity == value) + { + return; + } + + m_Capacity = value; + Release(); + } + } + + /// + /// 获取或设置对象池对象过期秒数。 + /// + public override float ExpireTime + { + get + { + return m_ExpireTime; + } + + set + { + if (value < 0f) + { + throw new GameFrameworkException("ExpireTime is invalid."); + } + + if (ExpireTime == value) + { + return; + } + + m_ExpireTime = value; + Release(); + } + } + + /// + /// 获取或设置对象池的优先级。 + /// + public override int Priority + { + get + { + return m_Priority; + } + set + { + m_Priority = value; + } + } + + /// + /// 创建对象。 + /// + /// 对象。 + /// 对象是否已被获取。 + public void Register(T obj, bool spawned) + { + if (obj == null) + { + throw new GameFrameworkException("Object is invalid."); + } + + Object internalObject = Object.Create(obj, spawned); + m_Objects.Add(obj.Name, internalObject); + m_ObjectMap.Add(obj.Target, internalObject); + + if (Count > m_Capacity) + { + Release(); + } + } + + /// + /// 检查对象。 + /// + /// 要检查的对象是否存在。 + public bool CanSpawn() + { + return CanSpawn(string.Empty); + } + + /// + /// 检查对象。 + /// + /// 对象名称。 + /// 要检查的对象是否存在。 + public bool CanSpawn(string name) + { + if (name == null) + { + throw new GameFrameworkException("Name is invalid."); + } + + GameFrameworkLinkedListRange> objectRange = default(GameFrameworkLinkedListRange>); + if (m_Objects.TryGetValue(name, out objectRange)) + { + foreach (Object internalObject in objectRange) + { + if (m_AllowMultiSpawn || !internalObject.IsInUse) + { + return true; + } + } + } + + return false; + } + + /// + /// 获取对象。 + /// + /// 要获取的对象。 + public T Spawn() + { + return Spawn(string.Empty); + } + + /// + /// 获取对象。 + /// + /// 对象名称。 + /// 要获取的对象。 + public T Spawn(string name) + { + if (name == null) + { + throw new GameFrameworkException("Name is invalid."); + } + + GameFrameworkLinkedListRange> objectRange = default(GameFrameworkLinkedListRange>); + if (m_Objects.TryGetValue(name, out objectRange)) + { + foreach (Object internalObject in objectRange) + { + if (m_AllowMultiSpawn || !internalObject.IsInUse) + { + return internalObject.Spawn(); + } + } + } + + return null; + } + + /// + /// 回收对象。 + /// + /// 要回收的对象。 + public void Unspawn(T obj) + { + if (obj == null) + { + throw new GameFrameworkException("Object is invalid."); + } + + Unspawn(obj.Target); + } + + /// + /// 回收对象。 + /// + /// 要回收的对象。 + public void Unspawn(object target) + { + if (target == null) + { + throw new GameFrameworkException("Target is invalid."); + } + + Object internalObject = GetObject(target); + if (internalObject != null) + { + internalObject.Unspawn(); + if (Count > m_Capacity && internalObject.SpawnCount <= 0) + { + Release(); + } + } + else + { + throw new GameFrameworkException(Utility.Text.Format("Can not find target in object pool '{0}', target type is '{1}', target value is '{2}'.", new TypeNamePair(typeof(T), Name), target.GetType().FullName, target)); + } + } + + /// + /// 设置对象是否被加锁。 + /// + /// 要设置被加锁的对象。 + /// 是否被加锁。 + public void SetLocked(T obj, bool locked) + { + if (obj == null) + { + throw new GameFrameworkException("Object is invalid."); + } + + SetLocked(obj.Target, locked); + } + + /// + /// 设置对象是否被加锁。 + /// + /// 要设置被加锁的对象。 + /// 是否被加锁。 + public void SetLocked(object target, bool locked) + { + if (target == null) + { + throw new GameFrameworkException("Target is invalid."); + } + + Object internalObject = GetObject(target); + if (internalObject != null) + { + internalObject.Locked = locked; + } + else + { + throw new GameFrameworkException(Utility.Text.Format("Can not find target in object pool '{0}', target type is '{1}', target value is '{2}'.", new TypeNamePair(typeof(T), Name), target.GetType().FullName, target)); + } + } + + /// + /// 设置对象的优先级。 + /// + /// 要设置优先级的对象。 + /// 优先级。 + public void SetPriority(T obj, int priority) + { + if (obj == null) + { + throw new GameFrameworkException("Object is invalid."); + } + + SetPriority(obj.Target, priority); + } + + /// + /// 设置对象的优先级。 + /// + /// 要设置优先级的对象。 + /// 优先级。 + public void SetPriority(object target, int priority) + { + if (target == null) + { + throw new GameFrameworkException("Target is invalid."); + } + + Object internalObject = GetObject(target); + if (internalObject != null) + { + internalObject.Priority = priority; + } + else + { + throw new GameFrameworkException(Utility.Text.Format("Can not find target in object pool '{0}', target type is '{1}', target value is '{2}'.", new TypeNamePair(typeof(T), Name), target.GetType().FullName, target)); + } + } + + /// + /// 释放对象。 + /// + /// 要释放的对象。 + /// 释放对象是否成功。 + public bool ReleaseObject(T obj) + { + if (obj == null) + { + throw new GameFrameworkException("Object is invalid."); + } + + return ReleaseObject(obj.Target); + } + + /// + /// 释放对象。 + /// + /// 要释放的对象。 + /// 释放对象是否成功。 + public bool ReleaseObject(object target) + { + if (target == null) + { + throw new GameFrameworkException("Target is invalid."); + } + + Object internalObject = GetObject(target); + if (internalObject == null) + { + return false; + } + + if (internalObject.IsInUse || internalObject.Locked || !internalObject.CustomCanReleaseFlag) + { + return false; + } + + m_Objects.Remove(internalObject.Name, internalObject); + m_ObjectMap.Remove(internalObject.Peek().Target); + + internalObject.Release(false); + MemoryPool.Release(internalObject); + return true; + } + + /// + /// 释放对象池中的可释放对象。 + /// + public override void Release() + { + Release(Count - m_Capacity, m_DefaultReleaseObjectFilterCallback); + } + + /// + /// 释放对象池中的可释放对象。 + /// + /// 尝试释放对象数量。 + public override void Release(int toReleaseCount) + { + Release(toReleaseCount, m_DefaultReleaseObjectFilterCallback); + } + + /// + /// 释放对象池中的可释放对象。 + /// + /// 释放对象筛选函数。 + public void Release(ReleaseObjectFilterCallback releaseObjectFilterCallback) + { + Release(Count - m_Capacity, releaseObjectFilterCallback); + } + + /// + /// 释放对象池中的可释放对象。 + /// + /// 尝试释放对象数量。 + /// 释放对象筛选函数。 + public void Release(int toReleaseCount, ReleaseObjectFilterCallback releaseObjectFilterCallback) + { + if (releaseObjectFilterCallback == null) + { + throw new GameFrameworkException("Release object filter callback is invalid."); + } + + if (toReleaseCount < 0) + { + toReleaseCount = 0; + } + + DateTime expireTime = DateTime.MinValue; + if (m_ExpireTime < float.MaxValue) + { + expireTime = DateTime.UtcNow.AddSeconds(-m_ExpireTime); + } + + m_AutoReleaseTime = 0f; + GetCanReleaseObjects(m_CachedCanReleaseObjects); + List toReleaseObjects = releaseObjectFilterCallback(m_CachedCanReleaseObjects, toReleaseCount, expireTime); + if (toReleaseObjects == null || toReleaseObjects.Count <= 0) + { + return; + } + + foreach (T toReleaseObject in toReleaseObjects) + { + ReleaseObject(toReleaseObject); + } + } + + /// + /// 释放对象池中的所有未使用对象。 + /// + public override void ReleaseAllUnused() + { + m_AutoReleaseTime = 0f; + GetCanReleaseObjects(m_CachedCanReleaseObjects); + foreach (T toReleaseObject in m_CachedCanReleaseObjects) + { + ReleaseObject(toReleaseObject); + } + } + + /// + /// 获取所有对象信息。 + /// + /// 所有对象信息。 + public override ObjectInfo[] GetAllObjectInfos() + { + List results = new List(); + foreach (KeyValuePair>> objectRanges in m_Objects) + { + foreach (Object internalObject in objectRanges.Value) + { + results.Add(new ObjectInfo(internalObject.Name, internalObject.Locked, internalObject.CustomCanReleaseFlag, internalObject.Priority, internalObject.LastUseTime, internalObject.SpawnCount)); + } + } + + return results.ToArray(); + } + + internal override void Update(float elapseSeconds, float realElapseSeconds) + { + m_AutoReleaseTime += realElapseSeconds; + if (m_AutoReleaseTime < m_AutoReleaseInterval) + { + return; + } + + Release(); + } + + internal override void Shutdown() + { + foreach (KeyValuePair> objectInMap in m_ObjectMap) + { + objectInMap.Value.Release(true); + MemoryPool.Release(objectInMap.Value); + } + + m_Objects.Clear(); + m_ObjectMap.Clear(); + m_CachedCanReleaseObjects.Clear(); + m_CachedToReleaseObjects.Clear(); + } + + private Object GetObject(object target) + { + if (target == null) + { + throw new GameFrameworkException("Target is invalid."); + } + + Object internalObject = null; + if (m_ObjectMap.TryGetValue(target, out internalObject)) + { + return internalObject; + } + + return null; + } + + private void GetCanReleaseObjects(List results) + { + if (results == null) + { + throw new GameFrameworkException("Results is invalid."); + } + + results.Clear(); + foreach (KeyValuePair> objectInMap in m_ObjectMap) + { + Object internalObject = objectInMap.Value; + if (internalObject.IsInUse || internalObject.Locked || !internalObject.CustomCanReleaseFlag) + { + continue; + } + + results.Add(internalObject.Peek()); + } + } + + private List DefaultReleaseObjectFilterCallback(List candidateObjects, int toReleaseCount, DateTime expireTime) + { + m_CachedToReleaseObjects.Clear(); + + if (expireTime > DateTime.MinValue) + { + for (int i = candidateObjects.Count - 1; i >= 0; i--) + { + if (candidateObjects[i].LastUseTime <= expireTime) + { + m_CachedToReleaseObjects.Add(candidateObjects[i]); + candidateObjects.RemoveAt(i); + continue; + } + } + + toReleaseCount -= m_CachedToReleaseObjects.Count; + } + + for (int i = 0; toReleaseCount > 0 && i < candidateObjects.Count; i++) + { + for (int j = i + 1; j < candidateObjects.Count; j++) + { + if (candidateObjects[i].Priority > candidateObjects[j].Priority + || candidateObjects[i].Priority == candidateObjects[j].Priority && candidateObjects[i].LastUseTime > candidateObjects[j].LastUseTime) + { + T temp = candidateObjects[i]; + candidateObjects[i] = candidateObjects[j]; + candidateObjects[j] = temp; + } + } + + m_CachedToReleaseObjects.Add(candidateObjects[i]); + toReleaseCount--; + } + + return m_CachedToReleaseObjects; + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs.meta new file mode 100644 index 00000000..8c788216 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 68ff3108f40a407b819e52b8fc2e65e0 +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.cs new file mode 100644 index 00000000..da322f04 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.cs @@ -0,0 +1,1296 @@ +using System; +using System.Collections.Generic; + +namespace TEngine +{ + /// + /// 对象池管理器。 + /// + internal sealed partial class ObjectPoolManager : GameFrameworkModule, IObjectPoolManager + { + private const int DefaultCapacity = int.MaxValue; + private const float DefaultExpireTime = float.MaxValue; + private const int DefaultPriority = 0; + + private readonly Dictionary m_ObjectPools; + private readonly List m_CachedAllObjectPools; + private readonly Comparison m_ObjectPoolComparer; + + /// + /// 初始化对象池管理器的新实例。 + /// + public ObjectPoolManager() + { + m_ObjectPools = new Dictionary(); + m_CachedAllObjectPools = new List(); + m_ObjectPoolComparer = ObjectPoolComparer; + } + + /// + /// 获取游戏框架模块优先级。 + /// + /// 优先级较高的模块会优先轮询,并且关闭操作会后进行。 + internal override int Priority + { + get + { + return 6; + } + } + + /// + /// 获取对象池数量。 + /// + public int Count + { + get + { + return m_ObjectPools.Count; + } + } + + /// + /// 对象池管理器轮询。 + /// + /// 逻辑流逝时间,以秒为单位。 + /// 真实流逝时间,以秒为单位。 + internal override void Update(float elapseSeconds, float realElapseSeconds) + { + foreach (KeyValuePair objectPool in m_ObjectPools) + { + objectPool.Value.Update(elapseSeconds, realElapseSeconds); + } + } + + /// + /// 关闭并清理对象池管理器。 + /// + internal override void Shutdown() + { + foreach (KeyValuePair objectPool in m_ObjectPools) + { + objectPool.Value.Shutdown(); + } + + m_ObjectPools.Clear(); + m_CachedAllObjectPools.Clear(); + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 是否存在对象池。 + public bool HasObjectPool() where T : ObjectBase + { + return InternalHasObjectPool(new TypeNamePair(typeof(T))); + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 是否存在对象池。 + public bool HasObjectPool(Type objectType) + { + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (!typeof(ObjectBase).IsAssignableFrom(objectType)) + { + throw new GameFrameworkException(Utility.Text.Format("Object type '{0}' is invalid.", objectType.FullName)); + } + + return InternalHasObjectPool(new TypeNamePair(objectType)); + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 是否存在对象池。 + public bool HasObjectPool(string name) where T : ObjectBase + { + return InternalHasObjectPool(new TypeNamePair(typeof(T), name)); + } + + /// + /// 检查是否存在对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 是否存在对象池。 + public bool HasObjectPool(Type objectType, string name) + { + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (!typeof(ObjectBase).IsAssignableFrom(objectType)) + { + throw new GameFrameworkException(Utility.Text.Format("Object type '{0}' is invalid.", objectType.FullName)); + } + + return InternalHasObjectPool(new TypeNamePair(objectType, name)); + } + + /// + /// 检查是否存在对象池。 + /// + /// 要检查的条件。 + /// 是否存在对象池。 + public bool HasObjectPool(Predicate condition) + { + if (condition == null) + { + throw new GameFrameworkException("Condition is invalid."); + } + + foreach (KeyValuePair objectPool in m_ObjectPools) + { + if (condition(objectPool.Value)) + { + return true; + } + } + + return false; + } + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 要获取的对象池。 + public IObjectPool GetObjectPool() where T : ObjectBase + { + return (IObjectPool)InternalGetObjectPool(new TypeNamePair(typeof(T))); + } + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 要获取的对象池。 + public ObjectPoolBase GetObjectPool(Type objectType) + { + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (!typeof(ObjectBase).IsAssignableFrom(objectType)) + { + throw new GameFrameworkException(Utility.Text.Format("Object type '{0}' is invalid.", objectType.FullName)); + } + + return InternalGetObjectPool(new TypeNamePair(objectType)); + } + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要获取的对象池。 + public IObjectPool GetObjectPool(string name) where T : ObjectBase + { + return (IObjectPool)InternalGetObjectPool(new TypeNamePair(typeof(T), name)); + } + + /// + /// 获取对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要获取的对象池。 + public ObjectPoolBase GetObjectPool(Type objectType, string name) + { + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (!typeof(ObjectBase).IsAssignableFrom(objectType)) + { + throw new GameFrameworkException(Utility.Text.Format("Object type '{0}' is invalid.", objectType.FullName)); + } + + return InternalGetObjectPool(new TypeNamePair(objectType, name)); + } + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + public ObjectPoolBase GetObjectPool(Predicate condition) + { + if (condition == null) + { + throw new GameFrameworkException("Condition is invalid."); + } + + foreach (KeyValuePair objectPool in m_ObjectPools) + { + if (condition(objectPool.Value)) + { + return objectPool.Value; + } + } + + return null; + } + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + public ObjectPoolBase[] GetObjectPools(Predicate condition) + { + if (condition == null) + { + throw new GameFrameworkException("Condition is invalid."); + } + + List results = new List(); + foreach (KeyValuePair objectPool in m_ObjectPools) + { + if (condition(objectPool.Value)) + { + results.Add(objectPool.Value); + } + } + + return results.ToArray(); + } + + /// + /// 获取对象池。 + /// + /// 要检查的条件。 + /// 要获取的对象池。 + public void GetObjectPools(Predicate condition, List results) + { + if (condition == null) + { + throw new GameFrameworkException("Condition is invalid."); + } + + if (results == null) + { + throw new GameFrameworkException("Results is invalid."); + } + + results.Clear(); + foreach (KeyValuePair objectPool in m_ObjectPools) + { + if (condition(objectPool.Value)) + { + results.Add(objectPool.Value); + } + } + } + + /// + /// 获取所有对象池。 + /// + /// 所有对象池。 + public ObjectPoolBase[] GetAllObjectPools() + { + return GetAllObjectPools(false); + } + + /// + /// 获取所有对象池。 + /// + /// 所有对象池。 + public void GetAllObjectPools(List results) + { + GetAllObjectPools(false, results); + } + + /// + /// 获取所有对象池。 + /// + /// 是否根据对象池的优先级排序。 + /// 所有对象池。 + public ObjectPoolBase[] GetAllObjectPools(bool sort) + { + if (sort) + { + List results = new List(); + foreach (KeyValuePair objectPool in m_ObjectPools) + { + results.Add(objectPool.Value); + } + + results.Sort(m_ObjectPoolComparer); + return results.ToArray(); + } + else + { + int index = 0; + ObjectPoolBase[] results = new ObjectPoolBase[m_ObjectPools.Count]; + foreach (KeyValuePair objectPool in m_ObjectPools) + { + results[index++] = objectPool.Value; + } + + return results; + } + } + + /// + /// 获取所有对象池。 + /// + /// 是否根据对象池的优先级排序。 + /// 所有对象池。 + public void GetAllObjectPools(bool sort, List results) + { + if (results == null) + { + throw new GameFrameworkException("Results is invalid."); + } + + results.Clear(); + foreach (KeyValuePair objectPool in m_ObjectPools) + { + results.Add(objectPool.Value); + } + + if (sort) + { + results.Sort(m_ObjectPoolComparer); + } + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool() where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, false, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType) + { + return InternalCreateObjectPool(objectType, string.Empty, false, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name) where T : ObjectBase + { + return InternalCreateObjectPool(name, false, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name) + { + return InternalCreateObjectPool(objectType, name, false, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(int capacity) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, false, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity) + { + return InternalCreateObjectPool(objectType, string.Empty, false, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(float expireTime) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, false, expireTime, DefaultCapacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, float expireTime) + { + return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, DefaultCapacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, int capacity) where T : ObjectBase + { + return InternalCreateObjectPool(name, false, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity) + { + return InternalCreateObjectPool(objectType, name, false, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, float expireTime) where T : ObjectBase + { + return InternalCreateObjectPool(name, false, expireTime, DefaultCapacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float expireTime) + { + return InternalCreateObjectPool(objectType, name, false, expireTime, DefaultCapacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(int capacity, float expireTime) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, false, expireTime, capacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, float expireTime) + { + return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, capacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(int capacity, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, false, DefaultExpireTime, capacity, DefaultExpireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, int priority) + { + return InternalCreateObjectPool(objectType, string.Empty, false, DefaultExpireTime, capacity, DefaultExpireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, false, expireTime, DefaultCapacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, DefaultCapacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, float expireTime) where T : ObjectBase + { + return InternalCreateObjectPool(name, false, expireTime, capacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, float expireTime) + { + return InternalCreateObjectPool(objectType, name, false, expireTime, capacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(name, false, DefaultExpireTime, capacity, DefaultExpireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, int priority) + { + return InternalCreateObjectPool(objectType, name, false, DefaultExpireTime, capacity, DefaultExpireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(name, false, expireTime, DefaultCapacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, name, false, expireTime, DefaultCapacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(int capacity, float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, false, expireTime, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, int capacity, float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(name, false, expireTime, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, name, false, expireTime, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public IObjectPool CreateSingleSpawnObjectPool(string name, float autoReleaseInterval, int capacity, float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(name, false, autoReleaseInterval, capacity, expireTime, priority); + } + + /// + /// 创建允许单次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许单次获取的对象池。 + public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float autoReleaseInterval, int capacity, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, name, false, autoReleaseInterval, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool() where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, true, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType) + { + return InternalCreateObjectPool(objectType, string.Empty, true, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name) where T : ObjectBase + { + return InternalCreateObjectPool(name, true, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name) + { + return InternalCreateObjectPool(objectType, name, true, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(int capacity) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, true, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity) + { + return InternalCreateObjectPool(objectType, string.Empty, true, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(float expireTime) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, true, expireTime, DefaultCapacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, float expireTime) + { + return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, DefaultCapacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, int capacity) where T : ObjectBase + { + return InternalCreateObjectPool(name, true, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity) + { + return InternalCreateObjectPool(objectType, name, true, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, float expireTime) where T : ObjectBase + { + return InternalCreateObjectPool(name, true, expireTime, DefaultCapacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float expireTime) + { + return InternalCreateObjectPool(objectType, name, true, expireTime, DefaultCapacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(int capacity, float expireTime) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, true, expireTime, capacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, float expireTime) + { + return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, capacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(int capacity, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, true, DefaultExpireTime, capacity, DefaultExpireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, int priority) + { + return InternalCreateObjectPool(objectType, string.Empty, true, DefaultExpireTime, capacity, DefaultExpireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, true, expireTime, DefaultCapacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, DefaultCapacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, float expireTime) where T : ObjectBase + { + return InternalCreateObjectPool(name, true, expireTime, capacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, float expireTime) + { + return InternalCreateObjectPool(objectType, name, true, expireTime, capacity, expireTime, DefaultPriority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(name, true, DefaultExpireTime, capacity, DefaultExpireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, int priority) + { + return InternalCreateObjectPool(objectType, name, true, DefaultExpireTime, capacity, DefaultExpireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(name, true, expireTime, DefaultCapacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, name, true, expireTime, DefaultCapacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(int capacity, float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(string.Empty, true, expireTime, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, int capacity, float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(name, true, expireTime, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, name, true, expireTime, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public IObjectPool CreateMultiSpawnObjectPool(string name, float autoReleaseInterval, int capacity, float expireTime, int priority) where T : ObjectBase + { + return InternalCreateObjectPool(name, true, autoReleaseInterval, capacity, expireTime, priority); + } + + /// + /// 创建允许多次获取的对象池。 + /// + /// 对象类型。 + /// 对象池名称。 + /// 对象池自动释放可释放对象的间隔秒数。 + /// 对象池的容量。 + /// 对象池对象过期秒数。 + /// 对象池的优先级。 + /// 要创建的允许多次获取的对象池。 + public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float autoReleaseInterval, int capacity, float expireTime, int priority) + { + return InternalCreateObjectPool(objectType, name, true, autoReleaseInterval, capacity, expireTime, priority); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool() where T : ObjectBase + { + return InternalDestroyObjectPool(new TypeNamePair(typeof(T))); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(Type objectType) + { + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (!typeof(ObjectBase).IsAssignableFrom(objectType)) + { + throw new GameFrameworkException(Utility.Text.Format("Object type '{0}' is invalid.", objectType.FullName)); + } + + return InternalDestroyObjectPool(new TypeNamePair(objectType)); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池名称。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(string name) where T : ObjectBase + { + return InternalDestroyObjectPool(new TypeNamePair(typeof(T), name)); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池名称。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(Type objectType, string name) + { + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (!typeof(ObjectBase).IsAssignableFrom(objectType)) + { + throw new GameFrameworkException(Utility.Text.Format("Object type '{0}' is invalid.", objectType.FullName)); + } + + return InternalDestroyObjectPool(new TypeNamePair(objectType, name)); + } + + /// + /// 销毁对象池。 + /// + /// 对象类型。 + /// 要销毁的对象池。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(IObjectPool objectPool) where T : ObjectBase + { + if (objectPool == null) + { + throw new GameFrameworkException("Object pool is invalid."); + } + + return InternalDestroyObjectPool(new TypeNamePair(typeof(T), objectPool.Name)); + } + + /// + /// 销毁对象池。 + /// + /// 要销毁的对象池。 + /// 是否销毁对象池成功。 + public bool DestroyObjectPool(ObjectPoolBase objectPool) + { + if (objectPool == null) + { + throw new GameFrameworkException("Object pool is invalid."); + } + + return InternalDestroyObjectPool(new TypeNamePair(objectPool.ObjectType, objectPool.Name)); + } + + /// + /// 释放对象池中的可释放对象。 + /// + public void Release() + { + GetAllObjectPools(true, m_CachedAllObjectPools); + foreach (ObjectPoolBase objectPool in m_CachedAllObjectPools) + { + objectPool.Release(); + } + } + + /// + /// 释放对象池中的所有未使用对象。 + /// + public void ReleaseAllUnused() + { + GetAllObjectPools(true, m_CachedAllObjectPools); + foreach (ObjectPoolBase objectPool in m_CachedAllObjectPools) + { + objectPool.ReleaseAllUnused(); + } + } + + private bool InternalHasObjectPool(TypeNamePair typeNamePair) + { + return m_ObjectPools.ContainsKey(typeNamePair); + } + + private ObjectPoolBase InternalGetObjectPool(TypeNamePair typeNamePair) + { + ObjectPoolBase objectPool = null; + if (m_ObjectPools.TryGetValue(typeNamePair, out objectPool)) + { + return objectPool; + } + + return null; + } + + private IObjectPool InternalCreateObjectPool(string name, bool allowMultiSpawn, float autoReleaseInterval, int capacity, float expireTime, int priority) where T : ObjectBase + { + TypeNamePair typeNamePair = new TypeNamePair(typeof(T), name); + if (HasObjectPool(name)) + { + throw new GameFrameworkException(Utility.Text.Format("Already exist object pool '{0}'.", typeNamePair)); + } + + ObjectPool objectPool = new ObjectPool(name, allowMultiSpawn, autoReleaseInterval, capacity, expireTime, priority); + m_ObjectPools.Add(typeNamePair, objectPool); + return objectPool; + } + + private ObjectPoolBase InternalCreateObjectPool(Type objectType, string name, bool allowMultiSpawn, float autoReleaseInterval, int capacity, float expireTime, int priority) + { + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (!typeof(ObjectBase).IsAssignableFrom(objectType)) + { + throw new GameFrameworkException(Utility.Text.Format("Object type '{0}' is invalid.", objectType.FullName)); + } + + TypeNamePair typeNamePair = new TypeNamePair(objectType, name); + if (HasObjectPool(objectType, name)) + { + throw new GameFrameworkException(Utility.Text.Format("Already exist object pool '{0}'.", typeNamePair)); + } + + Type objectPoolType = typeof(ObjectPool<>).MakeGenericType(objectType); + ObjectPoolBase objectPool = (ObjectPoolBase)Activator.CreateInstance(objectPoolType, name, allowMultiSpawn, autoReleaseInterval, capacity, expireTime, priority); + m_ObjectPools.Add(typeNamePair, objectPool); + return objectPool; + } + + private bool InternalDestroyObjectPool(TypeNamePair typeNamePair) + { + ObjectPoolBase objectPool = null; + if (m_ObjectPools.TryGetValue(typeNamePair, out objectPool)) + { + objectPool.Shutdown(); + return m_ObjectPools.Remove(typeNamePair); + } + + return false; + } + + private static int ObjectPoolComparer(ObjectPoolBase a, ObjectPoolBase b) + { + return a.Priority.CompareTo(b.Priority); + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.cs.meta new file mode 100644 index 00000000..799be2b1 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ObjectPoolManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 446300b409bc49d0a006e35e20957799 +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ReleaseObjectFilterCallback.cs b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ReleaseObjectFilterCallback.cs new file mode 100644 index 00000000..beffd27e --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ReleaseObjectFilterCallback.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace TEngine +{ + /// + /// 释放对象筛选函数。 + /// + /// 对象类型。 + /// 要筛选的对象集合。 + /// 需要释放的对象数量。 + /// 对象过期参考时间。 + /// 经筛选需要释放的对象集合。 + public delegate List ReleaseObjectFilterCallback(List candidateObjects, int toReleaseCount, DateTime expireTime) where T : ObjectBase; +} diff --git a/Assets/TEngine/Runtime/GameFramework/ObjectPool/ReleaseObjectFilterCallback.cs.meta b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ReleaseObjectFilterCallback.cs.meta new file mode 100644 index 00000000..6c04aded --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/ObjectPool/ReleaseObjectFilterCallback.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bad5108ff5ac489096a35b039c31eaf3 +timeCreated: 1680501171 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/Resource.meta b/Assets/TEngine/Runtime/GameFramework/Resource.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource.meta rename to Assets/TEngine/Runtime/GameFramework/Resource.meta diff --git a/Assets/TEngine/Runtime/Resource/Constant.cs b/Assets/TEngine/Runtime/GameFramework/Resource/Constant.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/Constant.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/Constant.cs diff --git a/Assets/TEngine/Runtime/Resource/Constant.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/Constant.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/Constant.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/Constant.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/HasAssetResult.cs b/Assets/TEngine/Runtime/GameFramework/Resource/HasAssetResult.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/HasAssetResult.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/HasAssetResult.cs diff --git a/Assets/TEngine/Runtime/Resource/HasAssetResult.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/HasAssetResult.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/HasAssetResult.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/HasAssetResult.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/IResourceManager.cs b/Assets/TEngine/Runtime/GameFramework/Resource/IResourceManager.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/IResourceManager.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/IResourceManager.cs diff --git a/Assets/TEngine/Runtime/Resource/IResourceManager.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/IResourceManager.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/IResourceManager.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/IResourceManager.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/Operation.meta b/Assets/TEngine/Runtime/GameFramework/Resource/Operation.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/Operation.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/Operation.meta diff --git a/Assets/TEngine/Runtime/Resource/Operation/LoadAssetsByTagOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/Operation/LoadAssetsByTagOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/Operation/LoadAssetsByTagOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/Operation/LoadAssetsByTagOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/Operation/LoadAssetsByTagOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/Operation/LoadAssetsByTagOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/Operation/LoadAssetsByTagOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/Operation/LoadAssetsByTagOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/ReadWritePathType.cs b/Assets/TEngine/Runtime/GameFramework/Resource/ReadWritePathType.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/ReadWritePathType.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/ReadWritePathType.cs diff --git a/Assets/TEngine/Runtime/Resource/ReadWritePathType.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/ReadWritePathType.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/ReadWritePathType.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/ReadWritePathType.cs.meta diff --git a/Assets/TEngine/Runtime/GameFramework/Resource/ResourceComponent.cs b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceComponent.cs new file mode 100644 index 00000000..1e0c63bf --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceComponent.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace TEngine +{ + [DisallowMultipleComponent] + public class ResourceComponent: GameFrameworkComponent + { + private IResourceManager m_ResourceManager; + + /// + /// 获取当前资源适用的游戏版本号。 + /// + public string ApplicableGameVersion => m_ResourceManager.ApplicableGameVersion; + + /// + /// 获取当前内部资源版本号。 + /// + public int InternalResourceVersion => m_ResourceManager.InternalResourceVersion; + + /// + /// 强制执行释放未被使用的资源。 + /// + /// 是否使用垃圾回收。 + public void ForceUnloadUnusedAssets(bool performGCCollect) + { + + } + } +} \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Resource/ResourceComponent.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceComponent.cs.meta new file mode 100644 index 00000000..1f15b25b --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 77d67944806247f99024bf5307adc918 +timeCreated: 1680501384 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/Resource/ResourceManager.Services.cs b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.Services.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/ResourceManager.Services.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.Services.cs diff --git a/Assets/TEngine/Runtime/Resource/ResourceManager.Services.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.Services.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/ResourceManager.Services.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.Services.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/ResourceManager.StreamingAssetsHelper.cs b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.StreamingAssetsHelper.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/ResourceManager.StreamingAssetsHelper.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.StreamingAssetsHelper.cs diff --git a/Assets/TEngine/Runtime/Resource/ResourceManager.StreamingAssetsHelper.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.StreamingAssetsHelper.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/ResourceManager.StreamingAssetsHelper.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.StreamingAssetsHelper.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/ResourceManager.cs b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/ResourceManager.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.cs diff --git a/Assets/TEngine/Runtime/Resource/ResourceManager.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/ResourceManager.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetReference.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetReference.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetReference.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetReference.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetReference.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetReference.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetReference.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetReference.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/AssetSystem.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/AssetSystem.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/AssetSystem.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/AssetSystem.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/AssetSystem.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/AssetSystem.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/AssetSystem.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/AssetSystem.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/AssetOperationHandle.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/OperationHandleBase.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/RawFileOperationHandle.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/SceneOperationHandle.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Handles/SubAssetsOperationHandle.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/AssetBundleFileLoader.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/AssetBundleWebLoader.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/BundleLoaderBase.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/DependAssetBundleGrouper.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/EBundleLoadMethod.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/RawBundleFileLoader.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/RawBundleWebLoader.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Loader/VirtualBundleFileLoader.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations/InstantiateOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Operations/UnloadSceneOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledAssetProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledRawFileProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledSceneProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/BundledSubAssetsProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/CompletedProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseAssetProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseRawFileProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseSceneProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/DatabaseSubAssetsProvider.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/AssetSystem/Provider/ProviderBase.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/CacheFileInfo.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/CacheFileInfo.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/CacheFileInfo.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/CacheFileInfo.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/CacheFileInfo.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/CacheFileInfo.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/CacheFileInfo.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/CacheFileInfo.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/CacheSystem.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/CacheSystem.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/CacheSystem.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/CacheSystem.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/CacheSystem.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/CacheSystem.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/CacheSystem.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/CacheSystem.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/EVerifyLevel.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/EVerifyLevel.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/EVerifyLevel.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/EVerifyLevel.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/EVerifyLevel.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/EVerifyLevel.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/EVerifyLevel.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/EVerifyLevel.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/EVerifyResult.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/EVerifyResult.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/EVerifyResult.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/EVerifyResult.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/EVerifyResult.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/EVerifyResult.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/EVerifyResult.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/EVerifyResult.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/ClearUnusedCacheFilesOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/FindCacheFilesOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyCacheFilesOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/Operations/PackageCachingOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/PackageCache.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/PackageCache.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/PackageCache.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/PackageCache.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/PackageCache.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/PackageCache.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/PackageCache.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/PackageCache.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/VerifyElement.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/VerifyElement.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/VerifyElement.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/VerifyElement.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/VerifyElement.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/VerifyElement.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/CacheSystem/VerifyElement.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/CacheSystem/VerifyElement.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugBundleInfo.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugPackageData.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugProviderInfo.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugReport.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugReport.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugReport.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugReport.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugReport.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugReport.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/DebugReport.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/DebugReport.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteCommand.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerDefine.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DiagnosticSystem/RemoteDebuggerInRuntime.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/DownloadReport.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/DownloadReport.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/DownloadReport.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/DownloadReport.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/DownloadReport.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/DownloadReport.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/DownloadReport.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/DownloadReport.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/DownloadSystem.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/DownloadSystem.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/DownloadSystem.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/DownloadSystem.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/DownloadSystem.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/DownloadSystem.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/DownloadSystem.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/DownloadSystem.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/DownloadHandlerFileRange.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/DownloaderBase.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/FileDownloader.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/Downloader/TempDownloader.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/ThreadSyncContext.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/UnityWebDataRequester.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/DownloadSystem/UnityWebFileRequester.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/InitializeParameters.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/InitializeParameters.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/InitializeParameters.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/InitializeParameters.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/InitializeParameters.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/InitializeParameters.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/InitializeParameters.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/InitializeParameters.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/AsyncOperationBase.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/EOperationStatus.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/EOperationStatus.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/EOperationStatus.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/EOperationStatus.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/EOperationStatus.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/EOperationStatus.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/EOperationStatus.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/EOperationStatus.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/GameAsyncOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/OperationSystem.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/OperationSystem.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/OperationSystem.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/OperationSystem.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/OperationSystem.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/OperationSystem.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/OperationSystem/OperationSystem.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/OperationSystem/OperationSystem.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/AssetInfo.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/AssetInfo.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/AssetInfo.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/AssetInfo.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/AssetInfo.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/AssetInfo.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/AssetInfo.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/AssetInfo.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/BundleInfo.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/BundleInfo.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/BundleInfo.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/BundleInfo.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/BundleInfo.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/BundleInfo.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/BundleInfo.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/BundleInfo.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/ManifestTools.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/ManifestTools.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/ManifestTools.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/ManifestTools.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/ManifestTools.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/ManifestTools.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/ManifestTools.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/ManifestTools.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/InitializationOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/DownloadManifestOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadBuildinManifestOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadCacheManifestOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/LoadEditorManifestOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryBuildinPackageVersionOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageHashOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryCachePackageVersionOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/QueryRemotePackageVersionOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/Internal/UnpackBuildinManifestOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/PreDownloadContentOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/UpdatePackageManifestOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/UpdatePackageVersionOperation.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageAsset.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageAsset.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageAsset.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageAsset.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageAsset.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageAsset.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageAsset.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageAsset.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageBundle.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageBundle.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageBundle.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageBundle.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageBundle.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageBundle.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageBundle.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageBundle.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageManifest.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageManifest.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageManifest.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageManifest.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageManifest.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageManifest.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PackageManifest.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PackageManifest.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeHelper.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/EditorSimulateModeImpl.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/HostPlayModeImpl.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/PlayMode/OfflinePlayModeImpl.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Properties.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Properties.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Properties.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Properties.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Properties/AssemblyInfo.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Properties/AssemblyInfo.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Properties/AssemblyInfo.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Properties/AssemblyInfo.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Properties/AssemblyInfo.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Properties/AssemblyInfo.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Properties/AssemblyInfo.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Properties/AssemblyInfo.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/ResourcePackage.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/ResourcePackage.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/ResourcePackage.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/ResourcePackage.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/ResourcePackage.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/ResourcePackage.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/ResourcePackage.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/ResourcePackage.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/IDecryptionServices.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IDecryptionServices.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/IDecryptionServices.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IDecryptionServices.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/IDecryptionServices.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IDecryptionServices.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/IDecryptionServices.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IDecryptionServices.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/IEncryptionServices.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IEncryptionServices.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/IEncryptionServices.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IEncryptionServices.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/IEncryptionServices.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IEncryptionServices.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/IEncryptionServices.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IEncryptionServices.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/IQueryServices.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IQueryServices.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/IQueryServices.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IQueryServices.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/IQueryServices.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IQueryServices.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/IQueryServices.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/IQueryServices.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IBundleServices.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IBundleServices.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IBundleServices.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IBundleServices.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IBundleServices.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IBundleServices.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IBundleServices.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IBundleServices.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IPlayModeServices.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IPlayModeServices.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IPlayModeServices.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IPlayModeServices.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IPlayModeServices.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IPlayModeServices.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IPlayModeServices.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IPlayModeServices.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IRemoteServices.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IRemoteServices.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IRemoteServices.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IRemoteServices.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IRemoteServices.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IRemoteServices.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Services/Internal/IRemoteServices.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Services/Internal/IRemoteServices.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Settings.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Settings.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Settings/YooAssetSettings.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings/YooAssetSettings.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Settings/YooAssetSettings.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings/YooAssetSettings.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Settings/YooAssetSettings.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings/YooAssetSettings.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Settings/YooAssetSettings.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings/YooAssetSettings.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Settings/YooAssetSettingsData.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings/YooAssetSettingsData.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Settings/YooAssetSettingsData.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings/YooAssetSettingsData.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Settings/YooAssetSettingsData.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings/YooAssetSettingsData.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Settings/YooAssetSettingsData.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Settings/YooAssetSettingsData.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/BufferReader.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/BufferReader.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/BufferReader.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/BufferReader.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/BufferReader.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/BufferReader.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/BufferReader.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/BufferReader.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/BufferWriter.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/BufferWriter.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/BufferWriter.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/BufferWriter.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/BufferWriter.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/BufferWriter.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/BufferWriter.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/BufferWriter.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/CRC32Algorithm.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/CRC32Algorithm.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/CRC32Algorithm.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/CRC32Algorithm.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/CRC32Algorithm.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/CRC32Algorithm.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/CRC32Algorithm.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/CRC32Algorithm.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooHelper.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooHelper.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooHelper.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooHelper.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooHelper.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooHelper.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooHelper.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooHelper.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooLogger.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooLogger.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooLogger.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooLogger.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooLogger.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooLogger.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooLogger.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooLogger.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooUtility.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooUtility.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooUtility.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooUtility.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooUtility.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooUtility.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/Utility/YooUtility.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/Utility/YooUtility.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/YooAssets.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssets.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/YooAssets.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssets.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/YooAssets.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssets.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/YooAssets.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssets.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsDriver.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsDriver.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsDriver.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsDriver.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsDriver.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsDriver.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsDriver.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsDriver.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsExtension.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsExtension.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsExtension.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsExtension.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsExtension.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsExtension.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsExtension.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsExtension.cs.meta diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsLogger.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsLogger.cs similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsLogger.cs rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsLogger.cs diff --git a/Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsLogger.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsLogger.cs.meta similarity index 100% rename from Assets/TEngine/Runtime/Resource/YooAsset/YooAssetsLogger.cs.meta rename to Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/YooAssetsLogger.cs.meta diff --git a/Assets/TEngine/Runtime/GameFramework/Setting.meta b/Assets/TEngine/Runtime/GameFramework/Setting.meta new file mode 100644 index 00000000..3b2c6f79 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a9ccba8f06844f429e90b102717d97b2 +timeCreated: 1680490094 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSetting.cs b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSetting.cs new file mode 100644 index 00000000..4f735fb0 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSetting.cs @@ -0,0 +1,305 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace TEngine +{ + /// + /// 默认游戏配置。 + /// + public sealed class DefaultSetting + { + private readonly SortedDictionary m_Settings = new SortedDictionary(StringComparer.Ordinal); + + /// + /// 初始化本地版本资源列表的新实例。 + /// + public DefaultSetting() + { + } + + /// + /// 获取游戏配置项数量。 + /// + public int Count + { + get + { + return m_Settings.Count; + } + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public string[] GetAllSettingNames() + { + int index = 0; + string[] allSettingNames = new string[m_Settings.Count]; + foreach (KeyValuePair setting in m_Settings) + { + allSettingNames[index++] = setting.Key; + } + + return allSettingNames; + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public void GetAllSettingNames(List results) + { + if (results == null) + { + throw new GameFrameworkException("Results is invalid."); + } + + results.Clear(); + foreach (KeyValuePair setting in m_Settings) + { + results.Add(setting.Key); + } + } + + /// + /// 检查是否存在指定游戏配置项。 + /// + /// 要检查游戏配置项的名称。 + /// 指定的游戏配置项是否存在。 + public bool HasSetting(string settingName) + { + return m_Settings.ContainsKey(settingName); + } + + /// + /// 移除指定游戏配置项。 + /// + /// 要移除游戏配置项的名称。 + /// 是否移除指定游戏配置项成功。 + public bool RemoveSetting(string settingName) + { + return m_Settings.Remove(settingName); + } + + /// + /// 清空所有游戏配置项。 + /// + public void RemoveAllSettings() + { + m_Settings.Clear(); + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的布尔值。 + public bool GetBool(string settingName) + { + string value = null; + if (!m_Settings.TryGetValue(settingName, out value)) + { + Log.Warning("Setting '{0}' is not exist.", settingName); + return false; + } + + return int.Parse(value) != 0; + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的布尔值。 + public bool GetBool(string settingName, bool defaultValue) + { + string value = null; + if (!m_Settings.TryGetValue(settingName, out value)) + { + return defaultValue; + } + + return int.Parse(value) != 0; + } + + /// + /// 向指定游戏配置项写入布尔值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的布尔值。 + public void SetBool(string settingName, bool value) + { + m_Settings[settingName] = value ? "1" : "0"; + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的整数值。 + public int GetInt(string settingName) + { + string value = null; + if (!m_Settings.TryGetValue(settingName, out value)) + { + Log.Warning("Setting '{0}' is not exist.", settingName); + return 0; + } + + return int.Parse(value); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的整数值。 + public int GetInt(string settingName, int defaultValue) + { + string value = null; + if (!m_Settings.TryGetValue(settingName, out value)) + { + return defaultValue; + } + + return int.Parse(value); + } + + /// + /// 向指定游戏配置项写入整数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的整数值。 + public void SetInt(string settingName, int value) + { + m_Settings[settingName] = value.ToString(); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的浮点数值。 + public float GetFloat(string settingName) + { + string value = null; + if (!m_Settings.TryGetValue(settingName, out value)) + { + Log.Warning("Setting '{0}' is not exist.", settingName); + return 0f; + } + + return float.Parse(value); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的浮点数值。 + public float GetFloat(string settingName, float defaultValue) + { + string value = null; + if (!m_Settings.TryGetValue(settingName, out value)) + { + return defaultValue; + } + + return float.Parse(value); + } + + /// + /// 向指定游戏配置项写入浮点数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的浮点数值。 + public void SetFloat(string settingName, float value) + { + m_Settings[settingName] = value.ToString(); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的字符串值。 + public string GetString(string settingName) + { + string value = null; + if (!m_Settings.TryGetValue(settingName, out value)) + { + Log.Warning("Setting '{0}' is not exist.", settingName); + return null; + } + + return value; + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的字符串值。 + public string GetString(string settingName, string defaultValue) + { + string value = null; + if (!m_Settings.TryGetValue(settingName, out value)) + { + return defaultValue; + } + + return value; + } + + /// + /// 向指定游戏配置项写入字符串值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的字符串值。 + public void SetString(string settingName, string value) + { + m_Settings[settingName] = value; + } + + /// + /// 序列化数据。 + /// + /// 目标流。 + public void Serialize(Stream stream) + { + using (BinaryWriter binaryWriter = new BinaryWriter(stream, Encoding.UTF8)) + { + binaryWriter.Write7BitEncodedInt32(m_Settings.Count); + foreach (KeyValuePair setting in m_Settings) + { + binaryWriter.Write(setting.Key); + binaryWriter.Write(setting.Value); + } + } + } + + /// + /// 反序列化数据。 + /// + /// 指定流。 + public void Deserialize(Stream stream) + { + m_Settings.Clear(); + using (BinaryReader binaryReader = new BinaryReader(stream, Encoding.UTF8)) + { + int settingCount = binaryReader.Read7BitEncodedInt32(); + for (int i = 0; i < settingCount; i++) + { + m_Settings.Add(binaryReader.ReadString(), binaryReader.ReadString()); + } + } + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSetting.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSetting.cs.meta new file mode 100644 index 00000000..cd0b3863 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: eaa6327836444075b03413516af7166c +timeCreated: 1680490094 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingHelper.cs b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingHelper.cs new file mode 100644 index 00000000..b2a2cedd --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingHelper.cs @@ -0,0 +1,379 @@ +using System; +using System.Collections.Generic; +using System.IO; +using UnityEngine; + +namespace TEngine +{ + /// + /// 默认游戏配置辅助器。 + /// + public class DefaultSettingHelper : SettingHelperBase + { + private const string SettingFileName = "GameFrameworkSetting.dat"; + + private string m_FilePath = null; + private DefaultSetting m_Settings = null; + private DefaultSettingSerializer m_Serializer = null; + + /// + /// 获取游戏配置项数量。 + /// + public override int Count + { + get + { + return m_Settings != null ? m_Settings.Count : 0; + } + } + + /// + /// 获取游戏配置存储文件路径。 + /// + public string FilePath + { + get + { + return m_FilePath; + } + } + + /// + /// 获取游戏配置。 + /// + public DefaultSetting Setting + { + get + { + return m_Settings; + } + } + + /// + /// 获取游戏配置序列化器。 + /// + public DefaultSettingSerializer Serializer + { + get + { + return m_Serializer; + } + } + + /// + /// 加载游戏配置。 + /// + /// 是否加载游戏配置成功。 + public override bool Load() + { + try + { + if (!File.Exists(m_FilePath)) + { + return true; + } + + using (FileStream fileStream = new FileStream(m_FilePath, FileMode.Open, FileAccess.Read)) + { + m_Serializer.Deserialize(fileStream); + return true; + } + } + catch (Exception exception) + { + Log.Warning("Load settings failure with exception '{0}'.", exception); + return false; + } + } + + /// + /// 保存游戏配置。 + /// + /// 是否保存游戏配置成功。 + public override bool Save() + { + try + { + using (FileStream fileStream = new FileStream(m_FilePath, FileMode.Create, FileAccess.Write)) + { + return m_Serializer.Serialize(fileStream, m_Settings); + } + } + catch (Exception exception) + { + Log.Warning("Save settings failure with exception '{0}'.", exception); + return false; + } + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public override string[] GetAllSettingNames() + { + return m_Settings.GetAllSettingNames(); + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public override void GetAllSettingNames(List results) + { + m_Settings.GetAllSettingNames(results); + } + + /// + /// 检查是否存在指定游戏配置项。 + /// + /// 要检查游戏配置项的名称。 + /// 指定的游戏配置项是否存在。 + public override bool HasSetting(string settingName) + { + return m_Settings.HasSetting(settingName); + } + + /// + /// 移除指定游戏配置项。 + /// + /// 要移除游戏配置项的名称。 + /// 是否移除指定游戏配置项成功。 + public override bool RemoveSetting(string settingName) + { + return m_Settings.RemoveSetting(settingName); + } + + /// + /// 清空所有游戏配置项。 + /// + public override void RemoveAllSettings() + { + m_Settings.RemoveAllSettings(); + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的布尔值。 + public override bool GetBool(string settingName) + { + return m_Settings.GetBool(settingName); + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的布尔值。 + public override bool GetBool(string settingName, bool defaultValue) + { + return m_Settings.GetBool(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入布尔值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的布尔值。 + public override void SetBool(string settingName, bool value) + { + m_Settings.SetBool(settingName, value); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的整数值。 + public override int GetInt(string settingName) + { + return m_Settings.GetInt(settingName); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的整数值。 + public override int GetInt(string settingName, int defaultValue) + { + return m_Settings.GetInt(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入整数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的整数值。 + public override void SetInt(string settingName, int value) + { + m_Settings.SetInt(settingName, value); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的浮点数值。 + public override float GetFloat(string settingName) + { + return m_Settings.GetFloat(settingName); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的浮点数值。 + public override float GetFloat(string settingName, float defaultValue) + { + return m_Settings.GetFloat(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入浮点数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的浮点数值。 + public override void SetFloat(string settingName, float value) + { + m_Settings.SetFloat(settingName, value); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的字符串值。 + public override string GetString(string settingName) + { + return m_Settings.GetString(settingName); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的字符串值。 + public override string GetString(string settingName, string defaultValue) + { + return m_Settings.GetString(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入字符串值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的字符串值。 + public override void SetString(string settingName, string value) + { + m_Settings.SetString(settingName, value); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public override T GetObject(string settingName) + { + return Utility.Json.ToObject(GetString(settingName)); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public override object GetObject(Type objectType, string settingName) + { + return Utility.Json.ToObject(objectType, GetString(settingName)); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public override T GetObject(string settingName, T defaultObj) + { + string json = GetString(settingName, null); + if (json == null) + { + return defaultObj; + } + + return Utility.Json.ToObject(json); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public override object GetObject(Type objectType, string settingName, object defaultObj) + { + string json = GetString(settingName, null); + if (json == null) + { + return defaultObj; + } + + return Utility.Json.ToObject(objectType, json); + } + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入对象的类型。 + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public override void SetObject(string settingName, T obj) + { + SetString(settingName, Utility.Json.ToJson(obj)); + } + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public override void SetObject(string settingName, object obj) + { + SetString(settingName, Utility.Json.ToJson(obj)); + } + + private void Awake() + { + m_FilePath = Utility.Path.GetRegularPath(Path.Combine(Application.persistentDataPath, SettingFileName)); + m_Settings = new DefaultSetting(); + m_Serializer = new DefaultSettingSerializer(); + m_Serializer.RegisterSerializeCallback(0, SerializeDefaultSettingCallback); + m_Serializer.RegisterDeserializeCallback(0, DeserializeDefaultSettingCallback); + } + + private bool SerializeDefaultSettingCallback(Stream stream, DefaultSetting defaultSetting) + { + m_Settings.Serialize(stream); + return true; + } + + private DefaultSetting DeserializeDefaultSettingCallback(Stream stream) + { + m_Settings.Deserialize(stream); + return m_Settings; + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingHelper.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingHelper.cs.meta new file mode 100644 index 00000000..8b37345e --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dd3adf671d5e4b4c9653e7f07d6d0792 +timeCreated: 1680490094 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingSerializer.cs b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingSerializer.cs new file mode 100644 index 00000000..d07347cb --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingSerializer.cs @@ -0,0 +1,26 @@ +namespace TEngine +{ + /// + /// 默认游戏配置序列化器。 + /// + public sealed class DefaultSettingSerializer : GameFrameworkSerializer + { + private static readonly byte[] Header = new byte[] { (byte)'G', (byte)'F', (byte)'S' }; + + /// + /// 初始化默认游戏配置序列化器的新实例。 + /// + public DefaultSettingSerializer() + { + } + + /// + /// 获取默认游戏配置头标识。 + /// + /// 默认游戏配置头标识。 + protected override byte[] GetHeader() + { + return Header; + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingSerializer.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingSerializer.cs.meta new file mode 100644 index 00000000..484d24ef --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/DefaultSettingSerializer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1688211d367a4e3da941dc3c33ea37f2 +timeCreated: 1680490094 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/ISettingHelper.cs b/Assets/TEngine/Runtime/GameFramework/Setting/ISettingHelper.cs new file mode 100644 index 00000000..8611955d --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/ISettingHelper.cs @@ -0,0 +1,199 @@ +using System; +using System.Collections.Generic; + +namespace TEngine +{ + /// + /// 游戏配置辅助器接口。 + /// + public interface ISettingHelper + { + /// + /// 获取游戏配置项数量。 + /// + int Count + { + get; + } + + /// + /// 加载游戏配置。 + /// + /// 是否加载游戏配置成功。 + bool Load(); + + /// + /// 保存游戏配置。 + /// + /// 是否保存游戏配置成功。 + bool Save(); + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + string[] GetAllSettingNames(); + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + void GetAllSettingNames(List results); + + /// + /// 检查是否存在指定游戏配置项。 + /// + /// 要检查游戏配置项的名称。 + /// 指定的游戏配置项是否存在。 + bool HasSetting(string settingName); + + /// + /// 移除指定游戏配置项。 + /// + /// 要移除游戏配置项的名称。 + /// 是否移除指定游戏配置项成功。 + bool RemoveSetting(string settingName); + + /// + /// 清空所有游戏配置项。 + /// + void RemoveAllSettings(); + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的布尔值。 + bool GetBool(string settingName); + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的布尔值。 + bool GetBool(string settingName, bool defaultValue); + + /// + /// 向指定游戏配置项写入布尔值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的布尔值。 + void SetBool(string settingName, bool value); + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的整数值。 + int GetInt(string settingName); + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的整数值。 + int GetInt(string settingName, int defaultValue); + + /// + /// 向指定游戏配置项写入整数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的整数值。 + void SetInt(string settingName, int value); + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的浮点数值。 + float GetFloat(string settingName); + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的浮点数值。 + float GetFloat(string settingName, float defaultValue); + + /// + /// 向指定游戏配置项写入浮点数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的浮点数值。 + void SetFloat(string settingName, float value); + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的字符串值。 + string GetString(string settingName); + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的字符串值。 + string GetString(string settingName, string defaultValue); + + /// + /// 向指定游戏配置项写入字符串值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的字符串值。 + void SetString(string settingName, string value); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + T GetObject(string settingName); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + object GetObject(Type objectType, string settingName); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + T GetObject(string settingName, T defaultObj); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + object GetObject(Type objectType, string settingName, object defaultObj); + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入对象的类型。 + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + void SetObject(string settingName, T obj); + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + void SetObject(string settingName, object obj); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/ISettingHelper.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/ISettingHelper.cs.meta new file mode 100644 index 00000000..6f2df8fd --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/ISettingHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6d173740f25d459a9d09b86f7598fd79 +timeCreated: 1680490156 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/ISettingManager.cs b/Assets/TEngine/Runtime/GameFramework/Setting/ISettingManager.cs new file mode 100644 index 00000000..e8b7f184 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/ISettingManager.cs @@ -0,0 +1,205 @@ +using System; +using System.Collections.Generic; + +namespace TEngine +{ + /// + /// 游戏配置管理器接口。 + /// + public interface ISettingManager + { + /// + /// 获取游戏配置项数量。 + /// + int Count + { + get; + } + + /// + /// 设置游戏配置辅助器。 + /// + /// 游戏配置辅助器。 + void SetSettingHelper(ISettingHelper settingHelper); + + /// + /// 加载游戏配置。 + /// + /// 是否加载游戏配置成功。 + bool Load(); + + /// + /// 保存游戏配置。 + /// + /// 是否保存游戏配置成功。 + bool Save(); + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + string[] GetAllSettingNames(); + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + void GetAllSettingNames(List results); + + /// + /// 检查是否存在指定游戏配置项。 + /// + /// 要检查游戏配置项的名称。 + /// 指定的游戏配置项是否存在。 + bool HasSetting(string settingName); + + /// + /// 移除指定游戏配置项。 + /// + /// 要移除游戏配置项的名称。 + /// 是否移除指定游戏配置项成功。 + bool RemoveSetting(string settingName); + + /// + /// 清空所有游戏配置项。 + /// + void RemoveAllSettings(); + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的布尔值。 + bool GetBool(string settingName); + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的布尔值。 + bool GetBool(string settingName, bool defaultValue); + + /// + /// 向指定游戏配置项写入布尔值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的布尔值。 + void SetBool(string settingName, bool value); + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的整数值。 + int GetInt(string settingName); + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的整数值。 + int GetInt(string settingName, int defaultValue); + + /// + /// 向指定游戏配置项写入整数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的整数值。 + void SetInt(string settingName, int value); + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的浮点数值。 + float GetFloat(string settingName); + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的浮点数值。 + float GetFloat(string settingName, float defaultValue); + + /// + /// 向指定游戏配置项写入浮点数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的浮点数值。 + void SetFloat(string settingName, float value); + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的字符串值。 + string GetString(string settingName); + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的字符串值。 + string GetString(string settingName, string defaultValue); + + /// + /// 向指定游戏配置项写入字符串值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的字符串值。 + void SetString(string settingName, string value); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + T GetObject(string settingName); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + object GetObject(Type objectType, string settingName); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + T GetObject(string settingName, T defaultObj); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + object GetObject(Type objectType, string settingName, object defaultObj); + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入对象的类型。 + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + void SetObject(string settingName, T obj); + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + void SetObject(string settingName, object obj); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/ISettingManager.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/ISettingManager.cs.meta new file mode 100644 index 00000000..0ed19a48 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/ISettingManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: aa9d9f6f6c6747a39bdd2b382bf0ae21 +timeCreated: 1680490156 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/PlayerPrefsSettingHelper.cs b/Assets/TEngine/Runtime/GameFramework/Setting/PlayerPrefsSettingHelper.cs new file mode 100644 index 00000000..2595ef88 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/PlayerPrefsSettingHelper.cs @@ -0,0 +1,304 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace TEngine +{ + /// + /// PlayerPrefs 游戏配置辅助器。 + /// + public class PlayerPrefsSettingHelper : SettingHelperBase + { + /// + /// 获取游戏配置项数量。 + /// + public override int Count + { + get + { + return -1; + } + } + + /// + /// 加载游戏配置。 + /// + /// 是否加载游戏配置成功。 + public override bool Load() + { + return true; + } + + /// + /// 保存游戏配置。 + /// + /// 是否保存游戏配置成功。 + public override bool Save() + { + PlayerPrefs.Save(); + return true; + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public override string[] GetAllSettingNames() + { + Log.Warning("GetAllSettingNames is not supported."); + return null; + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public override void GetAllSettingNames(List results) + { + if (results == null) + { + throw new GameFrameworkException("Results is invalid."); + } + + results.Clear(); + Log.Warning("GetAllSettingNames is not supported."); + } + + /// + /// 检查是否存在指定游戏配置项。 + /// + /// 要检查游戏配置项的名称。 + /// 指定的游戏配置项是否存在。 + public override bool HasSetting(string settingName) + { + return PlayerPrefs.HasKey(settingName); + } + + /// + /// 移除指定游戏配置项。 + /// + /// 要移除游戏配置项的名称。 + /// 是否移除指定游戏配置项成功。 + public override bool RemoveSetting(string settingName) + { + if (!PlayerPrefs.HasKey(settingName)) + { + return false; + } + + PlayerPrefs.DeleteKey(settingName); + return true; + } + + /// + /// 清空所有游戏配置项。 + /// + public override void RemoveAllSettings() + { + PlayerPrefs.DeleteAll(); + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的布尔值。 + public override bool GetBool(string settingName) + { + return PlayerPrefs.GetInt(settingName) != 0; + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的布尔值。 + public override bool GetBool(string settingName, bool defaultValue) + { + return PlayerPrefs.GetInt(settingName, defaultValue ? 1 : 0) != 0; + } + + /// + /// 向指定游戏配置项写入布尔值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的布尔值。 + public override void SetBool(string settingName, bool value) + { + PlayerPrefs.SetInt(settingName, value ? 1 : 0); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的整数值。 + public override int GetInt(string settingName) + { + return PlayerPrefs.GetInt(settingName); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的整数值。 + public override int GetInt(string settingName, int defaultValue) + { + return PlayerPrefs.GetInt(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入整数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的整数值。 + public override void SetInt(string settingName, int value) + { + PlayerPrefs.SetInt(settingName, value); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的浮点数值。 + public override float GetFloat(string settingName) + { + return PlayerPrefs.GetFloat(settingName); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的浮点数值。 + public override float GetFloat(string settingName, float defaultValue) + { + return PlayerPrefs.GetFloat(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入浮点数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的浮点数值。 + public override void SetFloat(string settingName, float value) + { + PlayerPrefs.SetFloat(settingName, value); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的字符串值。 + public override string GetString(string settingName) + { + return PlayerPrefs.GetString(settingName); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的字符串值。 + public override string GetString(string settingName, string defaultValue) + { + return PlayerPrefs.GetString(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入字符串值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的字符串值。 + public override void SetString(string settingName, string value) + { + PlayerPrefs.SetString(settingName, value); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public override T GetObject(string settingName) + { + return Utility.Json.ToObject(GetString(settingName)); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public override object GetObject(Type objectType, string settingName) + { + return Utility.Json.ToObject(objectType, GetString(settingName)); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public override T GetObject(string settingName, T defaultObj) + { + string json = GetString(settingName, null); + if (json == null) + { + return defaultObj; + } + + return Utility.Json.ToObject(json); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public override object GetObject(Type objectType, string settingName, object defaultObj) + { + string json = GetString(settingName, null); + if (json == null) + { + return defaultObj; + } + + return Utility.Json.ToObject(objectType, json); + } + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入对象的类型。 + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public override void SetObject(string settingName, T obj) + { + PlayerPrefs.SetString(settingName, Utility.Json.ToJson(obj)); + } + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public override void SetObject(string settingName, object obj) + { + PlayerPrefs.SetString(settingName, Utility.Json.ToJson(obj)); + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/PlayerPrefsSettingHelper.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/PlayerPrefsSettingHelper.cs.meta new file mode 100644 index 00000000..07ad8ec9 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/PlayerPrefsSettingHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c2f3305694c04457a879ef21d5bc7956 +timeCreated: 1680490094 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/SettingComponent.cs b/Assets/TEngine/Runtime/GameFramework/Setting/SettingComponent.cs new file mode 100644 index 00000000..60c084e8 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/SettingComponent.cs @@ -0,0 +1,318 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace TEngine +{ + /// + /// 游戏配置组件。 + /// + [DisallowMultipleComponent] + public sealed class SettingComponent : GameFrameworkComponent + { + private ISettingManager m_SettingManager = null; + + [SerializeField] + private string m_SettingHelperTypeName = "TEngine.DefaultSettingHelper"; + + [SerializeField] + private SettingHelperBase m_CustomSettingHelper = null; + + /// + /// 获取游戏配置项数量。 + /// + public int Count + { + get + { + return m_SettingManager.Count; + } + } + + /// + /// 游戏框架组件初始化。 + /// + protected override void Awake() + { + base.Awake(); + + m_SettingManager = GameFrameworkEntry.GetModule(); + if (m_SettingManager == null) + { + Log.Fatal("Setting manager is invalid."); + return; + } + + SettingHelperBase settingHelper = Helper.CreateHelper(m_SettingHelperTypeName, m_CustomSettingHelper); + if (settingHelper == null) + { + Log.Error("Can not create setting helper."); + return; + } + + settingHelper.name = "Setting Helper"; + Transform transform = settingHelper.transform; + transform.SetParent(this.transform); + transform.localScale = Vector3.one; + + m_SettingManager.SetSettingHelper(settingHelper); + } + + private void Start() + { + if (!m_SettingManager.Load()) + { + Log.Error("Load settings failure."); + } + } + + /// + /// 保存游戏配置。 + /// + public void Save() + { + m_SettingManager.Save(); + } + + private void OnDestroy() + { + m_SettingManager.Save(); + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public string[] GetAllSettingNames() + { + return m_SettingManager.GetAllSettingNames(); + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public void GetAllSettingNames(List results) + { + m_SettingManager.GetAllSettingNames(results); + } + + /// + /// 检查是否存在指定游戏配置项。 + /// + /// 要检查游戏配置项的名称。 + /// 指定的游戏配置项是否存在。 + public bool HasSetting(string settingName) + { + return m_SettingManager.HasSetting(settingName); + } + + /// + /// 移除指定游戏配置项。 + /// + /// 要移除游戏配置项的名称。 + public void RemoveSetting(string settingName) + { + m_SettingManager.RemoveSetting(settingName); + } + + /// + /// 清空所有游戏配置项。 + /// + public void RemoveAllSettings() + { + m_SettingManager.RemoveAllSettings(); + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的布尔值。 + public bool GetBool(string settingName) + { + return m_SettingManager.GetBool(settingName); + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的布尔值。 + public bool GetBool(string settingName, bool defaultValue) + { + return m_SettingManager.GetBool(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入布尔值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的布尔值。 + public void SetBool(string settingName, bool value) + { + m_SettingManager.SetBool(settingName, value); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的整数值。 + public int GetInt(string settingName) + { + return m_SettingManager.GetInt(settingName); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的整数值。 + public int GetInt(string settingName, int defaultValue) + { + return m_SettingManager.GetInt(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入整数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的整数值。 + public void SetInt(string settingName, int value) + { + m_SettingManager.SetInt(settingName, value); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的浮点数值。 + public float GetFloat(string settingName) + { + return m_SettingManager.GetFloat(settingName); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的浮点数值。 + public float GetFloat(string settingName, float defaultValue) + { + return m_SettingManager.GetFloat(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入浮点数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的浮点数值。 + public void SetFloat(string settingName, float value) + { + m_SettingManager.SetFloat(settingName, value); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的字符串值。 + public string GetString(string settingName) + { + return m_SettingManager.GetString(settingName); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的字符串值。 + public string GetString(string settingName, string defaultValue) + { + return m_SettingManager.GetString(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入字符串值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的字符串值。 + public void SetString(string settingName, string value) + { + m_SettingManager.SetString(settingName, value); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public T GetObject(string settingName) + { + return m_SettingManager.GetObject(settingName); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public object GetObject(Type objectType, string settingName) + { + return m_SettingManager.GetObject(objectType, settingName); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public T GetObject(string settingName, T defaultObj) + { + return m_SettingManager.GetObject(settingName, defaultObj); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public object GetObject(Type objectType, string settingName, object defaultObj) + { + return m_SettingManager.GetObject(objectType, settingName, defaultObj); + } + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入对象的类型。 + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public void SetObject(string settingName, T obj) + { + m_SettingManager.SetObject(settingName, obj); + } + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public void SetObject(string settingName, object obj) + { + m_SettingManager.SetObject(settingName, obj); + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/SettingComponent.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/SettingComponent.cs.meta new file mode 100644 index 00000000..dfa1f3f0 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/SettingComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 352db63f3a7b449bac6e5de8bb32141a +timeCreated: 1680490094 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/SettingHelperBase.cs b/Assets/TEngine/Runtime/GameFramework/Setting/SettingHelperBase.cs new file mode 100644 index 00000000..f03f37b8 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/SettingHelperBase.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace TEngine +{ + /// + /// 游戏配置辅助器基类。 + /// + public abstract class SettingHelperBase : MonoBehaviour, ISettingHelper + { + /// + /// 获取游戏配置项数量。 + /// + public abstract int Count + { + get; + } + + /// + /// 加载游戏配置。 + /// + /// 是否加载游戏配置成功。 + public abstract bool Load(); + + /// + /// 保存游戏配置。 + /// + /// 是否保存游戏配置成功。 + public abstract bool Save(); + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public abstract string[] GetAllSettingNames(); + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public abstract void GetAllSettingNames(List results); + + /// + /// 检查是否存在指定游戏配置项。 + /// + /// 要检查游戏配置项的名称。 + /// 指定的游戏配置项是否存在。 + public abstract bool HasSetting(string settingName); + + /// + /// 移除指定游戏配置项。 + /// + /// 要移除游戏配置项的名称。 + /// 是否移除指定游戏配置项成功。 + public abstract bool RemoveSetting(string settingName); + + /// + /// 清空所有游戏配置项。 + /// + public abstract void RemoveAllSettings(); + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的布尔值。 + public abstract bool GetBool(string settingName); + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的布尔值。 + public abstract bool GetBool(string settingName, bool defaultValue); + + /// + /// 向指定游戏配置项写入布尔值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的布尔值。 + public abstract void SetBool(string settingName, bool value); + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的整数值。 + public abstract int GetInt(string settingName); + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的整数值。 + public abstract int GetInt(string settingName, int defaultValue); + + /// + /// 向指定游戏配置项写入整数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的整数值。 + public abstract void SetInt(string settingName, int value); + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的浮点数值。 + public abstract float GetFloat(string settingName); + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的浮点数值。 + public abstract float GetFloat(string settingName, float defaultValue); + + /// + /// 向指定游戏配置项写入浮点数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的浮点数值。 + public abstract void SetFloat(string settingName, float value); + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的字符串值。 + public abstract string GetString(string settingName); + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的字符串值。 + public abstract string GetString(string settingName, string defaultValue); + + /// + /// 向指定游戏配置项写入字符串值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的字符串值。 + public abstract void SetString(string settingName, string value); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public abstract T GetObject(string settingName); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public abstract object GetObject(Type objectType, string settingName); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public abstract T GetObject(string settingName, T defaultObj); + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public abstract object GetObject(Type objectType, string settingName, object defaultObj); + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入对象的类型。 + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public abstract void SetObject(string settingName, T obj); + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public abstract void SetObject(string settingName, object obj); + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/SettingHelperBase.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/SettingHelperBase.cs.meta new file mode 100644 index 00000000..a7bf7790 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/SettingHelperBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a00f613e91e248f29afcf49bf919e01e +timeCreated: 1680490094 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/SettingManager.cs b/Assets/TEngine/Runtime/GameFramework/Setting/SettingManager.cs new file mode 100644 index 00000000..28e3d016 --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/SettingManager.cs @@ -0,0 +1,558 @@ +using System; +using System.Collections.Generic; + +namespace TEngine +{ + /// + /// 游戏配置管理器。 + /// + internal sealed class SettingManager : GameFrameworkModule, ISettingManager + { + private ISettingHelper m_SettingHelper; + + /// + /// 初始化游戏配置管理器的新实例。 + /// + public SettingManager() + { + m_SettingHelper = null; + } + + /// + /// 获取游戏配置项数量。 + /// + public int Count + { + get + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + return m_SettingHelper.Count; + } + } + + /// + /// 游戏配置管理器轮询。 + /// + /// 逻辑流逝时间,以秒为单位。 + /// 真实流逝时间,以秒为单位。 + internal override void Update(float elapseSeconds, float realElapseSeconds) + { + } + + /// + /// 关闭并清理游戏配置管理器。 + /// + internal override void Shutdown() + { + Save(); + } + + /// + /// 设置游戏配置辅助器。 + /// + /// 游戏配置辅助器。 + public void SetSettingHelper(ISettingHelper settingHelper) + { + if (settingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + m_SettingHelper = settingHelper; + } + + /// + /// 加载游戏配置。 + /// + /// 是否加载游戏配置成功。 + public bool Load() + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + return m_SettingHelper.Load(); + } + + /// + /// 保存游戏配置。 + /// + /// 是否保存游戏配置成功。 + public bool Save() + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + return m_SettingHelper.Save(); + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public string[] GetAllSettingNames() + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + return m_SettingHelper.GetAllSettingNames(); + } + + /// + /// 获取所有游戏配置项的名称。 + /// + /// 所有游戏配置项的名称。 + public void GetAllSettingNames(List results) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + m_SettingHelper.GetAllSettingNames(results); + } + + /// + /// 检查是否存在指定游戏配置项。 + /// + /// 要检查游戏配置项的名称。 + /// 指定的游戏配置项是否存在。 + public bool HasSetting(string settingName) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.HasSetting(settingName); + } + + /// + /// 移除指定游戏配置项。 + /// + /// 要移除游戏配置项的名称。 + /// 是否移除指定游戏配置项成功。 + public bool RemoveSetting(string settingName) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.RemoveSetting(settingName); + } + + /// + /// 清空所有游戏配置项。 + /// + public void RemoveAllSettings() + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + m_SettingHelper.RemoveAllSettings(); + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的布尔值。 + public bool GetBool(string settingName) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetBool(settingName); + } + + /// + /// 从指定游戏配置项中读取布尔值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的布尔值。 + public bool GetBool(string settingName, bool defaultValue) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetBool(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入布尔值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的布尔值。 + public void SetBool(string settingName, bool value) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + m_SettingHelper.SetBool(settingName, value); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的整数值。 + public int GetInt(string settingName) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetInt(settingName); + } + + /// + /// 从指定游戏配置项中读取整数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的整数值。 + public int GetInt(string settingName, int defaultValue) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetInt(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入整数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的整数值。 + public void SetInt(string settingName, int value) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + m_SettingHelper.SetInt(settingName, value); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的浮点数值。 + public float GetFloat(string settingName) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetFloat(settingName); + } + + /// + /// 从指定游戏配置项中读取浮点数值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的浮点数值。 + public float GetFloat(string settingName, float defaultValue) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetFloat(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入浮点数值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的浮点数值。 + public void SetFloat(string settingName, float value) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + m_SettingHelper.SetFloat(settingName, value); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 读取的字符串值。 + public string GetString(string settingName) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetString(settingName); + } + + /// + /// 从指定游戏配置项中读取字符串值。 + /// + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认值。 + /// 读取的字符串值。 + public string GetString(string settingName, string defaultValue) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetString(settingName, defaultValue); + } + + /// + /// 向指定游戏配置项写入字符串值。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的字符串值。 + public void SetString(string settingName, string value) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + m_SettingHelper.SetString(settingName, value); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public T GetObject(string settingName) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetObject(settingName); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 读取的对象。 + public object GetObject(Type objectType, string settingName) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetObject(objectType, settingName); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public T GetObject(string settingName, T defaultObj) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetObject(settingName, defaultObj); + } + + /// + /// 从指定游戏配置项中读取对象。 + /// + /// 要读取对象的类型。 + /// 要获取游戏配置项的名称。 + /// 当指定的游戏配置项不存在时,返回此默认对象。 + /// 读取的对象。 + public object GetObject(Type objectType, string settingName, object defaultObj) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (objectType == null) + { + throw new GameFrameworkException("Object type is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + return m_SettingHelper.GetObject(objectType, settingName, defaultObj); + } + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入对象的类型。 + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public void SetObject(string settingName, T obj) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + m_SettingHelper.SetObject(settingName, obj); + } + + /// + /// 向指定游戏配置项写入对象。 + /// + /// 要写入游戏配置项的名称。 + /// 要写入的对象。 + public void SetObject(string settingName, object obj) + { + if (m_SettingHelper == null) + { + throw new GameFrameworkException("Setting helper is invalid."); + } + + if (string.IsNullOrEmpty(settingName)) + { + throw new GameFrameworkException("Setting name is invalid."); + } + + m_SettingHelper.SetObject(settingName, obj); + } + } +} diff --git a/Assets/TEngine/Runtime/GameFramework/Setting/SettingManager.cs.meta b/Assets/TEngine/Runtime/GameFramework/Setting/SettingManager.cs.meta new file mode 100644 index 00000000..b92543cb --- /dev/null +++ b/Assets/TEngine/Runtime/GameFramework/Setting/SettingManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b35233fe04f74c928937f53330ed5bfd +timeCreated: 1680490156 \ No newline at end of file