├── .gitignore ├── .gitmodules ├── Assets ├── Extensions.meta ├── Extensions │ ├── AwaitExtension.meta │ ├── AwaitExtension │ │ ├── AwaitDataWrap.cs │ │ ├── AwaitDataWrap.cs.meta │ │ ├── AwaitableExtensions.Starforce.cs │ │ ├── AwaitableExtensions.Starforce.cs.meta │ │ ├── AwaitableExtensions.cs │ │ ├── AwaitableExtensions.cs.meta │ │ ├── DownLoadResult.cs │ │ ├── DownLoadResult.cs.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── WebResult.cs │ │ └── WebResult.cs.meta │ ├── BuildExtension.meta │ ├── BuildExtension │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── BuildEventHandle.cs │ │ │ ├── BuildEventHandle.cs.meta │ │ │ ├── GameFrameworkConfigs.cs │ │ │ ├── GameFrameworkConfigs.cs.meta │ │ │ ├── Utility.cs │ │ │ ├── Utility.cs.meta │ │ │ ├── VersionInfoData.cs │ │ │ ├── VersionInfoData.cs.meta │ │ │ ├── VersionInfoDataDrawer.cs │ │ │ ├── VersionInfoDataDrawer.cs.meta │ │ │ ├── VersionInfoDataEditor.cs │ │ │ ├── VersionInfoDataEditor.cs.meta │ │ │ ├── VersionInfoEditorData.cs │ │ │ ├── VersionInfoEditorData.cs.meta │ │ │ ├── VersionInfoEditorDataEditor.cs │ │ │ ├── VersionInfoEditorDataEditor.cs.meta │ │ │ ├── VersionInfoWrapData.cs │ │ │ └── VersionInfoWrapData.cs.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── Runtime.meta │ │ └── Runtime │ │ │ ├── BuildInfo.cs │ │ │ ├── BuildInfo.cs.meta │ │ │ ├── VersionInfo.cs │ │ │ └── VersionInfo.cs.meta │ ├── Common.meta │ ├── Common │ │ ├── Searchable.meta │ │ ├── Searchable │ │ │ ├── Editor.meta │ │ │ ├── Editor │ │ │ │ ├── SearchableDataDrawer.cs │ │ │ │ ├── SearchableDataDrawer.cs.meta │ │ │ │ ├── SearchableEnumDrawer.cs │ │ │ │ ├── SearchableEnumDrawer.cs.meta │ │ │ │ ├── SearchablePopup.cs │ │ │ │ └── SearchablePopup.cs.meta │ │ │ ├── Runtime.meta │ │ │ └── Runtime │ │ │ │ ├── SearchableData.cs │ │ │ │ ├── SearchableData.cs.meta │ │ │ │ ├── SearchableEnumAttribute.cs │ │ │ │ └── SearchableEnumAttribute.cs.meta │ │ ├── SerializableDictionary.meta │ │ └── SerializableDictionary │ │ │ ├── Editor.meta │ │ │ ├── Editor │ │ │ ├── SerializableDictionaryExampleEditor.cs │ │ │ ├── SerializableDictionaryExampleEditor.cs.meta │ │ │ ├── SerializableDictionaryPropertyDrawer.cs │ │ │ └── SerializableDictionaryPropertyDrawer.cs.meta │ │ │ ├── Example.meta │ │ │ ├── Example │ │ │ ├── SerializableDicitonary Example.unity │ │ │ ├── SerializableDicitonary Example.unity.meta │ │ │ ├── SerializableDictionaryExample.cs │ │ │ ├── SerializableDictionaryExample.cs.meta │ │ │ ├── UserSerializableDictionaries.cs │ │ │ └── UserSerializableDictionaries.cs.meta │ │ │ ├── SerializableDictionary.cs │ │ │ ├── SerializableDictionary.cs.meta │ │ │ ├── SerializableDictionary.pdf │ │ │ ├── SerializableDictionary.pdf.meta │ │ │ ├── SerializableHashSet.cs │ │ │ └── SerializableHashSet.cs.meta │ ├── DataTableExtension.meta │ ├── DataTableExtension │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── DataTableEditor.meta │ │ │ ├── DataTableEditor │ │ │ │ ├── DataTableEditor.meta │ │ │ │ ├── DataTableEditor │ │ │ │ │ ├── DataTableEditingWindow.cs │ │ │ │ │ ├── DataTableEditingWindow.cs.meta │ │ │ │ │ ├── DataTableRowData.cs │ │ │ │ │ ├── DataTableRowData.cs.meta │ │ │ │ │ ├── LauncherEditorWindow.cs │ │ │ │ │ └── LauncherEditorWindow.cs.meta │ │ │ │ ├── Utility.meta │ │ │ │ └── Utility │ │ │ │ │ ├── DataTableUtility.cs │ │ │ │ │ ├── DataTableUtility.cs.meta │ │ │ │ │ ├── EditorWindowUtility.cs │ │ │ │ │ └── EditorWindowUtility.cs.meta │ │ │ ├── DataTableGenerator.meta │ │ │ ├── DataTableGenerator │ │ │ │ ├── DataTableCodeGenerator.cs │ │ │ │ ├── DataTableCodeGenerator.cs.meta │ │ │ │ ├── DataTableGenerator.cs │ │ │ │ ├── DataTableGenerator.cs.meta │ │ │ │ ├── DataTableGeneratorMenu.cs │ │ │ │ ├── DataTableGeneratorMenu.cs.meta │ │ │ │ ├── DataTableProcessor.ArrayProcessor.cs │ │ │ │ ├── DataTableProcessor.ArrayProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.BoolProcessor.cs │ │ │ │ ├── DataTableProcessor.BoolProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.ByteProcessor.cs │ │ │ │ ├── DataTableProcessor.ByteProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.CharProcessor.cs │ │ │ │ ├── DataTableProcessor.CharProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.Color32Processor.cs │ │ │ │ ├── DataTableProcessor.Color32Processor.cs.meta │ │ │ │ ├── DataTableProcessor.ColorProcessor.cs │ │ │ │ ├── DataTableProcessor.ColorProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.CommentProcessor.cs │ │ │ │ ├── DataTableProcessor.CommentProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.DataProcessor.cs │ │ │ │ ├── DataTableProcessor.DataProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.DataProcessorUtility.cs │ │ │ │ ├── DataTableProcessor.DataProcessorUtility.cs.meta │ │ │ │ ├── DataTableProcessor.DateTimeProcessor.cs │ │ │ │ ├── DataTableProcessor.DateTimeProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.DecimalProcessor.cs │ │ │ │ ├── DataTableProcessor.DecimalProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.DictionaryProcessor.cs │ │ │ │ ├── DataTableProcessor.DictionaryProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.DoubleProcessor.cs │ │ │ │ ├── DataTableProcessor.DoubleProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.EnumProcessor.cs │ │ │ │ ├── DataTableProcessor.EnumProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.EscapeStringMap.cs │ │ │ │ ├── DataTableProcessor.EscapeStringMap.cs.meta │ │ │ │ ├── DataTableProcessor.Excel.cs │ │ │ │ ├── DataTableProcessor.Excel.cs.meta │ │ │ │ ├── DataTableProcessor.FloatProcessor.cs │ │ │ │ ├── DataTableProcessor.FloatProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.GenericDataProcessor.cs │ │ │ │ ├── DataTableProcessor.GenericDataProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.ICollectionProcessor.cs │ │ │ │ ├── DataTableProcessor.ICollectionProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.IDictionaryProcessor.cs │ │ │ │ ├── DataTableProcessor.IDictionaryProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.IdProcessor.cs │ │ │ │ ├── DataTableProcessor.IdProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.IntProcessor.cs │ │ │ │ ├── DataTableProcessor.IntProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.ListProcessor.cs │ │ │ │ ├── DataTableProcessor.ListProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.LongProcessor.cs │ │ │ │ ├── DataTableProcessor.LongProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.QuaternionProcessor.cs │ │ │ │ ├── DataTableProcessor.QuaternionProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.RectProcessor.cs │ │ │ │ ├── DataTableProcessor.RectProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.SByteProcessor.cs │ │ │ │ ├── DataTableProcessor.SByteProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.ShortProcessor.cs │ │ │ │ ├── DataTableProcessor.ShortProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.StringProcessor.cs │ │ │ │ ├── DataTableProcessor.StringProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.UIntProcessor.cs │ │ │ │ ├── DataTableProcessor.UIntProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.ULongProcessor.cs │ │ │ │ ├── DataTableProcessor.ULongProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.UShortProcessor.cs │ │ │ │ ├── DataTableProcessor.UShortProcessor.cs.meta │ │ │ │ ├── DataTableProcessor.Vector2Processor.cs │ │ │ │ ├── DataTableProcessor.Vector2Processor.cs.meta │ │ │ │ ├── DataTableProcessor.Vector3Processor.cs │ │ │ │ ├── DataTableProcessor.Vector3Processor.cs.meta │ │ │ │ ├── DataTableProcessor.Vector4Processor.cs │ │ │ │ ├── DataTableProcessor.Vector4Processor.cs.meta │ │ │ │ ├── DataTableProcessor.cs │ │ │ │ └── DataTableProcessor.cs.meta │ │ │ ├── EPPlus.meta │ │ │ ├── EPPlus │ │ │ │ ├── EPPlus.dll │ │ │ │ ├── EPPlus.dll.meta │ │ │ │ ├── EPPlus.xml │ │ │ │ ├── EPPlus.xml.meta │ │ │ │ ├── Microsoft.IO.RecyclableMemoryStream.dll │ │ │ │ ├── Microsoft.IO.RecyclableMemoryStream.dll.meta │ │ │ │ ├── Microsoft.IO.RecyclableMemoryStream.xml │ │ │ │ ├── Microsoft.IO.RecyclableMemoryStream.xml.meta │ │ │ │ ├── System.ComponentModel.Annotations.dll │ │ │ │ └── System.ComponentModel.Annotations.dll.meta │ │ │ ├── Extensions.meta │ │ │ ├── Extensions │ │ │ │ ├── DataTableConfig.cs │ │ │ │ ├── DataTableConfig.cs.meta │ │ │ │ ├── DataTableProcessorExtensions.cs │ │ │ │ ├── DataTableProcessorExtensions.cs.meta │ │ │ │ ├── ExcelExtension.cs │ │ │ │ ├── ExcelExtension.cs.meta │ │ │ │ ├── ExtensionsGenerate.cs │ │ │ │ ├── ExtensionsGenerate.cs.meta │ │ │ │ ├── PermutationAndCombination.cs │ │ │ │ ├── PermutationAndCombination.cs.meta │ │ │ │ ├── UnityInternalBridge.meta │ │ │ │ └── UnityInternalBridge │ │ │ │ │ ├── ReorderableList.cs │ │ │ │ │ ├── ReorderableList.cs.meta │ │ │ │ │ ├── Unity.InternalAPIEngineBridge.006.asmdef │ │ │ │ │ └── Unity.InternalAPIEngineBridge.006.asmdef.meta │ │ │ ├── Resource.meta │ │ │ └── Resource │ │ │ │ ├── DataTableCodeTemplate.txt │ │ │ │ ├── DataTableCodeTemplate.txt.meta │ │ │ │ ├── DataTableConfig.asset │ │ │ │ ├── DataTableConfig.asset.meta │ │ │ │ ├── DataTableTemplate.txt │ │ │ │ └── DataTableTemplate.txt.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── Runtime.meta │ │ └── Runtime │ │ │ ├── DataTable.meta │ │ │ ├── DataTable │ │ │ ├── GitKeep.gitkeep │ │ │ └── GitKeep.gitkeep.meta │ │ │ ├── Extensions.meta │ │ │ ├── Extensions │ │ │ ├── BinaryReaderExtension.cs │ │ │ ├── BinaryReaderExtension.cs.meta │ │ │ ├── DataTableExtension.cs │ │ │ └── DataTableExtension.cs.meta │ │ │ ├── Helper.meta │ │ │ ├── Helper │ │ │ ├── DataTableHelper.cs │ │ │ └── DataTableHelper.cs.meta │ │ │ ├── LoadRowExtension.meta │ │ │ └── LoadRowExtension │ │ │ ├── DataProvider.meta │ │ │ ├── DataProvider │ │ │ ├── CustomVirtualFileSystemDataProvider.cs │ │ │ ├── CustomVirtualFileSystemDataProvider.cs.meta │ │ │ ├── DataProviderUtility.cs │ │ │ ├── DataProviderUtility.cs.meta │ │ │ ├── FileStreamProvider.cs │ │ │ ├── FileStreamProvider.cs.meta │ │ │ ├── IDataProvider.cs │ │ │ ├── IDataProvider.cs.meta │ │ │ ├── VirualFileSystemProvider.cs │ │ │ └── VirualFileSystemProvider.cs.meta │ │ │ ├── DataTableExtensionComponent.cs │ │ │ ├── DataTableExtensionComponent.cs.meta │ │ │ ├── DataTableRowConfig.cs │ │ │ ├── DataTableRowConfig.cs.meta │ │ │ ├── DataTableRowSetting.cs │ │ │ ├── DataTableRowSetting.cs.meta │ │ │ ├── FileStream.meta │ │ │ ├── FileStream │ │ │ ├── AndroidFileStream.cs │ │ │ ├── AndroidFileStream.cs.meta │ │ │ ├── CommonFileStream.cs │ │ │ ├── CommonFileStream.cs.meta │ │ │ ├── FileStreamHelper.cs │ │ │ ├── FileStreamHelper.cs.meta │ │ │ ├── IFileStream.cs │ │ │ └── IFileStream.cs.meta │ │ │ ├── TypeNamePair.cs │ │ │ └── TypeNamePair.cs.meta │ ├── EditorExtension.meta │ ├── EditorExtension │ │ ├── Editor.meta │ │ └── Editor │ │ │ ├── EditorLogRedirect.cs │ │ │ └── EditorLogRedirect.cs.meta │ ├── MergeFileToVFSExtension.meta │ ├── MergeFileToVFSExtension │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── AssetData.cs │ │ │ ├── AssetData.cs.meta │ │ │ ├── AssetType.cs │ │ │ ├── AssetType.cs.meta │ │ │ ├── MergeAssetScriptableObject.cs │ │ │ ├── MergeAssetScriptableObject.cs.meta │ │ │ ├── MergeAssetToVFSWindow.cs │ │ │ ├── MergeAssetToVFSWindow.cs.meta │ │ │ ├── MergeAssetUtility.cs │ │ │ └── MergeAssetUtility.cs.meta │ │ ├── README.md │ │ └── README.md.meta │ ├── ResourceRuleExtension.meta │ ├── ResourceRuleExtension │ │ ├── Editor.meta │ │ └── Editor │ │ │ ├── ResourceRuleEditor.meta │ │ │ └── ResourceRuleEditor │ │ │ ├── ResourceRuleEditor.cs │ │ │ ├── ResourceRuleEditor.cs.meta │ │ │ ├── ResourceRuleEditorData.cs │ │ │ ├── ResourceRuleEditorData.cs.meta │ │ │ ├── ResourceRuleEditorUtility.cs │ │ │ └── ResourceRuleEditorUtility.cs.meta │ ├── SpriteCollectionExtension.meta │ ├── SpriteCollectionExtension │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── BuildEventHandle.cs │ │ │ ├── BuildEventHandle.cs.meta │ │ │ ├── InitializeOnLoad.cs │ │ │ ├── InitializeOnLoad.cs.meta │ │ │ ├── PreprocessBuildHandle.cs │ │ │ ├── PreprocessBuildHandle.cs.meta │ │ │ ├── SpriteCollectionComponentEditor.cs │ │ │ ├── SpriteCollectionComponentEditor.cs.meta │ │ │ ├── SpriteCollectionEditor.cs │ │ │ ├── SpriteCollectionEditor.cs.meta │ │ │ ├── SpriteCollectionUtility.cs │ │ │ └── SpriteCollectionUtility.cs.meta │ │ ├── ISetSpriteObject.cs │ │ ├── ISetSpriteObject.cs.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── ScriptCollectionComponent.LoadSpriteObject.cs │ │ ├── ScriptCollectionComponent.LoadSpriteObject.cs.meta │ │ ├── SetSpriteExtensions.Await.cs │ │ ├── SetSpriteExtensions.Await.cs.meta │ │ ├── SetSpriteExtensions.cs │ │ ├── SetSpriteExtensions.cs.meta │ │ ├── SpriteCollection.cs │ │ ├── SpriteCollection.cs.meta │ │ ├── SpriteCollectionComponent.Resource.cs │ │ ├── SpriteCollectionComponent.Resource.cs.meta │ │ ├── SpriteCollectionComponent.ResourceAwait.cs │ │ ├── SpriteCollectionComponent.ResourceAwait.cs.meta │ │ ├── SpriteCollectionComponent.cs │ │ ├── SpriteCollectionComponent.cs.meta │ │ ├── SpriteCollectionItemObject.cs │ │ ├── SpriteCollectionItemObject.cs.meta │ │ ├── StringSpriteDictionary.cs │ │ ├── StringSpriteDictionary.cs.meta │ │ ├── WaitSetImage.cs │ │ └── WaitSetImage.cs.meta │ ├── TextureExtension.meta │ ├── TextureExtension │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── TextureSetComponentEditor.cs │ │ │ └── TextureSetComponentEditor.cs.meta │ │ ├── ISetTexture2dObject.cs │ │ ├── ISetTexture2dObject.cs.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── ResourceData.cs │ │ ├── ResourceData.cs.meta │ │ ├── SetRawImage.cs │ │ ├── SetRawImage.cs.meta │ │ ├── SetTextureExtensions.Await.cs │ │ ├── SetTextureExtensions.Await.cs.meta │ │ ├── SetTextureExtensions.cs │ │ ├── SetTextureExtensions.cs.meta │ │ ├── TextureItemObject.cs │ │ ├── TextureItemObject.cs.meta │ │ ├── TextureSetComponent.FileSystem.cs │ │ ├── TextureSetComponent.FileSystem.cs.meta │ │ ├── TextureSetComponent.LoadTextureObject.cs │ │ ├── TextureSetComponent.LoadTextureObject.cs.meta │ │ ├── TextureSetComponent.NetWork.Await.cs │ │ ├── TextureSetComponent.NetWork.Await.cs.meta │ │ ├── TextureSetComponent.NetWork.cs │ │ ├── TextureSetComponent.NetWork.cs.meta │ │ ├── TextureSetComponent.Resource.Await.cs │ │ ├── TextureSetComponent.Resource.Await.cs.meta │ │ ├── TextureSetComponent.Resource.cs │ │ ├── TextureSetComponent.Resource.cs.meta │ │ ├── TextureSetComponent.cs │ │ ├── TextureSetComponent.cs.meta │ │ ├── WebGetTextureData.cs │ │ └── WebGetTextureData.cs.meta │ ├── TimerExtension.meta │ ├── TimerExtension │ │ ├── MultiMap.cs │ │ ├── MultiMap.cs.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── TimerComponent.cs │ │ ├── TimerComponent.cs.meta │ │ ├── TimerTimeUtility.cs │ │ └── TimerTimeUtility.cs.meta │ ├── TimingWheel.meta │ └── TimingWheel │ │ ├── ETTaskAsync.meta │ │ ├── ETTaskAsync │ │ ├── AsyncETTaskCompletedMethodBuilder.cs │ │ ├── AsyncETTaskCompletedMethodBuilder.cs.meta │ │ ├── AsyncETTaskMethodBuilder.cs │ │ ├── AsyncETTaskMethodBuilder.cs.meta │ │ ├── AsyncETVoidMethodBuilder.cs │ │ ├── AsyncETVoidMethodBuilder.cs.meta │ │ ├── AsyncMethodBuilderAttribute.cs │ │ ├── AsyncMethodBuilderAttribute.cs.meta │ │ ├── ETCancellationToken.cs │ │ ├── ETCancellationToken.cs.meta │ │ ├── ETTask.cs │ │ ├── ETTask.cs.meta │ │ ├── ETTaskCompleted.cs │ │ ├── ETTaskCompleted.cs.meta │ │ ├── ETTaskHelper.cs │ │ ├── ETTaskHelper.cs.meta │ │ ├── ETVoid.cs │ │ ├── ETVoid.cs.meta │ │ ├── IAwaiter.cs │ │ └── IAwaiter.cs.meta │ │ ├── Extensions.meta │ │ ├── Extensions │ │ ├── AtomicInt.cs │ │ ├── AtomicInt.cs.meta │ │ ├── AtomicLong.cs │ │ ├── AtomicLong.cs.meta │ │ ├── DateTimeHelper.cs │ │ ├── DateTimeHelper.cs.meta │ │ ├── Loom.cs │ │ └── Loom.cs.meta │ │ ├── Interfaces.meta │ │ ├── Interfaces │ │ ├── ITimeTask.cs │ │ ├── ITimeTask.cs.meta │ │ ├── ITimer.cs │ │ └── ITimer.cs.meta │ │ ├── Libraries.meta │ │ ├── Libraries │ │ ├── DelayQueue.dll │ │ ├── DelayQueue.dll.meta │ │ ├── DelayQueue.xml │ │ └── DelayQueue.xml.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── TimeSlot.cs │ │ ├── TimeSlot.cs.meta │ │ ├── TimeTask.cs │ │ ├── TimeTask.cs.meta │ │ ├── TimeTaskStatus.cs │ │ ├── TimeTaskStatus.cs.meta │ │ ├── TimingWheel.cs │ │ ├── TimingWheel.cs.meta │ │ ├── TimingWheelComponent.cs │ │ ├── TimingWheelComponent.cs.meta │ │ ├── TimingWheelTimer.cs │ │ └── TimingWheelTimer.cs.meta └── GameFramework.meta ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /.vs/ 7 | 8 | *.csproj 9 | *.unityproj 10 | *.booproj 11 | *.sln 12 | *.suo 13 | *.tmp 14 | *.user 15 | *.userprefs 16 | *.pidb 17 | *.svd 18 | 19 | /Assets/StreamingAssets/* 20 | !/Assets/StreamingAssets/.gitkeep 21 | /ProjectSettings/ProjectVersion.txt 22 | /Packages/* 23 | /UnityPackageManager/* 24 | /Assets/Plugins/Editor/JetBrains/* 25 | /Assets/Plugins/Editor/JetBrains.meta 26 | /.idea/* 27 | /Logs/* 28 | AssetBundles/ 29 | .obsidian 30 | AssetBundle 31 | /ProjectSettings 32 | /UserSettings 33 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Assets/GameFramework"] 2 | path = Assets/GameFramework 3 | url = https://github.com/EllanJiang/UnityGameFramework 4 | -------------------------------------------------------------------------------- /Assets/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d596b22b9b5f85428e1ac5742068d9a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5a744828dd818c4fa22b76230874d10 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/AwaitDataWrap.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using GameFramework; 3 | 4 | namespace UGFExtensions.Await 5 | { 6 | /// 7 | /// Await包装类 8 | /// 9 | public class AwaitDataWrap : IReference 10 | { 11 | /// 12 | /// 自定义数据 13 | /// 14 | public object UserData { get; private set; } 15 | /// 16 | /// TaskCompletionSource 17 | /// 18 | public TaskCompletionSource Source { get; private set; } 19 | 20 | public static AwaitDataWrap Create(object userData, TaskCompletionSource source) 21 | { 22 | AwaitDataWrap awaitDataWrap = ReferencePool.Acquire>(); 23 | awaitDataWrap.UserData = userData; 24 | awaitDataWrap.Source = source; 25 | return awaitDataWrap; 26 | } 27 | 28 | public void Clear() 29 | { 30 | UserData = null; 31 | Source = null; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/AwaitDataWrap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3403fdb2295c4ce0949307027713228a 3 | timeCreated: 1626080134 -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/AwaitableExtensions.Starforce.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 020911f18dce4c838a7220d80f71ac3a 3 | timeCreated: 1637031489 -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/AwaitableExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01da2ac225904c039af226e91bf81b50 3 | timeCreated: 1616751767 -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/DownLoadResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GameFramework; 3 | 4 | namespace UGFExtensions.Await 5 | { 6 | /// 7 | /// DownLoad 结果 8 | /// 9 | public class DownLoadResult : IReference 10 | { 11 | /// 12 | /// 是否有错误 13 | /// 14 | public bool IsError { get; private set; } 15 | /// 16 | /// 错误信息 17 | /// 18 | public string ErrorMessage { get; private set; } 19 | /// 20 | /// 自定义数据 21 | /// 22 | public object UserData { get; private set; } 23 | 24 | public static DownLoadResult Create(bool isError, string errorMessage, object userData) 25 | { 26 | DownLoadResult downLoadResult = ReferencePool.Acquire(); 27 | downLoadResult.IsError = isError; 28 | downLoadResult.ErrorMessage = errorMessage; 29 | downLoadResult.UserData = userData; 30 | return downLoadResult; 31 | } 32 | 33 | public void Clear() 34 | { 35 | IsError = false; 36 | ErrorMessage = string.Empty; 37 | UserData = null; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/DownLoadResult.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95e16bd8d44847deb560ed0df754857f 3 | timeCreated: 1616754337 -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/README.md: -------------------------------------------------------------------------------- 1 | # AwaitableExtension 2 | 3 | 对UnityGameFramework 的await扩展 使ugf 中各个组件 支持await/async 语法 4 | 5 | # 使用教程 6 | 7 | 1. 注册各组件需要的事件 8 | 9 | UGF中各种加载 显示都是通过事件通知的。 修改成await/async 也是基于此 。所以需要调用 10 | 11 | [AwaitableExtension](./AwaitableExtension.cs) 中`SubscribeEvent` 函数来注册事件。 需要在框架的启动流程中调用。 12 | 13 | 在启动流程中注册 的目的 也是为了防止调用框架重启 导致事件失效问题。 14 | 15 | 2. 通过UGF组件直接使用即可。 所有方法均使用扩展方法对UGF组件进行扩展 16 | 17 | 例如:打开一个界面 18 | 19 | ```csharp 20 | await GameEntry.UI.OpenUIFormAsync(UIFormId.Test); 21 | ``` 22 | 23 | 所有扩展 async 方法也支持嵌套 和 Task.WhenAll 等。 24 | 25 | # 特殊说明 26 | 27 | ​ 因为使用 web和download 组件时可能无论成功失败都需要返回 所以封装了 [WebResult](./WebResult.cs) 和 [DownLoadResult](./DownLoadResult.cs) 用于查看请求是否成功 或返回数据。 28 | 29 | ​ 例如: 30 | 31 | 1. WebRequest 32 | 33 | ```csharp 34 | WebResult result = await GameEntry.WebRequest.AddWebRequestAsync("url"); 35 | Debug.Log(result.IsError); 36 | if (!result.IsError) 37 | { 38 | Debug.Log(result.Bytes); 39 | } 40 | ``` 41 | 42 | 2. DownLoad 43 | 44 | ```csharp 45 | DownLoadResult result = await GameEntry.Download.AddDownloadAsync("", ""); 46 | Debug.Log(result.IsError); 47 | if(result.IsError){ 48 | DoSomething(); 49 | } 50 | ``` 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b5d6d7a03e94b94a477233e572d8d6b 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/WebResult.cs: -------------------------------------------------------------------------------- 1 | using GameFramework; 2 | 3 | namespace UGFExtensions.Await 4 | { 5 | /// 6 | /// web 访问结果 7 | /// 8 | public class WebResult : IReference 9 | { 10 | /// 11 | /// web请求 返回数据 12 | /// 13 | public byte[] Bytes { get; private set; } 14 | /// 15 | /// 是否有错误 16 | /// 17 | public bool IsError { get; private set; } 18 | /// 19 | /// 错误信息 20 | /// 21 | public string ErrorMessage { get; private set; } 22 | /// 23 | /// 自定义数据 24 | /// 25 | public object UserData { get; private set; } 26 | 27 | 28 | public static WebResult Create(byte[] bytes, bool isError, string errorMessage, object userData) 29 | { 30 | WebResult webResult = ReferencePool.Acquire(); 31 | webResult.Bytes = bytes; 32 | webResult.IsError = isError; 33 | webResult.ErrorMessage = errorMessage; 34 | webResult.UserData = userData; 35 | return webResult; 36 | } 37 | 38 | public WebResult Init(byte[] bytes, bool isError, string errorMessage, object userData) 39 | { 40 | this.Bytes = bytes; 41 | this.IsError = isError; 42 | this.ErrorMessage = errorMessage; 43 | this.UserData = userData; 44 | return this; 45 | } 46 | public void Clear() 47 | { 48 | Bytes = null; 49 | IsError = false; 50 | ErrorMessage = string.Empty; 51 | UserData = null; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Assets/Extensions/AwaitExtension/WebResult.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b9a4307bbce4edc8260a4ba1aa809bf 3 | timeCreated: 1616752744 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b4754aa2537487a87aaeaead92a26ae 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4520c9c8a7852004e91c146f31253a46 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/BuildEventHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b07870acd57455cb6845859001ca7e5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/GameFrameworkConfigs.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using GameFramework; 4 | using System.IO; 5 | using UnityEngine; 6 | using UnityGameFramework.Editor; 7 | using UnityGameFramework.Editor.ResourceTools; 8 | 9 | namespace UGFExtensions.Build.Editor 10 | { 11 | public static class GameFrameworkConfigs 12 | { 13 | [BuildSettingsConfigPath] 14 | public static string BuildSettingsConfig = GameFramework.Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "Res/Configs/BuildSettings.xml")); 15 | 16 | [ResourceCollectionConfigPath] 17 | public static string ResourceCollectionConfig = GameFramework.Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "Res/Configs/ResourceCollection.xml")); 18 | 19 | [ResourceEditorConfigPath] 20 | public static string ResourceEditorConfig = GameFramework.Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "Res/Configs/ResourceEditor.xml")); 21 | 22 | [ResourceBuilderConfigPath] 23 | public static string ResourceBuilderConfig = GameFramework.Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "Res/Configs/ResourceBuilder.xml")); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/GameFrameworkConfigs.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ee6a90491f84386b6c2b1c097d6b648 3 | timeCreated: 1628668268 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace UGFExtensions.Build.Editor 5 | { 6 | public static class Utility 7 | { 8 | public static class Uri 9 | { 10 | public static bool CheckUri(string uri) 11 | { 12 | if (string.IsNullOrEmpty(uri)) 13 | { 14 | return false; 15 | } 16 | Regex regex = new Regex(@"^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$"); 17 | return regex.IsMatch(uri); 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/Utility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a78824eb8e34744b965f7ebc8e81fdd 3 | timeCreated: 1628753750 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/VersionInfoData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac02e8b2cb4f4aabaf0864565664e30d 3 | timeCreated: 1628822724 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/VersionInfoDataDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 003075af278840b1aee7be9b627b4750 3 | timeCreated: 1628824114 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/VersionInfoDataEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9b0500589bf40e6a9a835548bb42402 3 | timeCreated: 1628822187 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/VersionInfoEditorData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f84dac6a330c478988ed9b2576369bfe 3 | timeCreated: 1628763649 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/VersionInfoEditorDataEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 59514f2f60474261bf261a3135fdb6fc 3 | timeCreated: 1628820268 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/VersionInfoWrapData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UGFExtensions.Build.Editor 5 | { 6 | [Serializable] 7 | public class VersionInfoWrapData 8 | { 9 | [SerializeField] private string m_Key; 10 | [SerializeField] private VersionInfoData m_Value; 11 | 12 | public string Key 13 | { 14 | get => m_Key; 15 | set => m_Key = value; 16 | } 17 | 18 | public VersionInfoData Value 19 | { 20 | get => m_Value; 21 | set => m_Value = value; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Editor/VersionInfoWrapData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 036a321b92f440ca83f6cbbd0f633bf6 3 | timeCreated: 1628822736 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 266476c387b4d5941b427cd4ac1d7048 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f691680263f54accb60d03e01b8913c2 3 | timeCreated: 1662451336 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Runtime/BuildInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2021 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | namespace UGFExtensions.Build.Rutime 9 | { 10 | public class BuildInfo 11 | { 12 | public string GameVersion 13 | { 14 | get; 15 | set; 16 | } 17 | 18 | public int InternalGameVersion 19 | { 20 | get; 21 | set; 22 | } 23 | 24 | public string CheckVersionUrl 25 | { 26 | get; 27 | set; 28 | } 29 | 30 | public string WindowsAppUrl 31 | { 32 | get; 33 | set; 34 | } 35 | 36 | public string MacOSAppUrl 37 | { 38 | get; 39 | set; 40 | } 41 | 42 | public string IOSAppUrl 43 | { 44 | get; 45 | set; 46 | } 47 | 48 | public string AndroidAppUrl 49 | { 50 | get; 51 | set; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Runtime/BuildInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e28d0fccffad46579f078bd317ed6cd0 3 | timeCreated: 1662451407 -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Runtime/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2021 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | namespace UGFExtensions.Build.Rutime 9 | { 10 | public class VersionInfo 11 | { 12 | // 是否需要强制更新游戏应用 13 | public bool ForceUpdateGame 14 | { 15 | get; 16 | set; 17 | } 18 | 19 | // 最新的游戏版本号 20 | public string LatestGameVersion 21 | { 22 | get; 23 | set; 24 | } 25 | 26 | // 最新的游戏内部版本号 27 | public int InternalGameVersion 28 | { 29 | get; 30 | set; 31 | } 32 | 33 | // 最新的资源内部版本号 34 | public int InternalResourceVersion 35 | { 36 | get; 37 | set; 38 | } 39 | 40 | // 资源更新下载地址 41 | public string UpdatePrefixUri 42 | { 43 | get; 44 | set; 45 | } 46 | 47 | // 资源版本列表长度 48 | public int VersionListLength 49 | { 50 | get; 51 | set; 52 | } 53 | 54 | // 资源版本列表哈希值 55 | public int VersionListHashCode 56 | { 57 | get; 58 | set; 59 | } 60 | 61 | // 资源版本列表压缩后长度 62 | public int VersionListCompressedLength 63 | { 64 | get; 65 | set; 66 | } 67 | 68 | // 资源版本列表压缩后哈希值 69 | public int VersionListCompressedHashCode 70 | { 71 | get; 72 | set; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Assets/Extensions/BuildExtension/Runtime/VersionInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c4e0434a514447385069f0ff2b99a5e 3 | timeCreated: 1662451407 -------------------------------------------------------------------------------- /Assets/Extensions/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 573eb34dea58b6e4f9301c7211bf7f8d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f307e9cec22f17142af5193604490b43 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b00926b4d8db49a4ab61958bba0fc7af 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Editor/SearchableDataDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11c21713192e468e85f648bda65244ec 3 | timeCreated: 1630304636 -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Editor/SearchableEnumDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82586c3ea06182a4999528926f6e441b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Editor/SearchablePopup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50e2e887cad444af9c64f4e7de140858 3 | timeCreated: 1525227782 -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0bfcdb770f7449129e3a2dd55b3d7882 3 | timeCreated: 1630308286 -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Runtime/SearchableData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace RoboRyanTron.SearchableEnum 5 | { 6 | [Serializable] 7 | public class SearchableData 8 | { 9 | [SerializeField] private int m_Select; 10 | [SerializeField] private string[] m_Names; 11 | 12 | public int Select 13 | { 14 | get => m_Select; 15 | set => m_Select = value; 16 | } 17 | 18 | public string[] Names 19 | { 20 | get => m_Names; 21 | set => m_Names = value; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Runtime/SearchableData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79993d8602b742c7bdad7891f78a2fe7 3 | timeCreated: 1630305267 -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Runtime/SearchableEnumAttribute.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // Author: Ryan Hipple 3 | // Date: 05/01/2018 4 | // ---------------------------------------------------------------------------- 5 | 6 | using System; 7 | using UnityEngine; 8 | 9 | namespace RoboRyanTron.SearchableEnum 10 | { 11 | /// 12 | /// Put this attribute on a public (or SerialzeField) enum in a 13 | /// MonoBehaviour or ScriptableObject to get an improved enum selector 14 | /// popup. The enum list is scrollable and can be filtered by typing. 15 | /// 16 | [AttributeUsage(AttributeTargets.Field)] 17 | public class SearchableEnumAttribute : PropertyAttribute {} 18 | } 19 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/Searchable/Runtime/SearchableEnumAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d57bf0a9f2e56043b171bac62dcd313 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4fa0f38322fc32e448cf7f69641f724a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20029ee1c099f4b47afbac48208879b9 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Editor/SerializableDictionaryExampleEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | 3 | namespace SerializableDictionary.Editor 4 | { 5 | [CustomEditor(typeof(SerializableDictionaryExample))] 6 | public class SerializableDictionaryExampleEditor : UnityEditor.Editor 7 | { 8 | private SerializableDictionaryExample Target=> target as SerializableDictionaryExample; 9 | public override void OnInspectorGUI() 10 | { 11 | base.OnInspectorGUI(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Editor/SerializableDictionaryExampleEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c059d2fab50495dab7876c6d6a307b6 3 | timeCreated: 1629026452 -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Editor/SerializableDictionaryPropertyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91da51d02ab9ebc459d80d5965d40d19 3 | timeCreated: 1492869349 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea574807be3814126807ca7b22d13988 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Example/SerializableDicitonary Example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c0758ade4ba74b7493ce3806fa2f38b 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Example/SerializableDictionaryExample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class SerializableDictionaryExample : MonoBehaviour { 6 | // The dictionaries can be accessed throught a property 7 | [SerializeField] 8 | StringStringDictionary m_stringStringDictionary = null; 9 | public IDictionary StringStringDictionary 10 | { 11 | get { return m_stringStringDictionary; } 12 | set { m_stringStringDictionary.CopyFrom (value); } 13 | } 14 | 15 | public ObjectColorDictionary m_objectColorDictionary; 16 | public StringColorArrayDictionary m_stringColorArrayDictionary; 17 | #if NET_4_6 || NET_STANDARD_2_0 18 | public StringHashSet m_stringHashSet; 19 | #endif 20 | 21 | void Reset () 22 | { 23 | // access by property 24 | StringStringDictionary = new Dictionary() { {"first key", "value A"}, {"second key", "value B"}, {"third key", "value C"} }; 25 | m_objectColorDictionary = new ObjectColorDictionary() { {gameObject, Color.blue}, {this, Color.red} }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Example/SerializableDictionaryExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5ff00a74ccb984498070d9930a7944c 3 | timeCreated: 1492868873 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Example/UserSerializableDictionaries.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System; 4 | using UnityEngine; 5 | 6 | [Serializable] 7 | public class StringStringDictionary : SerializableDictionary {} 8 | 9 | [Serializable] 10 | public class ObjectColorDictionary : SerializableDictionary {} 11 | 12 | [Serializable] 13 | public class ColorArrayStorage : SerializableDictionary.Storage {} 14 | 15 | [Serializable] 16 | public class StringColorArrayDictionary : SerializableDictionary {} 17 | 18 | [Serializable] 19 | public class MyClass 20 | { 21 | public int i; 22 | public string str; 23 | } 24 | 25 | [Serializable] 26 | public class QuaternionMyClassDictionary : SerializableDictionary {} 27 | 28 | #if NET_4_6 || NET_STANDARD_2_0 29 | [Serializable] 30 | public class StringHashSet : SerializableHashSet {} 31 | #endif 32 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/Example/UserSerializableDictionaries.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd910530dd8f6b5429c65a494644ed09 3 | timeCreated: 1493639913 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/SerializableDictionary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7be1c9624387604fba4005ccf7dbd5a 3 | timeCreated: 1492868176 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/SerializableDictionary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FingerCaster/UGFExtensions/bb815bbce0a971601509a0732bc7a5ad824c7cca/Assets/Extensions/Common/SerializableDictionary/SerializableDictionary.pdf -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/SerializableDictionary.pdf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8eb73a56b3a6ee64ab2c30cac8878d8f 3 | timeCreated: 1492869030 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/Common/SerializableDictionary/SerializableHashSet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c5ea2742f9d6498493646c49cb0a3e7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 969d73a1014d2ce4eb2ae2a02f06541d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ece86d07de1f926469ea2b931603fa07 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7c29f5beb97d0146ac04b4d3fc04ae6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/DataTableEditor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e340b6df820d0f44ea2fc0e7dd44c2df 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/DataTableEditor/DataTableEditingWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f1c41900a51c1a4d901a27b5c7c8f06 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/DataTableEditor/DataTableRowData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DataTableEditor 5 | { 6 | 7 | [Serializable] 8 | public class DataTableRowData 9 | { 10 | public List Data { get; set; } 11 | 12 | public DataTableRowData() 13 | { 14 | Data = new List(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/DataTableEditor/DataTableRowData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 389b276ca2baeb94791e80e4351c9d3a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/DataTableEditor/LauncherEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d52fbececdf823d4b9b2498633fa838f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 738da1aa094c97a449f13c3ecbed92ba 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/Utility/DataTableUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbdeca89a12b8ea4ab7f757392beb91e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/Utility/EditorWindowUtility.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace DataTableEditor 5 | { 6 | public partial class Utility 7 | { 8 | public static class EditorWindowUtility 9 | { 10 | public static T CreateWindow(string title) where T : EditorWindow 11 | { 12 | T editorWindow = ScriptableObject.CreateInstance(); 13 | if (title != null) 14 | { 15 | editorWindow.titleContent = new GUIContent(title); 16 | } 17 | return editorWindow; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableEditor/Utility/EditorWindowUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3de0b35105d3bc45838ce862fb95d43 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8027f75b9874ecf93881ae842f2cc8c 3 | timeCreated: 1595577390 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableCodeGenerator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.Text; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public delegate void DataTableCodeGenerator(DataTableProcessor dataTableProcessor, StringBuilder codeContent, 13 | object userData); 14 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableCodeGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40941eb45ca7d284f8a806370b88fa78 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5429345c1f3d2c747b0f74fefa25c149 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableGeneratorMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ddc8f13b2516c643a67d92a319dbf72 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ArrayProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4828a64729f470a88f77e35ecd58b67 3 | timeCreated: 1590549296 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.BoolProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class BoolProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "bool"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "bool", 25 | "boolean", 26 | "system.boolean" 27 | }; 28 | } 29 | 30 | public override bool Parse(string value) 31 | { 32 | return bool.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.BoolProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00bc8bc968fa2134095a36a43f326d56 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ByteProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class ByteProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "byte"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "byte", 25 | "system.byte" 26 | }; 27 | } 28 | 29 | public override byte Parse(string value) 30 | { 31 | return byte.Parse(value); 32 | } 33 | 34 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 35 | string value) 36 | { 37 | binaryWriter.Write(Parse(value)); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ByteProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11199a40fe5a3ef49a3c3d1ae670ac97 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.CharProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class CharProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "char"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "char", 25 | "system.char" 26 | }; 27 | } 28 | 29 | public override char Parse(string value) 30 | { 31 | return char.Parse(value); 32 | } 33 | 34 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 35 | string value) 36 | { 37 | binaryWriter.Write(Parse(value)); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.CharProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37f1181bc8fb29742b06ec3f42f652b4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Color32Processor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | using UnityEngine; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class Color32Processor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => false; 18 | 19 | public override string LanguageKeyword => "Color32"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "color32", 26 | "unityengine.color32" 27 | }; 28 | } 29 | 30 | public override Color32 Parse(string value) 31 | { 32 | var splitedValue = value.Split(','); 33 | return new Color32(byte.Parse(splitedValue[0]), byte.Parse(splitedValue[1]), 34 | byte.Parse(splitedValue[2]), byte.Parse(splitedValue[3])); 35 | } 36 | 37 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 38 | string value) 39 | { 40 | var color32 = Parse(value); 41 | binaryWriter.Write(color32.r); 42 | binaryWriter.Write(color32.g); 43 | binaryWriter.Write(color32.b); 44 | binaryWriter.Write(color32.a); 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Color32Processor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a9b916d7c8e446439b74c27340be473 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ColorProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | using UnityEngine; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class ColorProcessor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => false; 18 | 19 | public override string LanguageKeyword => "Color"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "color", 26 | "unityengine.color" 27 | }; 28 | } 29 | 30 | public override Color Parse(string value) 31 | { 32 | var splitedValue = value.Split(','); 33 | return new Color(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), 34 | float.Parse(splitedValue[2]), float.Parse(splitedValue[3])); 35 | } 36 | 37 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 38 | string value) 39 | { 40 | var color = Parse(value); 41 | binaryWriter.Write(color.r); 42 | binaryWriter.Write(color.g); 43 | binaryWriter.Write(color.b); 44 | binaryWriter.Write(color.a); 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ColorProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4583af9902c99a4fad14d732796117e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.CommentProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System; 9 | using System.IO; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class CommentProcessor : DataProcessor 16 | { 17 | public override Type Type => null; 18 | 19 | public override bool IsId => false; 20 | public override bool IsEnum => false; 21 | 22 | public override bool IsComment => true; 23 | 24 | public override bool IsSystem => false; 25 | 26 | public override string LanguageKeyword => null; 27 | 28 | public override string[] GetTypeStrings() 29 | { 30 | return new[] 31 | { 32 | string.Empty, 33 | "#", 34 | "comment" 35 | }; 36 | } 37 | 38 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 39 | string value) 40 | { 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.CommentProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ece238877c1e9344a50ce47697a93ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DataProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System; 9 | using System.IO; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | public abstract class DataProcessor 16 | { 17 | public abstract Type Type { get; } 18 | 19 | public abstract bool IsId { get; } 20 | 21 | public abstract bool IsComment { get; } 22 | 23 | public abstract bool IsSystem { get; } 24 | public abstract bool IsEnum { get; } 25 | 26 | public abstract string LanguageKeyword { get; } 27 | 28 | public abstract string[] GetTypeStrings(); 29 | 30 | public abstract void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 31 | string value); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DataProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccc7c992b5573ae4fafd0d5706bdad48 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DataProcessorUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7fb0bd2c9734a139f6ddc0250c07431 3 | timeCreated: 1590473178 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DateTimeProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System; 9 | using System.IO; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class DateTimeProcessor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => true; 18 | 19 | public override string LanguageKeyword => "DateTime"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "datetime", 26 | "system.datetime" 27 | }; 28 | } 29 | 30 | public override DateTime Parse(string value) 31 | { 32 | return DateTime.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write(Parse(value).Ticks); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DateTimeProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4223bbe977dd5244a8611c6aad7f693e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DecimalProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class DecimalProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "decimal"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "decimal", 25 | "system.decimal" 26 | }; 27 | } 28 | 29 | public override decimal Parse(string value) 30 | { 31 | return decimal.Parse(value); 32 | } 33 | 34 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 35 | string value) 36 | { 37 | binaryWriter.Write(Parse(value)); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DecimalProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad6d6ba18487f7643830e156d300ee75 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DictionaryProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e4a88d470ae4735b5d7e1b1297103d4 3 | timeCreated: 1590854508 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DoubleProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class DoubleProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "double"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "double", 25 | "system.double" 26 | }; 27 | } 28 | 29 | public override double Parse(string value) 30 | { 31 | return double.Parse(value); 32 | } 33 | 34 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 35 | string value) 36 | { 37 | binaryWriter.Write(Parse(value)); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.DoubleProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44293fe0c3e108248bc98e8674238aed 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.EnumProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 822eb281891645d5bd0d831f8d9f5d02 3 | timeCreated: 1601029194 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.EscapeStringMap.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace DE.Editor.DataTableTools 4 | { 5 | 6 | public partial class DataTableProcessor 7 | { 8 | /// 9 | /// 常用转义字符串转换表 10 | /// 11 | private static readonly Dictionary m_EscapeStrings = new Dictionary() 12 | { 13 | {"\\a","\a"}, 14 | {"\\b","\b"}, 15 | {"\\f","\f"}, 16 | {"\\n","\n"}, 17 | {"\\r","\r"}, 18 | {"\\t","\t"}, 19 | {"\\v","\v"}, 20 | }; 21 | } 22 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.EscapeStringMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9a17d859b7c4c0b96d43e307ab45070 3 | timeCreated: 1632129780 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Excel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13dd8495e41f4504b8c80752ed426928 3 | timeCreated: 1631937057 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.FloatProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class FloatProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "float"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "float", 25 | "single", 26 | "system.single" 27 | }; 28 | } 29 | 30 | public override float Parse(string value) 31 | { 32 | return float.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.FloatProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c1502c70e1294543b14df45c7841a73 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.GenericDataProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | public abstract class GenericDataProcessor : DataProcessor 15 | { 16 | public override Type Type => typeof(T); 17 | 18 | public override bool IsId => false; 19 | 20 | public override bool IsComment => false; 21 | public override bool IsEnum => false; 22 | 23 | public abstract T Parse(string value); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.GenericDataProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 65dd2cb98d350654fb3df2ddfc4fa4b8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ICollectionProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DE.Editor.DataTableTools 4 | { 5 | public sealed partial class DataTableProcessor 6 | { 7 | public interface ICollectionProcessor 8 | { 9 | Type ItemType { get; } 10 | 11 | string ItemLanguageKeyword { get; } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ICollectionProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53b6824100304aaaa662e13157deba9a 3 | timeCreated: 1590756403 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.IDictionaryProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DE.Editor.DataTableTools 4 | { 5 | public sealed partial class DataTableProcessor 6 | { 7 | public interface IDictionaryProcessor 8 | { 9 | Type KeyType { get; } 10 | Type ValueType { get; } 11 | string KeyLanguageKeyword { get; } 12 | string ValueLanguageKeyword { get; } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.IDictionaryProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6480892060ec40e9b9110db067f6448f 3 | timeCreated: 1590858800 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.IdProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System; 9 | using System.IO; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class IdProcessor : DataProcessor 16 | { 17 | public override Type Type => typeof(int); 18 | 19 | public override bool IsId => true; 20 | public override bool IsEnum => false; 21 | 22 | public override bool IsComment => false; 23 | 24 | public override bool IsSystem => false; 25 | 26 | public override string LanguageKeyword => "int"; 27 | 28 | public override string[] GetTypeStrings() 29 | { 30 | return new[] 31 | { 32 | "id" 33 | }; 34 | } 35 | 36 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 37 | string value) 38 | { 39 | binaryWriter.Write7BitEncodedInt32(int.Parse(value)); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.IdProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4171c2dabb4ee9468f7297ab334ddf1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.IntProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class IntProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "int"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "int", 25 | "int32", 26 | "system.int32" 27 | }; 28 | } 29 | 30 | public override int Parse(string value) 31 | { 32 | return int.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write7BitEncodedInt32(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.IntProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 239560231c239b54f95c183913ec9cbf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ListProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edd450a14544407ab126368ea1db7035 3 | timeCreated: 1590467890 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.LongProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class LongProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "long"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "long", 25 | "int64", 26 | "system.int64" 27 | }; 28 | } 29 | 30 | public override long Parse(string value) 31 | { 32 | return long.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write7BitEncodedInt64(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.LongProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6dadc699adc6744e898979b1e85d6cf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.QuaternionProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | using UnityEngine; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class QuaternionProcessor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => false; 18 | 19 | public override string LanguageKeyword => "Quaternion"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "quaternion", 26 | "unityengine.quaternion" 27 | }; 28 | } 29 | 30 | public override Quaternion Parse(string value) 31 | { 32 | var splitedValue = value.Split(','); 33 | return new Quaternion(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), 34 | float.Parse(splitedValue[2]), float.Parse(splitedValue[3])); 35 | } 36 | 37 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 38 | string value) 39 | { 40 | var quaternion = Parse(value); 41 | binaryWriter.Write(quaternion.x); 42 | binaryWriter.Write(quaternion.y); 43 | binaryWriter.Write(quaternion.z); 44 | binaryWriter.Write(quaternion.w); 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.QuaternionProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c288505f764c21149b9986dd3ebff1ac 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.RectProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | using UnityEngine; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class RectProcessor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => false; 18 | 19 | public override string LanguageKeyword => "Rect"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "rect", 26 | "unityengine.rect" 27 | }; 28 | } 29 | 30 | public override Rect Parse(string value) 31 | { 32 | var splitedValue = value.Split(','); 33 | return new Rect(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), 34 | float.Parse(splitedValue[2]), float.Parse(splitedValue[3])); 35 | } 36 | 37 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 38 | string value) 39 | { 40 | var rect = Parse(value); 41 | binaryWriter.Write(rect.x); 42 | binaryWriter.Write(rect.y); 43 | binaryWriter.Write(rect.width); 44 | binaryWriter.Write(rect.height); 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.RectProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 235589b35d4744a4d8ef100da517e0ce 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.SByteProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class SByteProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "sbyte"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "sbyte", 25 | "system.sbyte" 26 | }; 27 | } 28 | 29 | public override sbyte Parse(string value) 30 | { 31 | return sbyte.Parse(value); 32 | } 33 | 34 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 35 | string value) 36 | { 37 | binaryWriter.Write(Parse(value)); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.SByteProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49f8d16f80f1ec046bfcae38be8c96a7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ShortProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class ShortProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "short"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "short", 25 | "int16", 26 | "system.int16" 27 | }; 28 | } 29 | 30 | public override short Parse(string value) 31 | { 32 | return short.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ShortProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1e3b1767ca81c343a31324956e5f032 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.StringProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | using System.Linq; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class StringProcessor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => true; 18 | 19 | public override string LanguageKeyword => "string"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "string", 26 | "system.string" 27 | }; 28 | } 29 | 30 | public override string Parse(string value) 31 | { 32 | return m_EscapeStrings.Aggregate(value, (current, escapeString) => current.Replace(escapeString.Key, escapeString.Value)); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.StringProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d502b9a1939b46246bd8e4c107b77744 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.UIntProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class UIntProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "uint"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "uint", 25 | "uint32", 26 | "system.uint32" 27 | }; 28 | } 29 | 30 | public override uint Parse(string value) 31 | { 32 | return uint.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write7BitEncodedUInt32(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.UIntProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd3c289549d93924ea928ea558436a57 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ULongProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class ULongProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "ulong"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "ulong", 25 | "uint64", 26 | "system.uint64" 27 | }; 28 | } 29 | 30 | public override ulong Parse(string value) 31 | { 32 | return ulong.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write7BitEncodedUInt64(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.ULongProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23d841306167268488c7c5a8bb8cf685 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.UShortProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | 10 | namespace DE.Editor.DataTableTools 11 | { 12 | public sealed partial class DataTableProcessor 13 | { 14 | private sealed class UShortProcessor : GenericDataProcessor 15 | { 16 | public override bool IsSystem => true; 17 | 18 | public override string LanguageKeyword => "ushort"; 19 | 20 | public override string[] GetTypeStrings() 21 | { 22 | return new[] 23 | { 24 | "ushort", 25 | "uint16", 26 | "system.uint16" 27 | }; 28 | } 29 | 30 | public override ushort Parse(string value) 31 | { 32 | return ushort.Parse(value); 33 | } 34 | 35 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 36 | string value) 37 | { 38 | binaryWriter.Write(Parse(value)); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.UShortProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20f758534f1981b4593f97deb2a5ae25 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Vector2Processor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | using UnityEngine; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class Vector2Processor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => false; 18 | 19 | public override string LanguageKeyword => "Vector2"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "vector2", 26 | "unityengine.vector2" 27 | }; 28 | } 29 | 30 | public override Vector2 Parse(string value) 31 | { 32 | var splitedValue = value.Split(','); 33 | return new Vector2(float.Parse(splitedValue[0]), float.Parse(splitedValue[1])); 34 | } 35 | 36 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 37 | string value) 38 | { 39 | var vector2 = Parse(value); 40 | binaryWriter.Write(vector2.x); 41 | binaryWriter.Write(vector2.y); 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Vector2Processor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 165df2a7d4a52984282f1c3bc87d5aaa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Vector3Processor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | using UnityEngine; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class Vector3Processor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => false; 18 | 19 | public override string LanguageKeyword => "Vector3"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "vector3", 26 | "unityengine.vector3" 27 | }; 28 | } 29 | 30 | public override Vector3 Parse(string value) 31 | { 32 | var splitedValue = value.Split(','); 33 | return new Vector3(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), 34 | float.Parse(splitedValue[2])); 35 | } 36 | 37 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 38 | string value) 39 | { 40 | var vector3 = Parse(value); 41 | binaryWriter.Write(vector3.x); 42 | binaryWriter.Write(vector3.y); 43 | binaryWriter.Write(vector3.z); 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Vector3Processor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d45ef71d28b25f047ab0f4d4acac8b42 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Vector4Processor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Game Framework 3 | // Copyright © 2013-2020 Jiang Yin. All rights reserved. 4 | // Homepage: https://gameframework.cn/ 5 | // Feedback: mailto:ellan@gameframework.cn 6 | //------------------------------------------------------------ 7 | 8 | using System.IO; 9 | using UnityEngine; 10 | 11 | namespace DE.Editor.DataTableTools 12 | { 13 | public sealed partial class DataTableProcessor 14 | { 15 | private sealed class Vector4Processor : GenericDataProcessor 16 | { 17 | public override bool IsSystem => false; 18 | 19 | public override string LanguageKeyword => "Vector4"; 20 | 21 | public override string[] GetTypeStrings() 22 | { 23 | return new[] 24 | { 25 | "vector4", 26 | "unityengine.vector4" 27 | }; 28 | } 29 | 30 | public override Vector4 Parse(string value) 31 | { 32 | var splitedValue = value.Split(','); 33 | return new Vector4(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), 34 | float.Parse(splitedValue[2]), float.Parse(splitedValue[3])); 35 | } 36 | 37 | public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, 38 | string value) 39 | { 40 | var vector4 = Parse(value); 41 | binaryWriter.Write(vector4.x); 42 | binaryWriter.Write(vector4.y); 43 | binaryWriter.Write(vector4.z); 44 | binaryWriter.Write(vector4.w); 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.Vector4Processor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40409bde40a898b48af91126d343c4ae 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/DataTableGenerator/DataTableProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81b27209918096743b988ea62b39d109 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9122b95720b06ef46b2b51de25694920 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus/EPPlus.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FingerCaster/UGFExtensions/bb815bbce0a971601509a0732bc7a5ad824c7cca/Assets/Extensions/DataTableExtension/Editor/EPPlus/EPPlus.dll -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus/EPPlus.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d7cc1faaf97b0e4893f72bf0567e3f2 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 1 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus/EPPlus.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eed8b752a92a988449f0b7519127b717 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus/Microsoft.IO.RecyclableMemoryStream.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FingerCaster/UGFExtensions/bb815bbce0a971601509a0732bc7a5ad824c7cca/Assets/Extensions/DataTableExtension/Editor/EPPlus/Microsoft.IO.RecyclableMemoryStream.dll -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus/Microsoft.IO.RecyclableMemoryStream.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28ca6e4bdb3d10f4ca588a8852783728 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 1 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus/Microsoft.IO.RecyclableMemoryStream.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f88c6a810a785da43885904116320641 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus/System.ComponentModel.Annotations.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FingerCaster/UGFExtensions/bb815bbce0a971601509a0732bc7a5ad824c7cca/Assets/Extensions/DataTableExtension/Editor/EPPlus/System.ComponentModel.Annotations.dll -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/EPPlus/System.ComponentModel.Annotations.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56300036e94f60e49879da674f30c382 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 1 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f231aa40f034894fa714545882f8dfe 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/DataTableConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0261ba9f4be469c81ea6adc28e08dc9 3 | timeCreated: 1662453813 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/DataTableProcessorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using GameFramework; 5 | using JetBrains.Annotations; 6 | 7 | namespace DE.Editor 8 | { 9 | public static class DataTableProcessorExtensions 10 | { 11 | 12 | 13 | /// 14 | /// 判断指定的类型 是否是指定泛型类型的子类型,或实现了指定泛型接口。 15 | /// 16 | /// 需要测试的类型。 17 | /// 泛型接口类型,传入 typeof(IXxx<>) 18 | /// 如果是泛型接口的子类型,则返回 true,否则返回 false。 19 | public static bool HasImplementedRawGeneric([NotNull] this Type type, [NotNull] Type generic) 20 | { 21 | if (type == null) throw new ArgumentNullException(nameof(type)); 22 | if (generic == null) throw new ArgumentNullException(nameof(generic)); 23 | 24 | // 测试接口。 25 | var isTheRawGenericType = type.GetInterfaces().Any(IsTheRawGenericType); 26 | if (isTheRawGenericType) return true; 27 | 28 | // 测试类型。 29 | while (type != null && type != typeof(object)) 30 | { 31 | isTheRawGenericType = IsTheRawGenericType(type); 32 | if (isTheRawGenericType) return true; 33 | type = type.BaseType; 34 | } 35 | 36 | // 没有找到任何匹配的接口或类型。 37 | return false; 38 | 39 | // 测试某个类型是否是指定的原始接口。 40 | bool IsTheRawGenericType(Type test) 41 | { 42 | return generic == (test.IsGenericType ? test.GetGenericTypeDefinition() : test); 43 | } 44 | } 45 | 46 | 47 | public static string GetFullNameWithNotDot(Type type) 48 | { 49 | return type.FullName?.Replace(".",""); 50 | } 51 | public static string GetFullNameWithNotDot(string fullName) 52 | { 53 | return fullName?.Replace(".",""); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/DataTableProcessorExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da8b0f3b9e744d0eb9f15a0338b1cc75 3 | timeCreated: 1618299184 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/ExcelExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a91955a9786f42f4ca407735b67d3814 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/ExtensionsGenerate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 111bbdeb0f844f91838d6a5bb11be040 3 | timeCreated: 1590568676 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/PermutationAndCombination.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6927a5047fc94aff881ee32ef35cb308 3 | timeCreated: 1590856527 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/UnityInternalBridge.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66965c12c77d4eb798f07ffa8f63dc51 3 | timeCreated: 1625669370 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/UnityInternalBridge/ReorderableList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac1625b1a77c4100af0ad7dce3929ca2 3 | timeCreated: 1625666929 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/UnityInternalBridge/Unity.InternalAPIEngineBridge.006.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unity.InternalAPIEngineBridge.006", 3 | "references": [], 4 | "optionalUnityReferences": [], 5 | "includePlatforms": [ 6 | "Editor" 7 | ], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [] 14 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Extensions/UnityInternalBridge/Unity.InternalAPIEngineBridge.006.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb5e63ff1afc8f84994de25a00489fbc 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Resource.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0359f52dfffebdb4a9f34a7375cb56a7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Resource/DataTableCodeTemplate.txt: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // 此文件由工具自动生成,请勿直接修改。 3 | // 生成时间:__DATA_TABLE_CREATE_TIME__ 4 | //------------------------------------------------------------ 5 | 6 | using GameFramework; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.IO; 10 | using System.Text; 11 | using UnityEngine; 12 | using UnityGameFramework.Runtime; 13 | __DATA_TABLE_PROPERTIES_NAMESPACE__ 14 | 15 | namespace __DATA_TABLE_NAME_SPACE__ 16 | { 17 | /// 18 | /// __DATA_TABLE_COMMENT__ 19 | /// 20 | public class __DATA_TABLE_CLASS_NAME__ : DataRowBase 21 | { 22 | private int m_Id = 0; 23 | 24 | /// 25 | /// __DATA_TABLE_ID_COMMENT__ 26 | /// 27 | public override int Id 28 | { 29 | get 30 | { 31 | return m_Id; 32 | } 33 | } 34 | 35 | __DATA_TABLE_PROPERTIES__ 36 | 37 | __DATA_TABLE_PARSER__ 38 | 39 | __DATA_TABLE_PROPERTY_ARRAY__ 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Resource/DataTableCodeTemplate.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0c38abcdb787b944a57be016d3f100b 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Resource/DataTableConfig.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: a0261ba9f4be469c81ea6adc28e08dc9, type: 3} 13 | m_Name: DataTableConfig 14 | m_EditorClassIdentifier: 15 | DataTableFolderPath: Assets/Res/DataTables 16 | ExcelsFolder: Assets/../Excels/ 17 | CSharpCodePath: Assets/Extensions/DataTableExtension/Runtime/DataTable 18 | CSharpCodeTemplateFileName: Assets/Extensions/DataTableExtension/Editor/Resource/DataTableCodeTemplate.txt 19 | ExtensionDirectoryPath: Assets/Extensions/DataTableExtension/Runtime/Extensions 20 | NameSpace: UGFExtensions 21 | AssemblyNames: 22 | - Assembly-CSharp 23 | EditorAssemblyNames: 24 | - UnityGameFramework.Editor 25 | - DE.Editor 26 | - Assembly-CSharp-Editor 27 | NameRow: 1 28 | TypeRow: 2 29 | CommentRow: 3 30 | ContentStartRow: 4 31 | IdColumn: 1 32 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Resource/DataTableConfig.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6afef364f4b6e914892e29adef9aabb8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Resource/DataTableTemplate.txt: -------------------------------------------------------------------------------- 1 | # 测试表格生成 2 | # Id 3 | # int 4 | # 编号 备注 5 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Editor/Resource/DataTableTemplate.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e9064630e7cc114e81d7c48cf202ca4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4247794cd77600f43b58fc0c3869d5cc 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04c6eff50ade70447aefcc5bb31e186d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/DataTable.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 186d68aab18d36943a081f22ff769159 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/DataTable/GitKeep.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FingerCaster/UGFExtensions/bb815bbce0a971601509a0732bc7a5ad824c7cca/Assets/Extensions/DataTableExtension/Runtime/DataTable/GitKeep.gitkeep -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/DataTable/GitKeep.gitkeep.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 038005e4db7c90e49be791fa22bbb54a 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad4cfe1e9565c2c4488794a0f2515360 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/Extensions/BinaryReaderExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1fcc480dea8901419651fae27fbf776 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/Extensions/DataTableExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c601e845617cfe64c8d3d436c1b3f042 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/Helper.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 47268f1786254c08866ed8fde6e44c3c 3 | timeCreated: 1632153089 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/Helper/DataTableHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05f99dd0035745b99bfc694fc8400f62 3 | timeCreated: 1632153118 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7709774020443458e10ebd22984d9c6 3 | timeCreated: 1632632471 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53574c15bffa43f2b3e7373d37447552 3 | timeCreated: 1649498115 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/CustomVirtualFileSystemDataProvider.cs: -------------------------------------------------------------------------------- 1 | using GameFramework.FileSystem; 2 | using UnityGameFramework.Runtime; 3 | 4 | namespace UGFExtensions 5 | { 6 | /// 7 | /// 自定义虚拟文件系统数据提供(mergeAsset扩展合并的vfs文件 或者自行合并的vfs文件) 8 | /// 9 | public class CustomVirtualFileSystemDataProvider : IDataProvider 10 | { 11 | private string m_FilePath = null; 12 | private string m_AssetPath = null; 13 | private bool m_IsCached = false; 14 | private IFileSystem m_FileSystem = null; 15 | private FileSystemComponent m_FileSystemComponent; 16 | public CustomVirtualFileSystemDataProvider(FileSystemComponent fileSystemComponent,string filePath, string assetPath, bool isCached) 17 | { 18 | m_FileSystemComponent = fileSystemComponent; 19 | m_FilePath = filePath; 20 | m_AssetPath = assetPath; 21 | m_IsCached = isCached; 22 | } 23 | 24 | private IFileSystem GetOrCreateFileSystem() 25 | { 26 | if (m_FileSystem != null) 27 | { 28 | return m_FileSystem; 29 | } 30 | 31 | var fileSystem = m_FileSystemComponent.LoadFileSystem(m_FilePath, FileSystemAccess.Read); 32 | if (m_IsCached) 33 | { 34 | m_FileSystem = fileSystem; 35 | } 36 | 37 | return m_FileSystem; 38 | } 39 | 40 | public long ReadFileSegment(int offset, ref byte[] buffer, int startIndex, int length) 41 | { 42 | var fileSystem = GetOrCreateFileSystem(); 43 | DataProviderUtility.EnsureBufferSize(startIndex+length, ref buffer); 44 | var realLength = fileSystem.ReadFileSegment(m_AssetPath,offset,buffer, startIndex, length); 45 | if (!m_IsCached) 46 | { 47 | m_FileSystemComponent.DestroyFileSystem(fileSystem,false); 48 | } 49 | 50 | return realLength; 51 | } 52 | 53 | public void Dispose() 54 | { 55 | m_FilePath = null; 56 | m_AssetPath = null; 57 | m_IsCached = false; 58 | m_FileSystemComponent.DestroyFileSystem(m_FileSystem,false); 59 | m_FileSystemComponent = null; 60 | m_FileSystem = null; 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/CustomVirtualFileSystemDataProvider.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a9364b778bb4f1687955ead42dc43b6 3 | timeCreated: 1649498228 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/DataProviderUtility.cs: -------------------------------------------------------------------------------- 1 | namespace UGFExtensions 2 | { 3 | public static class DataProviderUtility 4 | { 5 | /// 6 | /// 保证缓存大小 7 | /// 8 | /// 数据大小 9 | /// 缓存 10 | public static void EnsureBufferSize(int count,ref byte[] buffer) 11 | { 12 | int length = buffer.Length; 13 | while (length < count) 14 | { 15 | length *= 2; 16 | } 17 | 18 | if (length != buffer.Length) 19 | { 20 | buffer = new byte[length]; 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/DataProviderUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9727e6f7af8a4a3081d3603e4bc2b6a9 3 | timeCreated: 1649497204 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/FileStreamProvider.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace UGFExtensions 4 | { 5 | /// 6 | /// 文件流数据提供 7 | /// 8 | public class FileStreamProvider : IDataProvider 9 | { 10 | private IFileStream m_FileStream = null; 11 | private string m_FilePath = null; 12 | private bool m_IsCached = false; 13 | 14 | public FileStreamProvider(string filePath, bool isCached) 15 | { 16 | m_FilePath = filePath; 17 | m_IsCached = isCached; 18 | } 19 | 20 | private IFileStream GetOrCreateFileSystem() 21 | { 22 | if (m_FileStream != null) 23 | { 24 | return m_FileStream; 25 | } 26 | 27 | var fileStream = FileStreamHelper.CreateFileStream(m_FilePath); 28 | if (m_IsCached) 29 | { 30 | m_FileStream = fileStream; 31 | } 32 | 33 | return fileStream; 34 | } 35 | 36 | public long ReadFileSegment(int offset, ref byte[] buffer, int startIndex, int length) 37 | { 38 | var fileStream = GetOrCreateFileSystem(); 39 | fileStream.Seek(offset, SeekOrigin.Begin); 40 | DataProviderUtility.EnsureBufferSize(startIndex+length, ref buffer); 41 | var realLength = fileStream.Read(buffer, 0, length); 42 | if (!m_IsCached) 43 | { 44 | fileStream.Dispose(); 45 | } 46 | 47 | return realLength; 48 | } 49 | 50 | public void Dispose() 51 | { 52 | m_FileStream?.Dispose(); 53 | m_FilePath = null; 54 | m_IsCached = false; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/FileStreamProvider.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f71a91a7133249feb239c06781d397a7 3 | timeCreated: 1649498130 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/IDataProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GameFramework.FileSystem; 3 | 4 | namespace UGFExtensions 5 | { 6 | public interface IDataProvider : IDisposable 7 | { 8 | /// 9 | /// 读取文件的片段。 10 | /// 11 | /// 要读取片段的偏移。 12 | /// 存储读取二进制资源片段内容的二进制流。 13 | /// 存储读取二进制资源片段内容的二进制流的起始位置。 14 | /// 要读取片段的长度。 15 | /// 实际加载了多少字节。 16 | long ReadFileSegment(int offset, ref byte[] buffer, int startIndex, int length); 17 | } 18 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/IDataProvider.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82d36da14ec34ddb961c0daaeddd7f96 3 | timeCreated: 1649496800 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/VirualFileSystemProvider.cs: -------------------------------------------------------------------------------- 1 | using UnityGameFramework.Runtime; 2 | 3 | namespace UGFExtensions 4 | { 5 | /// 6 | /// 虚拟文件系统数据提供方(打包设置FileSystem 系统合并文件) 7 | /// 8 | public class VirtualFileSystemDataProvider : IDataProvider 9 | { 10 | private string m_AssetPath = null; 11 | private static ResourceComponent m_ResourceComponent; 12 | public VirtualFileSystemDataProvider(ResourceComponent resourceComponent,string assetPath) 13 | { 14 | m_ResourceComponent = resourceComponent; 15 | m_AssetPath = assetPath; 16 | } 17 | 18 | public void Dispose() 19 | { 20 | m_AssetPath = null; 21 | m_ResourceComponent = null; 22 | } 23 | 24 | public long ReadFileSegment(int offset, ref byte[] buffer, int startIndex, int length) 25 | { 26 | DataProviderUtility.EnsureBufferSize(startIndex+length, ref buffer); 27 | return m_ResourceComponent.LoadBinarySegmentFromFileSystem(m_AssetPath,offset, buffer, startIndex, length); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataProvider/VirualFileSystemProvider.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91aa0cd5619f46b99f45198054be179a 3 | timeCreated: 1649498168 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataTableExtensionComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5c9de7fd6404c6fac943297e066ec27 3 | timeCreated: 1632549441 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataTableRowConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c66c8d7aac84fbfb65e02d9bac09d81 3 | timeCreated: 1632632124 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataTableRowSetting.cs: -------------------------------------------------------------------------------- 1 | namespace UGFExtensions 2 | { 3 | /// 4 | /// 数据表行设置 5 | /// 6 | public class DataTableRowSetting 7 | { 8 | public DataTableRowSetting(int startIndex, int length) 9 | { 10 | StartIndex = startIndex; 11 | Length = length; 12 | } 13 | 14 | /// 15 | /// 起始位置 16 | /// 17 | public int StartIndex { get; } 18 | 19 | /// 20 | /// 长度 21 | /// 22 | public int Length { get; } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/DataTableRowSetting.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aff0c5ebbcb54491824283ad4be0160f 3 | timeCreated: 1632469568 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/FileStream.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d125e64cd2e64e62b54ed4a87205e941 3 | timeCreated: 1649496609 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/FileStream/AndroidFileStream.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b8e0225dafd431584a5eb5b58526159 3 | timeCreated: 1632715061 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/FileStream/CommonFileStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace UGFExtensions 4 | { 5 | public class CommonFileStream : IFileStream 6 | { 7 | private FileStream m_FileStream; 8 | private CommonFileStream() 9 | { 10 | 11 | } 12 | 13 | public static CommonFileStream Create(string filePath) 14 | { 15 | CommonFileStream commonFileStream = new CommonFileStream(); 16 | commonFileStream.m_FileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); 17 | return commonFileStream; 18 | } 19 | 20 | public void Seek(long offset, SeekOrigin seekOrigin) 21 | { 22 | m_FileStream.Seek(offset, SeekOrigin.Begin); 23 | } 24 | 25 | public long Read(byte[] buffer, int offset, int count) 26 | { 27 | return m_FileStream.Read(buffer, offset, count); 28 | } 29 | 30 | // public long Position { 31 | // get => m_FileStream.Position; 32 | // set => m_FileStream.Seek(value, SeekOrigin.Begin); 33 | // } 34 | 35 | public void Dispose() 36 | { 37 | m_FileStream.Dispose(); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/FileStream/CommonFileStream.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 690f94d13fae445784f986b20102231c 3 | timeCreated: 1632714474 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/FileStream/FileStreamHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace UGFExtensions 5 | { 6 | public static class FileStreamHelper 7 | { 8 | private const string AndroidFileSystemPrefixString = "jar:"; 9 | 10 | /// 11 | /// 创建文件流。 12 | /// 13 | /// 要加载的文件系统的完整路径。 14 | /// 创建的文件流。 15 | public static IFileStream CreateFileStream(string fullPath) 16 | { 17 | if (fullPath.StartsWith(AndroidFileSystemPrefixString, StringComparison.Ordinal)) 18 | { 19 | return AndroidFileStream.Create(fullPath); 20 | } 21 | else 22 | { 23 | return CommonFileStream.Create(fullPath); 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/FileStream/FileStreamHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 67a4883977df4cc19ccdc78fbad700c7 3 | timeCreated: 1632716404 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/FileStream/IFileStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace UGFExtensions 5 | { 6 | public interface IFileStream : IDisposable 7 | { 8 | // long Position { get;set; } 9 | void Seek(long offset, SeekOrigin seekOrigin); 10 | long Read(byte[] buffer, int offset, int count); 11 | } 12 | } -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/FileStream/IFileStream.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bbd9083883d48909c9a62c6d90b2a19 3 | timeCreated: 1632713452 -------------------------------------------------------------------------------- /Assets/Extensions/DataTableExtension/Runtime/LoadRowExtension/TypeNamePair.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 327bddff2ab840699f47a1a5e0ec2074 3 | timeCreated: 1633938284 -------------------------------------------------------------------------------- /Assets/Extensions/EditorExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0543c896a2be4dfd85b5d2fb58d6152c 3 | timeCreated: 1680408864 -------------------------------------------------------------------------------- /Assets/Extensions/EditorExtension/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa3ad84bdbd14ecbb381f6ed18d631d0 3 | timeCreated: 1680408871 -------------------------------------------------------------------------------- /Assets/Extensions/EditorExtension/Editor/EditorLogRedirect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c29d87c58c8668d4fa5f92f05448ce16 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56635b31e334477fa86a7c82b2a1b98f 3 | timeCreated: 1649309037 -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c652c3eb5f9549d9bb099f3cd8a8c588 3 | timeCreated: 1649309045 -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor/AssetData.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UGFExtensions 4 | { 5 | /// 6 | /// 文件数据 7 | /// 8 | [System.Serializable] 9 | public class AssetData 10 | { 11 | [SerializeField] private string m_AssetName; 12 | [SerializeField] private string m_AssetPath; 13 | [SerializeField] private Object m_Asset; 14 | [SerializeField] private AssetType m_AssetType; 15 | 16 | public AssetType AssetType 17 | { 18 | get => m_AssetType; 19 | set => m_AssetType = value; 20 | } 21 | 22 | public Object Asset 23 | { 24 | get => m_Asset; 25 | set => m_Asset = value; 26 | } 27 | 28 | public string AssetName 29 | { 30 | get => m_AssetName; 31 | set => m_AssetName = value; 32 | } 33 | 34 | public string AssetPath 35 | { 36 | get => m_AssetPath; 37 | set => m_AssetPath = value; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor/AssetData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdf3cd2ef2f643aa8d31680ed0aead9e 3 | timeCreated: 1649383230 -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor/AssetType.cs: -------------------------------------------------------------------------------- 1 | namespace UGFExtensions 2 | { 3 | public enum AssetType 4 | { 5 | None, 6 | Text, 7 | Folder, 8 | } 9 | } -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor/AssetType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 886be34bab78432db4a7bdad5d32fc0e 3 | timeCreated: 1649390502 -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor/MergeAssetScriptableObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace UGFExtensions 6 | { 7 | public class MergeAssetScriptableObject : ScriptableObject 8 | { 9 | [SerializeField] 10 | private MergeAssetEditorData m_MergeAssetEditorData; 11 | public MergeAssetEditorData MergeAssetEditorData 12 | { 13 | get => m_MergeAssetEditorData; 14 | set => m_MergeAssetEditorData = value; 15 | } 16 | } 17 | [Serializable] 18 | public class MergeAssetEditorData 19 | { 20 | [SerializeField] 21 | private string m_SearchPatterns = string.Empty; // 多个类型需要使用';', ',', '|'分割 txt,bytes 22 | [SerializeField] 23 | private List m_AssetDataList = new List(); 24 | [SerializeField] 25 | private string m_FileSystemName= string.Empty; 26 | [SerializeField] 27 | private string m_FileSystemFolder= string.Empty; 28 | 29 | public string SearchPatterns 30 | { 31 | get => m_SearchPatterns; 32 | set => m_SearchPatterns = value; 33 | } 34 | 35 | public List AssetDataList 36 | { 37 | get => m_AssetDataList; 38 | set => m_AssetDataList = value; 39 | } 40 | 41 | public string FileSystemName 42 | { 43 | get => m_FileSystemName; 44 | set => m_FileSystemName = value; 45 | } 46 | 47 | public string FileSystemFolder 48 | { 49 | get => m_FileSystemFolder; 50 | set => m_FileSystemFolder = value; 51 | } 52 | 53 | 54 | } 55 | } -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor/MergeAssetScriptableObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd1e1f28a8a74bb89a9de5ede5b9caae 3 | timeCreated: 1649383288 -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor/MergeAssetToVFSWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5303e59d08864f70b334220fe748d515 3 | timeCreated: 1649309089 -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/Editor/MergeAssetUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae9908236e8647cfb2b1d1f8b79ea1ad 3 | timeCreated: 1649390184 -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/README.md: -------------------------------------------------------------------------------- 1 | # MergeFileTOVFS 2 | 合并文件到虚拟文件系统 的一个编辑器工具 3 | 4 | ## 使用方式 5 | ![image](https://tvax2.sinaimg.cn/large/e1b1a94bgy1h1kvsvivspj20fo06xwez.jpg) 6 | 7 | ObjectForPacking : 需要打包合并的文件 支持拖放 文件或文件夹。 8 | 9 | SearchPatterns : 搜索模式。 根据后缀匹配 支持通过 `(,;|)`分割 例如`bytes,txt` 10 | 11 | FileSystemFolder : 存储VFS文件的文件夹地址 12 | 13 | FileSystemName: 虚拟文件系统名称 14 | 15 | Merge:合并 16 | 17 | Save: 保存设置到一个ScriptableObject中 之后可以通过ScriptableObject 配置合并 18 | 19 | 代码设置 : `MergeAssetUtility.Merge` 方法 传入数据 合并。 20 | 21 | 22 | ## 扩展 23 | **PS:当前只支持对TextAsset资源进行合并 其他资源可以自行扩展。** 24 | 25 | 扩展其他资源需要新增`AssetType` 并实现 `MergeAssetUtility.GetAssetType` `MergeAssetUtility.Asset2Bytes` 中新增类型的处理 26 | -------------------------------------------------------------------------------- /Assets/Extensions/MergeFileToVFSExtension/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a30827c81de2f914e9405f1f4bbd8e26 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/ResourceRuleExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3b6ee81fba98e44fa5ac3f1b904b570 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/ResourceRuleExtension/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90d2f23f640687145865e8782cc3b526 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/ResourceRuleExtension/Editor/ResourceRuleEditor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98ba961dde293f94faf4855a90f92c28 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/ResourceRuleExtension/Editor/ResourceRuleEditor/ResourceRuleEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 357727fb078f9eb49b5b9ef135d4e4d8 3 | timeCreated: 1505217637 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Extensions/ResourceRuleExtension/Editor/ResourceRuleEditor/ResourceRuleEditorData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.Serialization; 4 | using UnityGameFramework.Editor.ResourceTools; 5 | 6 | namespace UGFExtensions.Editor.ResourceTools 7 | { 8 | public class ResourceRuleEditorData : ScriptableObject 9 | { 10 | public List rules = new List(); 11 | } 12 | 13 | [System.Serializable] 14 | public class ResourceRule 15 | { 16 | public bool valid = true; 17 | public string name = string.Empty; 18 | public string variant = null; 19 | public string fileSystem = string.Empty; 20 | public string groups = string.Empty; 21 | public string assetsDirectoryPath = string.Empty; 22 | public LoadType loadType = LoadType.LoadFromFile; 23 | public bool packed = true; 24 | public ResourceFilterType filterType = ResourceFilterType.Root; 25 | public string searchPatterns = "*.*"; 26 | } 27 | 28 | public enum ResourceFilterType 29 | { 30 | Root, 31 | Children, 32 | ChildrenFoldersOnly, 33 | ChildrenFilesOnly, 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/Extensions/ResourceRuleExtension/Editor/ResourceRuleEditor/ResourceRuleEditorData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50ad2d721b5da424096e85539f9ff262 3 | timeCreated: 1505983325 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Extensions/ResourceRuleExtension/Editor/ResourceRuleEditor/ResourceRuleEditorUtility.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UGFExtensions.Editor.ResourceTools 4 | { 5 | public static class ResourceRuleEditorUtility 6 | { 7 | public static void RefreshResourceCollection() 8 | { 9 | ResourceRuleEditor ruleEditor = ScriptableObject.CreateInstance(); 10 | ruleEditor.RefreshResourceCollection(); 11 | } 12 | public static void RefreshResourceCollection(string configPath) 13 | { 14 | ResourceRuleEditor ruleEditor = ScriptableObject.CreateInstance(); 15 | ruleEditor.RefreshResourceCollection(configPath); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Assets/Extensions/ResourceRuleExtension/Editor/ResourceRuleEditor/ResourceRuleEditorUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dda02e0fc8760b9419aaef59bf884ecc 3 | timeCreated: 1646032356 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 312ac6d4f98c4446bb83db282aa3793c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1678e0b70d5b4b1e96647a9d114187d9 3 | timeCreated: 1629096643 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/BuildEventHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff32f4f536824eb49b3d3fa5b569bc82 3 | timeCreated: 1629103240 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/InitializeOnLoad.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | 4 | namespace UGFExtensions.SpriteCollection 5 | { 6 | [InitializeOnLoadAttribute] 7 | public static class InitializeOnLoad 8 | { 9 | static InitializeOnLoad() 10 | { 11 | EditorApplication.playModeStateChanged += LogPlayModeState; 12 | } 13 | 14 | private static void LogPlayModeState(PlayModeStateChange obj) 15 | { 16 | switch (obj) 17 | { 18 | case PlayModeStateChange.EnteredEditMode: 19 | break; 20 | case PlayModeStateChange.ExitingEditMode: 21 | SpriteCollectionUtility.RefreshSpriteCollection(); 22 | break; 23 | case PlayModeStateChange.EnteredPlayMode: 24 | break; 25 | case PlayModeStateChange.ExitingPlayMode: 26 | break; 27 | default: 28 | throw new ArgumentOutOfRangeException(nameof(obj), obj, null); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/InitializeOnLoad.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9188d92840184005a3e89ea61152c2b8 3 | timeCreated: 1629102549 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/PreprocessBuildHandle.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor.Build; 2 | using UnityEditor.Build.Reporting; 3 | 4 | namespace UGFExtensions.SpriteCollection 5 | { 6 | public class PreprocessBuildHandle: IPreprocessBuildWithReport 7 | { 8 | public int callbackOrder => 0; 9 | 10 | public void OnPreprocessBuild(BuildReport report) 11 | { 12 | SpriteCollectionUtility.RefreshSpriteCollection(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/PreprocessBuildHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee80b2011c2c4d6d98754859d7bb5bab 3 | timeCreated: 1629096638 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/SpriteCollectionComponentEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 10fe8bffa1f540cf9c02b8429ac214e5 3 | timeCreated: 1629348414 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/SpriteCollectionEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0278efb48974a9642aa07c42b6eba640 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/SpriteCollectionUtility.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | 3 | namespace UGFExtensions.SpriteCollection 4 | { 5 | public static class SpriteCollectionUtility 6 | { 7 | public static void RefreshSpriteCollection() 8 | { 9 | string[] guids = AssetDatabase.FindAssets("t:SpriteCollection"); 10 | foreach (var guid in guids) 11 | { 12 | string path = AssetDatabase.GUIDToAssetPath(guid); 13 | SpriteCollection collection = AssetDatabase.LoadAssetAtPath(path); 14 | collection.Pack(); 15 | } 16 | 17 | AssetDatabase.SaveAssets(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/Editor/SpriteCollectionUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9fef75a65c5444dae24b35d352ffc16 3 | timeCreated: 1629102600 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/ISetSpriteObject.cs: -------------------------------------------------------------------------------- 1 | using GameFramework; 2 | using UnityEngine; 3 | 4 | namespace UGFExtensions.SpriteCollection 5 | { 6 | public interface ISetSpriteObject: IReference 7 | { 8 | /// 9 | /// 精灵名称 10 | /// 11 | string SpritePath { get;} 12 | /// 13 | /// 精灵所在收集器地址 14 | /// 15 | string CollectionPath { get;} 16 | /// 17 | /// 设置精灵 18 | /// 19 | void SetSprite(Sprite sprite); 20 | /// 21 | /// 是否可以回收 22 | /// 23 | bool IsCanRelease(); 24 | #if !ODIN_INSPECTOR && UNITY_EDITOR 25 | Rect DrawSetSpriteObject(Rect rect); 26 | #endif 27 | } 28 | } -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/ISetSpriteObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99d44d2f77ed4e6f9f776150794d4699 3 | timeCreated: 1629267763 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/README.md: -------------------------------------------------------------------------------- 1 | # SpriteCollectionExtension 2 | 3 | 收集Sprite 扩展Sprite 加载卸载 管理 4 | 5 | 当一个图片为Sprite时 打包时 会存在Texture2d 和 sprite 6 | 7 | 当GF 加载资源时 如果以Texture2D格式先加载了 这个图片 那么 如果动态加载此Sprite 会因为缓存中他是Texture2D 导致加载失败。反之亦然。 8 | 9 | 针对这个问题 写了这个扩展 收集需要加载的Sprite 生成一个SpriteCollection 加载Sprite时 通过SpriteCollention 获取Sprite 10 | 11 | 12 | 13 | **PS: 如果使用了SpriteAtlas图集 那么不会出现此问题 (打包时不会存在原图 只有sprite 和图集大图)** 14 | 15 | ​ **本扩展中用到了 Timer 和Await 扩展 如果只使用此扩展可以自行替换** 16 | 17 | ​ **编辑器部分使用原生编辑器 和 odin 两套实现 可以自行导入Odin 切换** 18 | 19 | 20 | 21 | # 使用方法 22 | 23 | ## SpriteCollection 使用方法 24 | 25 | 1. Project界面右键 `UGFExtensions/SpriteCollection`创建SpriteCollection 26 | 2. SpriteCollect 支持 单个Sprite multiple类型的图片 文件夹 SpriteAtlas 直接拖到`Objects` 上即可 27 | 3. `PackPreview` 可以立即添加Sprite 到 SpriteCollection的字典中。 如果不点击 会在(打包,打AB包,编辑器进入播放状态)自动进行添加 Ps: 打ab包预处理 只针对UGF 通过BuildEventHandle 的接口进行处理 28 | 29 | ## SpriteCollection 的加载 卸载 30 | 31 | SpriteCollection 的加载 卸载 通过[SpriteCollectionComponent](./SpriteCollectionComponent.cs) 进行控制。用户无需手动管理。 32 | 33 | `SpriteCollectionComponent ` 中 `m_AutoReleaseInterval` 用于配置自动释放时间间隔 默认60s回收一次 可以自行在检视面板调整 34 | 35 | ## Sprite 加载 36 | 37 | 加载Sprite 通过 `SpriteCollectionComponent` 的`SetSprite`方法 38 | 39 | ``` csharp 40 | public async void SetSprite(ISetSpriteObject setSpriteObject) 41 | ``` 42 | 43 | ```csharp 44 | public interface ISetSpriteObject 45 | { 46 | /// 47 | /// 精灵名称 48 | /// 49 | string SpritePath { get;} 50 | /// 51 | /// 精灵所在收集器地址 52 | /// 53 | string CollectionPath { get;} 54 | /// 55 | /// 设置精灵 56 | /// 57 | void SetSprite(Sprite sprite); 58 | /// 59 | /// 是否可以回收 60 | /// 61 | bool IsCanRelease(); 62 | } 63 | ``` 64 | 65 | `SetSprite` 需要提供一个 实现了`ISetSpriteObject` 接口的对象。 66 | 67 | `WaitSetImage` 为针对Image 进行的包装 如果需要使用其他类型 加载Sprite 可参照其 进行拓展 68 | 69 | `SetSpriteExtensions` 脚本 提供了Image 的扩展方法`SetSprite` 70 | 71 | 加载Sprite : 72 | 73 | ```csharp 74 | image.SetSprite("Assets/xxxx/xxx.asset","Assets/xxxx/xxxx/xxxx.png"); 75 | ``` 76 | 77 | 其中参数` collectionPath` `spritePath` 均为Assets下全路径 `spritePath` 可以参照`SpriteCollection` 中字典的key 如果只是单独sprite ,key既是 sprite的路径 如果是multiple 类型图片 key是 图片路径+分割成小图的名字。 78 | 79 | -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b79a1fdab22f6f643b136768cae51a2e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/ScriptCollectionComponent.LoadSpriteObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | #if ODIN_INSPECTOR 4 | using Sirenix.OdinInspector; 5 | #endif 6 | 7 | namespace UGFExtensions.SpriteCollection 8 | { 9 | public partial class SpriteCollectionComponent 10 | { 11 | [Serializable] 12 | public class LoadSpriteObject 13 | { 14 | #if ODIN_INSPECTOR 15 | [ShowInInspector] 16 | #endif 17 | public ISetSpriteObject SpriteObject { get; } 18 | #if ODIN_INSPECTOR 19 | [ShowInInspector] 20 | #endif 21 | public SpriteCollection Collection { get; } 22 | #if UNITY_EDITOR 23 | public bool IsSelect { get; set; } 24 | #endif 25 | 26 | public LoadSpriteObject(ISetSpriteObject obj, SpriteCollection collection) 27 | { 28 | SpriteObject = obj; 29 | Collection = collection; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/ScriptCollectionComponent.LoadSpriteObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 635a0894b0ce4f71b86ab007f5adf034 3 | timeCreated: 1629267856 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SetSpriteExtensions.Await.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UI; 3 | using UnityGameFramework.Runtime; 4 | 5 | namespace UGFExtensions.SpriteCollection 6 | { 7 | public static partial class SetSpriteExtensions 8 | { 9 | /// 10 | /// 设置精灵 11 | /// 12 | /// 13 | /// 精灵所在收集器地址 14 | /// 精灵名称 15 | public static void SetSpriteAsync(this Image image, string collectionPath, string spritePath) 16 | { 17 | GameEntry.GetComponent().SetSpriteAsync(WaitSetImage.Create(image,collectionPath,spritePath)); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SetSpriteExtensions.Await.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d320fda7b734f44adc5e144d96205c1 3 | timeCreated: 1638259842 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SetSpriteExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UI; 2 | using UnityGameFramework.Runtime; 3 | 4 | namespace UGFExtensions.SpriteCollection 5 | { 6 | public static partial class SetSpriteExtensions 7 | { 8 | /// 9 | /// 设置精灵 10 | /// 11 | /// 12 | /// 精灵所在收集器地址 13 | /// 精灵名称 14 | public static void SetSprite(this Image image, string collectionPath, string spritePath) 15 | { 16 | GameEntry.GetComponent().SetSprite(WaitSetImage.Create(image,collectionPath,spritePath)); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SetSpriteExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2f4942e62c84749b50ecd8aa6014353 3 | timeCreated: 1629267890 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SpriteCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d326122dba59474fa04d550e63ada33b 3 | timeCreated: 1629079880 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SpriteCollectionComponent.Resource.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7f94d6758774ef4b8acdcf2895a0a6a 3 | timeCreated: 1638254410 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SpriteCollectionComponent.ResourceAwait.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55fb40a24f2e46b48ea930353d06c1f9 3 | timeCreated: 1638254453 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SpriteCollectionComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1acd8f9411104171af77c152b8de0dc4 3 | timeCreated: 1629105180 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SpriteCollectionItemObject.cs: -------------------------------------------------------------------------------- 1 | using GameFramework; 2 | using GameFramework.ObjectPool; 3 | using UnityGameFramework.Runtime; 4 | 5 | namespace UGFExtensions.SpriteCollection 6 | { 7 | public class SpriteCollectionItemObject : ObjectBase 8 | { 9 | private ResourceComponent m_ResourceComponent; 10 | 11 | public static SpriteCollectionItemObject Create(string collectionPath ,SpriteCollection target,ResourceComponent resourceComponent) 12 | { 13 | SpriteCollectionItemObject item = ReferencePool.Acquire(); 14 | item.Initialize(collectionPath, target); 15 | item.m_ResourceComponent = resourceComponent; 16 | return item; 17 | } 18 | protected override void Release(bool isShutdown) 19 | { 20 | SpriteCollection spriteCollection = (SpriteCollection) Target; 21 | if (spriteCollection == null) 22 | { 23 | return; 24 | } 25 | m_ResourceComponent.UnloadAsset(spriteCollection); 26 | m_ResourceComponent = null; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/SpriteCollectionItemObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6884f2c1c0304c379f2aa1c1c378c75f 3 | timeCreated: 1629105219 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/StringSpriteDictionary.cs: -------------------------------------------------------------------------------- 1 | #if !ODIN_INSPECTOR 2 | using System; 3 | using UnityEngine; 4 | 5 | namespace UGFExtensions 6 | { 7 | [Serializable] 8 | public class StringSpriteDictionary : SerializableDictionary {} 9 | } 10 | #endif -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/StringSpriteDictionary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b30b8127b584317a29e3e7f19ecbc93 3 | timeCreated: 1629016866 -------------------------------------------------------------------------------- /Assets/Extensions/SpriteCollectionExtension/WaitSetImage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1212492b52024e1bbdf66c00a138082d 3 | timeCreated: 1629267773 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d17bcf5e1227bd4589b0ce21e35cdb3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f9d7b01285e4a598d390245d1a550a3 3 | timeCreated: 1631183687 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/Editor/TextureSetComponentEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94ffab5f64914f699370fafbad8a897e 3 | timeCreated: 1631183178 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/ISetTexture2dObject.cs: -------------------------------------------------------------------------------- 1 | using GameFramework; 2 | using UnityEngine; 3 | 4 | namespace UGFExtensions.Texture 5 | { 6 | public interface ISetTexture2dObject : IReference 7 | { 8 | /// 9 | /// 图片文件地址 10 | /// 11 | string Texture2dFilePath { get; } 12 | 13 | /// 14 | /// 设置图片 15 | /// 16 | void SetTexture(Texture2D texture); 17 | 18 | /// 19 | /// 是否可以回收 20 | /// 21 | bool IsCanRelease(); 22 | #if !ODIN_INSPECTOR && UNITY_EDITOR 23 | Rect DrawSetTextureObject(Rect rect); 24 | #endif 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/ISetTexture2dObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f85d4e40990a4791b6479ec174ec58a1 3 | timeCreated: 1631174991 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/README.md: -------------------------------------------------------------------------------- 1 | # TextureExtension 2 | 3 | 加载图片的扩展 (文件系统,网络上,资源系统) 4 | 5 | # 本系统的作用 6 | 7 | 1. 文件系统的作用 8 | 9 | [文件系统 | Game Framework](https://gameframework.cn/document/filesystem/) 10 | 11 | 2. 加载扩展的作用 12 | 13 | 方便的加载功能。 14 | 15 | 提供自动卸载机制,上层无需操心。 16 | 17 | # 使用教程 18 | 19 | ## TextureSetComponent设置 20 | 21 | `m_FileSystemMaxFileLength` 文件系统最大文件数量 默认为64 可以自行预估设置一个恰当的值,如果文件数超过最大数量 会扩容为当前的两倍。 22 | 23 | `m_InitBufferLength` 通过文件系统加载图片的缓存,用于消除GC。默认64k(1024*64) 如果加载文件大小超过 BufferLength 会扩容为当前的两倍。 24 | 25 | `m_CheckCanReleaseInterval` 配置检查可以释放对象的时间间隔 默认30s检查一次 可以自行在检视面板调整 26 | 27 | `m_AutoReleaseInterval` 用于配置对象池自动释放时间间隔 默认60s回收一次 可以自行在检视面板调整 28 | 29 | `m_CheckCanReleaseInterval`和`m_AutoReleaseInterval` 配合使用 检查到可回收对象会调用对象池 回收。 对象池到达释放时间会自动清理。 30 | ## Texture 的加载 与卸载 31 | 32 | 加载Texture 通过 `TextureSetComponent` 的`SetTextureByFileSystem` `SetTextureByNetwork` `SetTextureByResources`方法 33 | 34 | `SetTexture` 三个方法都需要提供一个 实现了`ISetTexture2dObject` 接口的对象。 35 | 36 | 当前扩展中实现了对`RawImage`的扩展 提供RawImage的扩展方法 37 | 38 | 加载Texture 39 | 40 | ```csharp 41 | rawImage.SetTextureByFileSystem("TestTexture.png"); 42 | rawImage.SetTextureByNetwork("http://xxx/xxx.png","TestTexture.png");//第二个参数是将网络图片保存到文件系统中的地址。可以不填写。 43 | rawImage.SetTextureByResources("Assets/Res/TestTexture.png"); 44 | ``` 45 | 46 | 卸载Texture由扩展组件卸载。不需要用户手动控制。 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd435b645a694fb4b2adeed70d0ddbb7 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/ResourceData.cs: -------------------------------------------------------------------------------- 1 | using GameFramework; 2 | 3 | namespace UGFExtensions.Texture 4 | { 5 | public class ResourceData : IReference 6 | { 7 | public static ResourceData Create(ISetTexture2dObject setTexture2dObject, int serialId) 8 | { 9 | ResourceData resourceData = ReferencePool.Acquire(); 10 | resourceData.m_SetTexture2dObject = setTexture2dObject; 11 | resourceData.m_SerialId = serialId; 12 | return resourceData; 13 | } 14 | 15 | private ISetTexture2dObject m_SetTexture2dObject; 16 | private int m_SerialId; 17 | 18 | public ISetTexture2dObject SetTexture2dObject => m_SetTexture2dObject; 19 | 20 | public int SerialId => m_SerialId; 21 | 22 | 23 | public void Clear() 24 | { 25 | m_SetTexture2dObject = null; 26 | m_SerialId = -1; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/ResourceData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 287e4e7f21604cbe8d7f505b01347f28 3 | timeCreated: 1660289470 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/SetRawImage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GameFramework; 3 | 4 | #if UNITY_EDITOR 5 | using UnityEditor; 6 | #endif 7 | #if ODIN_INSPECTOR 8 | using Sirenix.OdinInspector; 9 | #endif 10 | using UnityEngine; 11 | using UnityEngine.UI; 12 | 13 | namespace UGFExtensions.Texture 14 | { 15 | [Serializable] 16 | public class SetRawImage : ISetTexture2dObject 17 | { 18 | #if ODIN_INSPECTOR 19 | [ShowInInspector] 20 | #endif 21 | private RawImage m_RawImage; 22 | #if ODIN_INSPECTOR 23 | [ShowInInspector] 24 | #endif 25 | private Texture2D Texture2D { get; set; } 26 | #if ODIN_INSPECTOR 27 | [ShowInInspector] 28 | #endif 29 | public string Texture2dFilePath { get; private set; } 30 | 31 | public void SetTexture(Texture2D texture) 32 | { 33 | m_RawImage.texture = texture; 34 | Texture2D = texture; 35 | } 36 | 37 | public bool IsCanRelease() 38 | { 39 | return m_RawImage == null || m_RawImage.texture == null || m_RawImage.texture != Texture2D; 40 | } 41 | 42 | public static SetRawImage Create(RawImage rawImage, string filePath) 43 | { 44 | SetRawImage item = ReferencePool.Acquire(); 45 | item.m_RawImage = rawImage; 46 | item.Texture2dFilePath = filePath; 47 | return item; 48 | } 49 | 50 | public void Clear() 51 | { 52 | m_RawImage = null; 53 | Texture2D = null; 54 | Texture2dFilePath = null; 55 | } 56 | 57 | #if !ODIN_INSPECTOR && UNITY_EDITOR 58 | public Rect DrawSetTextureObject(Rect rect) 59 | { 60 | EditorGUI.ObjectField(rect, "RawImage", m_RawImage, typeof(RawImage), true); 61 | rect.y += EditorGUIUtility.singleLineHeight; 62 | 63 | EditorGUI.TextField(rect, "Texture2dFilePath", Texture2dFilePath); 64 | rect.y += EditorGUIUtility.singleLineHeight; 65 | 66 | EditorGUI.ObjectField(rect, "Texture", Texture2D, typeof(Texture2D), false); 67 | rect.y += EditorGUIUtility.singleLineHeight; 68 | 69 | EditorGUI.Toggle(rect, "IsCanRelease", IsCanRelease()); 70 | return rect; 71 | } 72 | #endif 73 | } 74 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/SetRawImage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 226dbc6bdc3d4ebdaa128a0e61935a9b 3 | timeCreated: 1631174998 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/SetTextureExtensions.Await.cs: -------------------------------------------------------------------------------- 1 | using ET; 2 | using UnityEngine.UI; 3 | using UnityGameFramework.Runtime; 4 | 5 | namespace UGFExtensions.Texture 6 | { 7 | public static partial class SetTextureExtensions 8 | { 9 | public static void SetTextureByNetworkAsync(this RawImage rawImage, string file, string saveFilePath = null,ETCancellationToken cancellationToken =null) 10 | { 11 | GameEntry.GetComponent().SetTextureByNetworkAsync(SetRawImage.Create(rawImage, file), saveFilePath,cancellationToken); 12 | } 13 | 14 | public static void SetTextureByResourcesAsync(this RawImage rawImage, string file,ETCancellationToken cancellationToken = null) 15 | { 16 | GameEntry.GetComponent().SetTextureByResourcesAsync(SetRawImage.Create(rawImage, file),cancellationToken); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/SetTextureExtensions.Await.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c49faf4684b34ef79b6dc3872be1e31f 3 | timeCreated: 1637721925 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/SetTextureExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UI; 2 | using UnityGameFramework.Runtime; 3 | 4 | namespace UGFExtensions.Texture 5 | { 6 | /// 7 | /// 设置图片扩展 8 | /// 9 | public static partial class SetTextureExtensions 10 | { 11 | public static void SetTextureByFileSystem(this RawImage rawImage, string file) 12 | { 13 | GameEntry.GetComponent().SetTextureByFileSystem(SetRawImage.Create(rawImage, file)); 14 | } 15 | 16 | public static int SetTextureByNetwork(this RawImage rawImage, string file, string saveFilePath = null) 17 | { 18 | return GameEntry.GetComponent().SetTextureByNetwork(SetRawImage.Create(rawImage, file), saveFilePath); 19 | } 20 | 21 | public static int SetTextureByResources(this RawImage rawImage, string file) 22 | { 23 | return GameEntry.GetComponent().SetTextureByResources(SetRawImage.Create(rawImage, file)); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/SetTextureExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55af936c34084344874e415a08d50e07 3 | timeCreated: 1631176525 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureItemObject.cs: -------------------------------------------------------------------------------- 1 | using GameFramework; 2 | using GameFramework.ObjectPool; 3 | using UnityEngine; 4 | using UnityGameFramework.Runtime; 5 | 6 | namespace UGFExtensions.Texture 7 | { 8 | public class TextureItemObject : ObjectBase 9 | { 10 | private TextureLoad m_TextureLoad; 11 | private ResourceComponent m_ResourceComponent; 12 | public static TextureItemObject Create(string collectionPath, UnityEngine.Texture target,TextureLoad textureLoad,ResourceComponent resourceComponent = null) 13 | { 14 | TextureItemObject item = ReferencePool.Acquire(); 15 | item.Initialize(collectionPath, target); 16 | item.m_TextureLoad = textureLoad; 17 | item.m_ResourceComponent = resourceComponent; 18 | return item; 19 | } 20 | 21 | protected override void Release(bool isShutdown) 22 | { 23 | UnityEngine.Texture texture = (UnityEngine.Texture)Target; 24 | if (texture == null) 25 | { 26 | return; 27 | } 28 | 29 | switch (m_TextureLoad) 30 | { 31 | case TextureLoad.FromResource: 32 | m_ResourceComponent.UnloadAsset(texture); 33 | m_ResourceComponent = null; 34 | break; 35 | case TextureLoad.FromNet: 36 | case TextureLoad.FromFileSystem: 37 | Object.Destroy(texture); 38 | break; 39 | } 40 | } 41 | } 42 | 43 | 44 | public enum TextureLoad 45 | { 46 | /// 47 | /// 从文件系统 48 | /// 49 | FromFileSystem, 50 | /// 51 | /// 从网络 52 | /// 53 | FromNet, 54 | /// 55 | /// 从资源包 56 | /// 57 | FromResource 58 | } 59 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureItemObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bd0e0eda6c4499bbe0a2119e766c605 3 | timeCreated: 1631174984 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.FileSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4646e5de863c43f0b56ccbdbba35b633 3 | timeCreated: 1637719836 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.LoadTextureObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GameFramework; 3 | #if ODIN_INSPECTOR 4 | using Sirenix.OdinInspector; 5 | #endif 6 | using UnityEngine; 7 | 8 | namespace UGFExtensions.Texture 9 | { 10 | public partial class TextureSetComponent 11 | { 12 | [Serializable] 13 | public class LoadTextureObject : IReference 14 | { 15 | #if ODIN_INSPECTOR 16 | [ShowInInspector] 17 | #endif 18 | public ISetTexture2dObject Texture2dObject { get; private set;} 19 | #if ODIN_INSPECTOR 20 | [ShowInInspector] 21 | #endif 22 | public Texture2D Texture2D { get; private set; } 23 | #if UNITY_EDITOR 24 | public bool IsSelect { get; set; } 25 | #endif 26 | private LoadTextureObject(ISetTexture2dObject obj,Texture2D texture2D) 27 | { 28 | Texture2dObject = obj; 29 | Texture2D = texture2D; 30 | } 31 | 32 | public LoadTextureObject() 33 | { 34 | } 35 | 36 | public static LoadTextureObject Create(ISetTexture2dObject obj, Texture2D texture2D) 37 | { 38 | var loadTextureObject = ReferencePool.Acquire(); 39 | loadTextureObject.Texture2dObject = obj; 40 | loadTextureObject.Texture2D = texture2D; 41 | return loadTextureObject; 42 | } 43 | 44 | public void Clear() 45 | { 46 | Texture2dObject = null; 47 | Texture2D = null; 48 | } 49 | } 50 | 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.LoadTextureObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cfa8ebb6a2fa4362b27e202da4e2c3b1 3 | timeCreated: 1631159967 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.NetWork.Await.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ET; 3 | using UGFExtensions.Await; 4 | using UnityEngine; 5 | 6 | namespace UGFExtensions.Texture 7 | { 8 | public partial class TextureSetComponent 9 | { 10 | /// 11 | /// 通过网络设置图片 12 | /// 13 | /// 需要设置图片的对象 14 | /// 保存网络图片到本地的路径 15 | public async void SetTextureByNetworkAsync(ISetTexture2dObject setTexture2dObject,string saveFilePath = null, ETCancellationToken etCancellationToken = null) 16 | { 17 | int serialId = -1; 18 | 19 | Texture2D texture = null; 20 | if (m_TexturePool.CanSpawn(setTexture2dObject.Texture2dFilePath)) 21 | { 22 | texture = (Texture2D)m_TexturePool.Spawn(setTexture2dObject.Texture2dFilePath).Target; 23 | } 24 | else 25 | { 26 | serialId = m_SerialId++; 27 | 28 | void Cancel() 29 | { 30 | CancelSetTexture(serialId); 31 | } 32 | 33 | try 34 | { 35 | etCancellationToken?.Add(Cancel); 36 | var data = await m_WebRequestComponent.AddWebRequestAsync(setTexture2dObject.Texture2dFilePath); 37 | if (!data.IsError) 38 | { 39 | texture = new Texture2D(0, 0, TextureFormat.RGBA32, false); 40 | texture.LoadImage(data.Bytes); 41 | if (!string.IsNullOrEmpty(saveFilePath)) 42 | { 43 | SaveTexture(saveFilePath, data.Bytes); 44 | } 45 | 46 | m_TexturePool.Register( 47 | TextureItemObject.Create(setTexture2dObject.Texture2dFilePath, texture, 48 | TextureLoad.FromNet), true); 49 | } 50 | } 51 | finally 52 | { 53 | etCancellationToken?.Remove(Cancel); 54 | } 55 | 56 | } 57 | 58 | SetTexture(setTexture2dObject, texture,serialId); 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.NetWork.Await.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5929e5fc96fe4979a029c75a15d4e704 3 | timeCreated: 1637720221 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.NetWork.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b121c77933c543a797464bbd07e41b2d 3 | timeCreated: 1637719869 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.Resource.Await.cs: -------------------------------------------------------------------------------- 1 | using ET; 2 | using UGFExtensions.Await; 3 | using UnityEngine; 4 | 5 | namespace UGFExtensions.Texture 6 | { 7 | public partial class TextureSetComponent 8 | { 9 | /// 10 | /// 通过资源系统设置图片 11 | /// 12 | /// 需要设置图片的对象 13 | public async void SetTextureByResourcesAsync(ISetTexture2dObject setTexture2dObject,ETCancellationToken cancellationToken = null) 14 | { 15 | Texture2D texture; 16 | int serialId = -1; 17 | if (m_TexturePool.CanSpawn(setTexture2dObject.Texture2dFilePath)) 18 | { 19 | texture = (Texture2D)m_TexturePool.Spawn(setTexture2dObject.Texture2dFilePath).Target; 20 | } 21 | else 22 | { 23 | serialId = m_SerialId++; 24 | void Cancel() 25 | { 26 | CancelSetTexture(serialId); 27 | } 28 | 29 | try 30 | { 31 | cancellationToken?.Add(Cancel); 32 | texture = await m_ResourceComponent.LoadAssetAsync(setTexture2dObject.Texture2dFilePath); 33 | if (!m_TexturePool.CanSpawn(setTexture2dObject.Texture2dFilePath)) 34 | { 35 | m_TexturePool.Register( 36 | TextureItemObject.Create(setTexture2dObject.Texture2dFilePath, texture, 37 | TextureLoad.FromResource, m_ResourceComponent), true); 38 | } 39 | else 40 | { 41 | m_TexturePool.Spawn(setTexture2dObject.Texture2dFilePath); 42 | } 43 | } 44 | finally 45 | { 46 | cancellationToken?.Remove(Cancel); 47 | } 48 | } 49 | 50 | SetTexture(setTexture2dObject, texture,serialId); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.Resource.Await.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d893159fefb4bd2bccb458a715dac7d 3 | timeCreated: 1637720231 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.Resource.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4090193840c547d7aea5460a683f572e 3 | timeCreated: 1637719884 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/TextureSetComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7ee647bae594d45864b3af677f21947 3 | timeCreated: 1630997439 -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/WebGetTextureData.cs: -------------------------------------------------------------------------------- 1 | using GameFramework; 2 | 3 | namespace UGFExtensions.Texture 4 | { 5 | public class WebGetTextureData : IReference 6 | { 7 | private ISetTexture2dObject m_SetTexture2dObject; 8 | private TextureSetComponent m_UserData; 9 | private string m_FilePath; 10 | private int m_SerialId; 11 | 12 | public ISetTexture2dObject SetTexture2dObject => m_SetTexture2dObject; 13 | public TextureSetComponent UserData => m_UserData; 14 | public string FilePath => m_FilePath; 15 | 16 | public int SerialId => m_SerialId; 17 | public static WebGetTextureData Create(ISetTexture2dObject setTexture2dObject, TextureSetComponent userData,string filePath,int serialId) 18 | { 19 | WebGetTextureData webGetTextureData = ReferencePool.Acquire(); 20 | webGetTextureData.m_SetTexture2dObject = setTexture2dObject; 21 | webGetTextureData.m_UserData = userData; 22 | webGetTextureData.m_FilePath = filePath; 23 | webGetTextureData.m_SerialId = serialId; 24 | return webGetTextureData; 25 | } 26 | 27 | public void Clear() 28 | { 29 | m_SetTexture2dObject = null; 30 | m_UserData = null; 31 | m_FilePath = null; 32 | m_SerialId = -1; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Assets/Extensions/TextureExtension/WebGetTextureData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4b406f1042c4e38aa3f12ba96e53dd9 3 | timeCreated: 1637676759 -------------------------------------------------------------------------------- /Assets/Extensions/TimerExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66c3b4d7f2c745e3b18b97645677946a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Extensions/TimerExtension/MultiMap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace UGFExtensions.Timer 5 | { 6 | public class MultiMap: SortedDictionary> 7 | { 8 | private readonly List m_Empty = new List(); 9 | 10 | public void Add(T t, K k) 11 | { 12 | TryGetValue(t, out var list); 13 | if (list == null) 14 | { 15 | list = new List(); 16 | Add(t, list); 17 | } 18 | list.Add(k); 19 | } 20 | 21 | public bool Remove(T t, K k) 22 | { 23 | TryGetValue(t, out var list); 24 | if (list == null) 25 | { 26 | return false; 27 | } 28 | if (!list.Remove(k)) 29 | { 30 | return false; 31 | } 32 | if (list.Count == 0) 33 | { 34 | Remove(t); 35 | } 36 | return true; 37 | } 38 | 39 | /// 40 | /// 不返回内部的list,copy一份出来 41 | /// 42 | /// 43 | /// 44 | public K[] GetAll(T t) 45 | { 46 | TryGetValue(t, out var list); 47 | if (list == null) 48 | { 49 | return Array.Empty(); 50 | } 51 | return list.ToArray(); 52 | } 53 | 54 | /// 55 | /// 返回内部的list 56 | /// 57 | /// 58 | /// 59 | public new List this[T t] 60 | { 61 | get 62 | { 63 | TryGetValue(t, out List list); 64 | return list ?? m_Empty; 65 | } 66 | } 67 | 68 | public K GetOne(T t) 69 | { 70 | TryGetValue(t, out var list); 71 | if (list != null && list.Count > 0) 72 | { 73 | return list[0]; 74 | } 75 | return default; 76 | } 77 | 78 | public bool Contains(T t, K k) 79 | { 80 | TryGetValue(t, out var list); 81 | if (list == null) 82 | { 83 | return false; 84 | } 85 | return list.Contains(k); 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimerExtension/MultiMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cb4adaee71e8044ca5dd0362077e83e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/TimerExtension/README.md: -------------------------------------------------------------------------------- 1 | # TimerExtension 2 | 3 | 为提供UGF提供一个定时器 定时器是 [ET](https://github.com/egametang/ET) 中的定时器 改造而来 增删了部分功能 4 | 5 | # 文件说明 6 | 7 | - CancellationToken ---- 取消令牌 8 | - MultiMap ---- 一个有序的 存放多个值的Map 基于SortedDictionary 9 | - TimerComponent ---- 定时器组件 10 | - TimerTimeUtility ---- 定时器时间工具 基于Utc时间 11 | 12 | # 使用说明 13 | 14 | Timer 延时时间以毫秒计时 15 | 16 | 添加一个一秒后执行的定时器 17 | 18 | ```csharp 19 | AddOnceTimer(1000,()=>{Debug.Log("After a second")}) 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /Assets/Extensions/TimerExtension/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d66aee03627e42698b218768e78a7847 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/TimerExtension/TimerComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7703380ef9b7a946b4870e2e05dcb8f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/TimerExtension/TimerTimeUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UGFExtensions.Timer 4 | { 5 | public static class TimerTimeUtility 6 | { 7 | private static readonly long Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks; 8 | /// 9 | /// 当前时间 10 | /// 11 | /// 12 | public static long Now() 13 | { 14 | return (DateTime.UtcNow.Ticks - Epoch) / 10000; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimerExtension/TimerTimeUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61180511f8aa1874cbdb859991d3f30c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 947302c3304d430ebfa82dd202fe33be 3 | timeCreated: 1648525260 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ed078158a1c404e9a8b9ace2751ba4f 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/AsyncETTaskCompletedMethodBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Runtime.CompilerServices; 4 | using System.Security; 5 | 6 | namespace ET 7 | { 8 | public struct AsyncETTaskCompletedMethodBuilder 9 | { 10 | // 1. Static Create method. 11 | [DebuggerHidden] 12 | public static AsyncETTaskCompletedMethodBuilder Create() 13 | { 14 | AsyncETTaskCompletedMethodBuilder builder = new AsyncETTaskCompletedMethodBuilder(); 15 | return builder; 16 | } 17 | 18 | // 2. TaskLike Task property(void) 19 | public ETTaskCompleted Task => default; 20 | 21 | // 3. SetException 22 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 23 | [DebuggerHidden] 24 | public void SetException(Exception exception) 25 | { 26 | Console.WriteLine(exception); 27 | } 28 | 29 | // 4. SetResult 30 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 31 | [DebuggerHidden] 32 | public void SetResult() 33 | { 34 | // do nothing 35 | } 36 | 37 | // 5. AwaitOnCompleted 38 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 39 | [DebuggerHidden] 40 | public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine 41 | { 42 | awaiter.OnCompleted(stateMachine.MoveNext); 43 | } 44 | 45 | // 6. AwaitUnsafeOnCompleted 46 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 47 | [DebuggerHidden] 48 | [SecuritySafeCritical] 49 | public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine 50 | { 51 | awaiter.UnsafeOnCompleted(stateMachine.MoveNext); 52 | } 53 | 54 | // 7. Start 55 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 56 | [DebuggerHidden] 57 | public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine 58 | { 59 | stateMachine.MoveNext(); 60 | } 61 | 62 | // 8. SetStateMachine 63 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 64 | [DebuggerHidden] 65 | public void SetStateMachine(IAsyncStateMachine stateMachine) 66 | { 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/AsyncETTaskCompletedMethodBuilder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c5c10a5227e4e8483a9fa4a0b10085f 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/AsyncETTaskMethodBuilder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63bf2667eec44e6780a53d6b04b04795 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/AsyncETVoidMethodBuilder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a8d8db8abdd463594e6c5e3473da181 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/AsyncMethodBuilderAttribute.cs: -------------------------------------------------------------------------------- 1 | #if !UNITY_2021_1_OR_NEWER 2 | namespace System.Runtime.CompilerServices 3 | { 4 | public sealed class AsyncMethodBuilderAttribute: Attribute 5 | { 6 | public Type BuilderType 7 | { 8 | get; 9 | } 10 | 11 | public AsyncMethodBuilderAttribute(Type builderType) 12 | { 13 | BuilderType = builderType; 14 | } 15 | } 16 | } 17 | #endif -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/AsyncMethodBuilderAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 256d549ce6384c5088ab00a59aa82434 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/ETCancellationToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ET 5 | { 6 | public class ETCancellationToken 7 | { 8 | private HashSet actions = new HashSet(); 9 | 10 | public void Add(Action callback) 11 | { 12 | // 如果action是null,绝对不能添加,要抛异常,说明有协程泄漏 13 | this.actions.Add(callback); 14 | } 15 | 16 | public void Remove(Action callback) 17 | { 18 | this.actions?.Remove(callback); 19 | } 20 | 21 | public bool IsCancel() 22 | { 23 | return this.actions == null; 24 | } 25 | 26 | public void Cancel() 27 | { 28 | if (this.actions == null) 29 | { 30 | return; 31 | } 32 | 33 | this.Invoke(); 34 | } 35 | 36 | private void Invoke() 37 | { 38 | HashSet runActions = this.actions; 39 | this.actions = null; 40 | try 41 | { 42 | foreach (Action action in runActions) 43 | { 44 | action.Invoke(); 45 | } 46 | } 47 | catch (Exception e) 48 | { 49 | Console.WriteLine(e); 50 | } 51 | } 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/ETCancellationToken.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53b9f32ba04b4e8d88a84e8ae8f15dd6 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/ETTask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebe0c1b4eae2461ca4be41b9713b0a5e 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/ETTaskCompleted.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Runtime.CompilerServices; 4 | 5 | namespace ET 6 | { 7 | [AsyncMethodBuilder(typeof(AsyncETTaskCompletedMethodBuilder))] 8 | public struct ETTaskCompleted : ICriticalNotifyCompletion 9 | { 10 | [DebuggerHidden] 11 | public ETTaskCompleted GetAwaiter() 12 | { 13 | return this; 14 | } 15 | 16 | [DebuggerHidden] 17 | public bool IsCompleted => true; 18 | 19 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 20 | [DebuggerHidden] 21 | public void GetResult() 22 | { 23 | } 24 | 25 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 26 | [DebuggerHidden] 27 | public void OnCompleted(Action continuation) 28 | { 29 | } 30 | 31 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 32 | [DebuggerHidden] 33 | public void UnsafeOnCompleted(Action continuation) 34 | { 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/ETTaskCompleted.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d08c81bce4d4321bd3b198cf642ec97 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/ETTaskHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 167687938efa44689d4293e50068c5f8 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/ETVoid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Runtime.CompilerServices; 4 | 5 | namespace ET 6 | { 7 | [AsyncMethodBuilder(typeof(AsyncETVoidMethodBuilder))] 8 | public struct ETVoid : ICriticalNotifyCompletion 9 | { 10 | [DebuggerHidden] 11 | public void Coroutine() 12 | { 13 | } 14 | 15 | [DebuggerHidden] 16 | public bool IsCompleted => true; 17 | 18 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 19 | [DebuggerHidden] 20 | public void OnCompleted(Action continuation) 21 | { 22 | } 23 | 24 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 25 | [DebuggerHidden] 26 | public void UnsafeOnCompleted(Action continuation) 27 | { 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/ETVoid.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc94ad1ba66348c3a79bab44aa00c485 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/IAwaiter.cs: -------------------------------------------------------------------------------- 1 | namespace ET 2 | { 3 | public enum AwaiterStatus : byte 4 | { 5 | /// The operation has not yet completed. 6 | Pending = 0, 7 | 8 | /// The operation completed successfully. 9 | Succeeded = 1, 10 | 11 | /// The operation completed with an error. 12 | Faulted = 2, 13 | } 14 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/ETTaskAsync/IAwaiter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f4af566a8ab492aa2b1da6ccfb08806 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7605708cb10f4f0eb0bb23484a382fe2 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Extensions/AtomicInt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace TimingWheel.Extensions 5 | { 6 | /// 7 | /// 原子int 8 | /// 9 | public class AtomicInt : IEquatable 10 | { 11 | private int _value; 12 | 13 | public AtomicInt(int value = default) 14 | { 15 | _value = value; 16 | } 17 | 18 | /// 19 | /// 获取值 20 | /// 21 | /// 22 | public int Get() 23 | { 24 | // int是32位整型,无论在32位还是64位系统中,读取都是原子操作 25 | return _value; 26 | } 27 | 28 | public int Increment() 29 | { 30 | return Interlocked.Increment(ref _value); 31 | } 32 | 33 | public int Decrement() 34 | { 35 | return Interlocked.Decrement(ref _value); 36 | } 37 | 38 | public bool Equals(int other) 39 | { 40 | return Get().Equals(other); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Extensions/AtomicInt.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a49a304f1d14ad799aa237ca3ed12da 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Extensions/AtomicLong.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace TimingWheel.Extensions 5 | { 6 | /// 7 | /// 原子long 8 | /// 9 | public class AtomicLong : IComparable, IComparable, IEquatable 10 | { 11 | private long _value; 12 | 13 | public AtomicLong(long value = default) 14 | { 15 | _value = value; 16 | } 17 | 18 | /// 19 | /// 获取值 20 | /// 21 | /// 22 | public long Get() 23 | { 24 | // long是64位整型,在64位系统中读取是原子操作,但32位系统不是,所以这里统一用Read原子读 25 | return Interlocked.Read(ref _value); 26 | } 27 | 28 | /// 29 | /// 设置值 30 | /// 31 | /// 32 | public void Set(long value) 33 | { 34 | Interlocked.Exchange(ref _value, value); 35 | } 36 | 37 | /// 38 | /// 设置并返回旧值 39 | /// 40 | /// 41 | /// 42 | public long GetAndSet(long value) 43 | { 44 | return Interlocked.Exchange(ref _value, value); 45 | } 46 | 47 | public int CompareTo(object obj) 48 | { 49 | if (obj == null) 50 | { 51 | return 1; 52 | } 53 | 54 | if (obj is AtomicLong value) 55 | { 56 | return Get().CompareTo(value.Get()); 57 | } 58 | 59 | throw new ArgumentException($"Object is not a {nameof(AtomicLong)}"); 60 | } 61 | 62 | public int CompareTo(long other) 63 | { 64 | return Get().CompareTo(other); 65 | } 66 | 67 | public bool Equals(long other) 68 | { 69 | return Get().Equals(other); 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Extensions/AtomicLong.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dbcc0d4e8577476381b3893d6107c6e9 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Extensions/DateTimeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TimingWheel.Extensions 4 | { 5 | /// 6 | /// DateTime帮助类 7 | /// 8 | public static class DateTimeHelper 9 | { 10 | /// 11 | /// 获取当前时间戳,默认毫秒级 12 | /// 13 | /// 是否秒级时间戳 14 | /// 15 | public static long GetTimestamp(bool isSecond = false) 16 | { 17 | return GetTimestamp(DateTime.Now, isSecond); 18 | } 19 | 20 | /// 21 | /// 获取指定时间戳,默认毫秒级 22 | /// 23 | /// 时间 24 | /// 是否秒级时间戳 25 | /// 26 | public static long GetTimestamp(DateTime date, bool isSecond = false) 27 | { 28 | var dateTimeOffset = new DateTimeOffset(date); 29 | return isSecond 30 | ? dateTimeOffset.ToUnixTimeSeconds() 31 | : dateTimeOffset.ToUnixTimeMilliseconds(); 32 | } 33 | 34 | /// 35 | /// 获取当前时间 36 | /// 37 | /// 时间戳,默认毫秒级 38 | /// 是否秒级时间戳,默认毫秒级 39 | /// 40 | public static DateTime FromTimestamp(long timestamp, bool isSecond = false) 41 | { 42 | return isSecond 43 | ? DateTimeOffset.FromUnixTimeSeconds(timestamp).LocalDateTime 44 | : DateTimeOffset.FromUnixTimeMilliseconds(timestamp).LocalDateTime; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Extensions/DateTimeHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bca665f1f2604e7aa9160602f735d9f1 3 | timeCreated: 1648525280 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Extensions/Loom.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a85ecbda474486595ddb307b40a5178 3 | timeCreated: 1650507328 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Interfaces.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 321e9e2766e742ef9e72afbed7c78cd1 3 | timeCreated: 1648525922 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Interfaces/ITimeTask.cs: -------------------------------------------------------------------------------- 1 | namespace TimingWheel.Interfaces 2 | { 3 | /// 4 | /// 定时任务 5 | /// 6 | public interface ITimeTask 7 | { 8 | /// 9 | /// 过期时间戳 10 | /// 11 | long TimeoutMs { get; } 12 | 13 | /// 14 | /// 任务状态 15 | /// 16 | TimeTaskStatus TaskStatus { get; } 17 | 18 | /// 19 | /// 取消任务 20 | /// 21 | bool Cancel(); 22 | } 23 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Interfaces/ITimeTask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 072d53ca354f40cca0ec303b2b5870e9 3 | timeCreated: 1648525922 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Interfaces/ITimer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ET; 3 | 4 | namespace TimingWheel.Interfaces 5 | { 6 | /// 7 | /// 时间轮计时器 8 | /// 9 | public interface ITimer 10 | { 11 | /// 12 | /// 任务总数 13 | /// 14 | int TaskCount { get; } 15 | 16 | /// 17 | /// 添加任务 18 | /// 19 | /// 过期时间,相对时间 20 | /// 取消任务令牌 21 | /// 添加成功返回true,如果任务已过期会立即执行,然后返回false 22 | ETTask AddTask(TimeSpan timeout,ETCancellationToken cancellationToken = default); 23 | ITimeTask AddTask(TimeSpan timeout,Action action); 24 | 25 | /// 26 | /// 添加任务 27 | /// 28 | /// 过期时间戳,绝对时间 29 | /// 取消任务令牌 30 | /// 31 | /// 添加成功返回true,如果任务已过期会立即执行,然后返回false 32 | ETTask AddTask(long timeoutMs,ETCancellationToken cancellationToken= default); 33 | ITimeTask AddTask(long timeoutMs,Action action); 34 | 35 | /// 36 | /// 启动 37 | /// 38 | void Start(); 39 | 40 | /// 41 | /// 停止 42 | /// 43 | void Stop(); 44 | 45 | /// 46 | /// 暂停 47 | /// 48 | void Pause(); 49 | 50 | /// 51 | /// 恢复 52 | /// 53 | void Resume(); 54 | } 55 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Interfaces/ITimer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19bca396fa8e4d45beab6872200c21fc 3 | timeCreated: 1648525922 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Libraries.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6591de4ba64244caa79610d8de8b0b8c 3 | timeCreated: 1648525465 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Libraries/DelayQueue.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FingerCaster/UGFExtensions/bb815bbce0a971601509a0732bc7a5ad824c7cca/Assets/Extensions/TimingWheel/Libraries/DelayQueue.dll -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Libraries/DelayQueue.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d38b769619f4582b35ef3cff0db0d9c 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/Libraries/DelayQueue.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: faa8dc8f74ef4ed6a86cb82ac29d752e 3 | timeCreated: 1648525751 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/README.md: -------------------------------------------------------------------------------- 1 | # TimingWheel 2 | 3 | 时间轮计时器。根据开源库[linys2333/TimingWheel](https://github.com/linys2333/TimingWheel) 修改而来。去除了多线程的部分 并提供ETTask 和 回调注册两种方式。 4 | 5 | ## 使用方式 6 | 7 | 计时基于毫秒, 返回状态 bool `true` 执行成功 `false` 取消执行 8 | 9 | 1. ETTask 10 | ```csharp 11 | await GameEntry.TimingWheel.AddTaskAsync(TimeSpan.FromMilliseconds(1000)); 12 | ``` 13 | 2. CallBack 回调方式 14 | ```csharp 15 | var task = GameEntry.TimingWheel.AddTask(TimeSpan.FromMilliseconds(1000), result => { Debug.Log(result); }); 16 | ``` 17 | 3. 循环调用计时器 18 | 可以自行设置 调用类型(帧,毫秒) 调用频率 19 | 回调参数为 开始时间和任务。 20 | ```csharp 21 | var loopTask = UGFExtensions.GameEntry.TimingWheel.AddLoopTask((startTime,task) => 22 | { 23 | Log.Info($" 每帧延迟 当前时间毫秒:{DateTimeHelper.GetTimestamp(false)} 当前时间秒:{DateTimeHelper.GetTimestamp(true)} 当前帧:{Time.frameCount}"); 24 | },LoopType.Millisecond,1500); 25 | 26 | //停止循环计时器 再需要停止的地方调用 27 | loopTask.Stop(); 28 | ``` 29 | 30 | ## 拓展使用方式 31 | 32 | 计时器本身只提供了 `添加任务` `取消任务` `循环任务` API 但是可以基于这些自行实现 暂停 恢复等功能 33 | 34 | * 暂停 恢复定时器功能 35 | ```csharp 36 | private ITimeTask m_Task; 37 | //创建定时器 38 | m_Task = GameEntry.TimingWheel.AddTask(TimeSpan.FromMilliseconds(1000), result => { Debug.Log(result); }); 39 | 40 | //暂停定时器 就是 记录定时器距离完成剩余时间 取消当前计时器。 41 | int time = m_Task.TimeoutMs - DateTimeHelper.GetTimestamp()//剩余时间= 结束时间-当前时间 42 | m_Task.Cancel(); 43 | 44 | //恢复 在恢复时候重新创建定时器即可 45 | m_Task = GameEntry.TimingWheel.AddTask(TimeSpan.FromMilliseconds(1000), result => { Debug.Log(result); }); 46 | ``` 47 | 48 | 49 | # 引用 50 | [linys2333/TimingWheel: c#版分层时间轮算法,参考kafka TimingWheel实现 (github.com)](https://github.com/linys2333/TimingWheel) -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d096f82bd9814d4893db28053585f1d 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/TimeSlot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 142e26cf25b944b4ac40230f9231b218 3 | timeCreated: 1648704286 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/TimeTask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f204b1c133844de2abac4af945e30d69 3 | timeCreated: 1648704286 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/TimeTaskStatus.cs: -------------------------------------------------------------------------------- 1 | namespace TimingWheel 2 | { 3 | /// 4 | /// 任务状态 5 | /// 6 | public enum TimeTaskStatus 7 | { 8 | /// 9 | /// 默认状态 10 | /// 11 | None, 12 | /// 13 | /// 等待中 14 | /// 15 | Wait, 16 | 17 | /// 18 | /// 运行中 19 | /// 20 | Running, 21 | 22 | /// 23 | /// 执行成功 24 | /// 25 | Success, 26 | 27 | /// 28 | /// 执行失败 29 | /// 30 | Fail, 31 | 32 | /// 33 | /// 任务取消 34 | /// 35 | Cancel 36 | } 37 | } -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/TimeTaskStatus.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a06cb6a350c9412499a2cd07d109e34d 3 | timeCreated: 1648704286 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/TimingWheel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52ceda83563441c5ab07c86c6d87b133 3 | timeCreated: 1648704286 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/TimingWheelComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 686b4089db9944ebaf6521abdc0bb868 3 | timeCreated: 1648527772 -------------------------------------------------------------------------------- /Assets/Extensions/TimingWheel/TimingWheelTimer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c49842ac3dc4bb98ba68ba1549eb3f5 3 | timeCreated: 1648704286 -------------------------------------------------------------------------------- /Assets/GameFramework.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b1f1b7748d735c49bf6c41e42ebcc87 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 FingerCaster 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UGFExtension 2 | 一些对UnityGameFramework的扩展 3 | 4 | 5 | 6 | ## 1.[数据表扩展](./Assets/Extensions/DataTableExtension) 7 | 8 | ## 2.[Await/Async扩展](./Assets/Extensions/AwaitExtension) 9 | 10 | ## 3.[Starforce中的扩展](./Assets/Extensions/StarforceExtension) 11 | 12 | ## 4.[定时器扩展](./Assets/Extensions/TimerExtension) 13 | 14 | ## 5.[Version生成扩展](./Assets/Extensions/BuildExtension) 15 | 16 | ## 6.[ResourceRule扩展](https://github.com/northWolf/GameFramework.ResourceRuleEditor) 17 | 18 | ## 7.[SpriteCollection扩展](./Assets/Extensions/SpriteCollectionExtension) 19 | 20 | ## 8.[TextureExtension](./Assets/Extensions/TextureExtension) 21 | 22 | ## 9.[时间轮组件](./Assets/Extensions/TimingWheel) 23 | 24 | ## 10.[MergeFileToVFS](./Assets/Extensions/MergeFileToVFSExtension) 25 | 26 | ## 11.[引用绑定工具 ReferenceBindTool](https://github.com/FingerCaster/ReferenceBindTool) 27 | 28 | 29 | 30 | # 引用库 致谢 31 | 32 | [GameFramework](https://github.com/EllanJiang/GameFramework) 33 | 34 | [UnityGameFramework](https://github.com/EllanJiang/UnityGameFramework) 35 | 36 | [ET](https://github.com/egametang/ET) 37 | 38 | [DataTableEditor](https://github.com/shaun-he/DataTableEditor) 39 | 40 | [StarForce](https://github.com/EllanJiang/StarForce) 41 | 42 | [GameFramework.ResourceRuleEditor](https://github.com/northWolf/GameFramework.ResourceRuleEditor) 43 | 44 | [Unity-SerializableDictionary](https://github.com/azixMcAze/Unity-SerializableDictionary) 45 | 46 | [UnityEditorJunkie](https://github.com/roboryantron/UnityEditorJunkie) 47 | 48 | --------------------------------------------------------------------------------