├── .gitignore ├── Atom.Blackboard.meta ├── Atom.Blackboard ├── Blackboard.cs ├── Blackboard.cs.meta ├── BlackboardProcessor.cs ├── BlackboardProcessor.cs.meta ├── IBlackboard.cs └── IBlackboard.cs.meta ├── Atom.Collections.meta ├── Atom.Collections ├── LinkedList.cs ├── LinkedList.cs.meta ├── LinkedListRange.cs ├── LinkedListRange.cs.meta ├── MultiDictionary.cs └── MultiDictionary.cs.meta ├── Atom.CommandDispatcher.meta ├── Atom.CommandDispatcher ├── CommandDispatcher.cs ├── CommandDispatcher.cs.meta ├── ICommand.cs └── ICommand.cs.meta ├── Atom.Core.asmdef ├── Atom.Core.asmdef.meta ├── Atom.DataNode.meta ├── Atom.DataNode ├── DataNode.cs ├── DataNode.cs.meta ├── IDataNode.cs └── IDataNode.cs.meta ├── Atom.Event.meta ├── Atom.Event ├── Event.cs ├── Event.cs.meta ├── EventService.cs ├── EventService.cs.meta ├── GlobalEvent.cs ├── GlobalEvent.cs.meta ├── GlobalEventService.cs └── GlobalEventService.cs.meta ├── Atom.IdGenerator.meta ├── Atom.IdGenerator ├── IdGenerator.cs └── IdGenerator.cs.meta ├── Atom.Logger.meta ├── Atom.Logger ├── ILogger.cs ├── ILogger.cs.meta ├── Log.cs └── Log.cs.meta ├── Atom.ObjectPool.meta ├── Atom.ObjectPool ├── IObject.cs ├── IObject.cs.meta ├── IObjectPool.cs ├── IObjectPool.cs.meta ├── ObjectPoolBase.cs ├── ObjectPoolBase.cs.meta ├── ObjectPoolManager.ObjectPool.cs ├── ObjectPoolManager.ObjectPool.cs.meta ├── ObjectPoolManager.cs └── ObjectPoolManager.cs.meta ├── Atom.ReferenceCollector.meta ├── Atom.ReferenceCollector ├── Editor.meta ├── Editor │ ├── ReferenceCollectorInspector.cs │ └── ReferenceCollectorInspector.cs.meta ├── Runtime.meta └── Runtime │ ├── ReferenceCollector.cs │ └── ReferenceCollector.cs.meta ├── Atom.StaticMethod.meta ├── Atom.StaticMethod ├── IStaticMethod.cs ├── IStaticMethod.cs.meta ├── StaticMethod.cs └── StaticMethod.cs.meta ├── Atom.ViewModel.meta ├── Atom.ViewModel ├── Attributes.meta ├── Attributes │ ├── ViewModelAttribute.cs │ └── ViewModelAttribute.cs.meta ├── BindableCollection.cs ├── BindableCollection.cs.meta ├── BindableDictionary.cs ├── BindableDictionary.cs.meta ├── BindableList.cs ├── BindableList.cs.meta ├── BindableProperty.cs ├── BindableProperty.cs.meta ├── BindableSharedVariable.cs ├── BindableSharedVariable.cs.meta ├── BindableStack.cs ├── BindableStack.cs.meta ├── Bridged.meta ├── Bridged │ ├── BridgedCollection.cs │ ├── BridgedCollection.cs.meta │ ├── BridgedValue.cs │ └── BridgedValue.cs.meta ├── ExternalViewModel.cs ├── ExternalViewModel.cs.meta ├── Interfaces.meta ├── Interfaces │ ├── IBindableProperty.cs │ └── IBindableProperty.cs.meta ├── Utils.meta ├── Utils │ ├── BindablePropertyEX.cs │ ├── BindablePropertyEX.cs.meta │ ├── ViewModelFactory.cs │ └── ViewModelFactory.cs.meta ├── ViewModel.cs └── ViewModel.cs.meta ├── Core.meta ├── Core ├── CommonTrees.meta ├── CommonTrees │ ├── BinaryTree.cs │ ├── BinaryTree.cs.meta │ ├── FullBinaryTree.cs │ ├── FullBinaryTree.cs.meta │ ├── Octree.cs │ ├── Octree.cs.meta │ ├── QuadTree.cs │ └── QuadTree.cs.meta ├── Game.meta ├── Game │ ├── Game.cs │ ├── Game.cs.meta │ ├── Singletons.meta │ ├── Singletons │ │ ├── Singletons.meta │ │ └── Singletons │ │ │ ├── AutoSingleton.cs │ │ │ ├── AutoSingleton.cs.meta │ │ │ ├── ISingleton.cs │ │ │ ├── ISingleton.cs.meta │ │ │ ├── Singleton.cs │ │ │ └── Singleton.cs.meta │ ├── World.meta │ └── World │ │ ├── Core.meta │ │ ├── Core │ │ ├── IScene.cs │ │ ├── IScene.cs.meta │ │ ├── MainWorld.cs │ │ ├── MainWorld.cs.meta │ │ ├── Node.cs │ │ ├── Node.cs.meta │ │ ├── Scene.cs │ │ ├── Scene.cs.meta │ │ ├── System.meta │ │ ├── System │ │ │ ├── IAddComponentSystem.cs │ │ │ ├── IAddComponentSystem.cs.meta │ │ │ ├── IAwakeSystem.cs │ │ │ ├── IAwakeSystem.cs.meta │ │ │ ├── IDestroySystem.cs │ │ │ ├── IDestroySystem.cs.meta │ │ │ ├── IFixedUpdateSystem.cs │ │ │ ├── IFixedUpdateSystem.cs.meta │ │ │ ├── ILateUpdateSystem.cs │ │ │ ├── ILateUpdateSystem.cs.meta │ │ │ ├── ISystem.cs │ │ │ ├── ISystem.cs.meta │ │ │ ├── IUpdateSystem.cs │ │ │ └── IUpdateSystem.cs.meta │ │ ├── Systems.cs │ │ ├── Systems.cs.meta │ │ ├── World.cs │ │ └── World.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── Menus.cs │ │ └── Menus.cs.meta │ │ ├── Runtime.meta │ │ └── Runtime │ │ ├── WorldTreeNodePreview.cs │ │ ├── WorldTreeNodePreview.cs.meta │ │ ├── WorldTreePreviewRoot.cs │ │ └── WorldTreePreviewRoot.cs.meta ├── Unsafe.meta ├── Unsafe │ ├── UnsafeUtil.cs │ └── UnsafeUtil.cs.meta ├── Utility.meta └── Utility │ ├── CollectionEx.BinarySearch.cs │ ├── CollectionEx.BinarySearch.cs.meta │ ├── CollectionEx.BubbleSort.cs │ ├── CollectionEx.BubbleSort.cs.meta │ ├── CollectionEx.HeapSort.cs │ ├── CollectionEx.HeapSort.cs.meta │ ├── CollectionEx.InsertionSort.cs │ ├── CollectionEx.InsertionSort.cs.meta │ ├── CollectionEx.QuickSort.cs │ ├── CollectionEx.QuickSort.cs.meta │ ├── CollectionEx.SelectionSort.cs │ ├── CollectionEx.SelectionSort.cs.meta │ ├── CollectionEx.cs │ ├── CollectionEx.cs.meta │ ├── Consts.cs │ ├── Consts.cs.meta │ ├── Easing.cs │ ├── Easing.cs.meta │ ├── ReflectionEx.cs │ ├── ReflectionEx.cs.meta │ ├── Snowflake.cs │ ├── Snowflake.cs.meta │ ├── TimeEx.cs │ ├── TimeEx.cs.meta │ ├── TypeCache.cs │ ├── TypeCache.cs.meta │ ├── TypesCache.cs │ └── TypesCache.cs.meta ├── README.md ├── README.md.meta ├── Unity.meta └── Unity ├── Audio.meta ├── Audio ├── AudioManager.cs ├── AudioManager.cs.meta ├── IAudioManager.cs └── IAudioManager.cs.meta ├── EditorCoroutine.meta ├── EditorCoroutine ├── Editor.meta └── Editor │ ├── CoroutineService.cs │ ├── CoroutineService.cs.meta │ ├── EditorCoroutineService.cs │ ├── EditorCoroutineService.cs.meta │ ├── GlobalEditorCoroutineService.cs │ ├── GlobalEditorCoroutineService.cs.meta │ ├── Interfaces.cs │ ├── Interfaces.cs.meta │ ├── UnityCoroutine.cs │ ├── UnityCoroutine.cs.meta │ ├── YieldInstruction.cs │ └── YieldInstruction.cs.meta ├── IMGUI.meta ├── IMGUI ├── IMGUI.Controls.meta ├── IMGUI.Controls │ ├── Editor.meta │ └── Editor │ │ ├── AdvanceDropDown.cs │ │ ├── AdvanceDropDown.cs.meta │ │ ├── ResizableArea.cs │ │ ├── ResizableArea.cs.meta │ │ ├── SplitView.cs │ │ ├── SplitView.cs.meta │ │ ├── TreeView.cs │ │ └── TreeView.cs.meta ├── IMGUI.EditorGUI.meta ├── IMGUI.EditorGUI │ ├── Editor.meta │ └── Editor │ │ ├── EditorGUIExtension.cs │ │ ├── EditorGUIExtension.cs.meta │ │ ├── EditorGUIExtension_DragDropArea.cs │ │ ├── EditorGUIExtension_DragDropArea.cs.meta │ │ ├── EditorGUILayoutExtension.cs │ │ ├── EditorGUILayoutExtension.cs.meta │ │ ├── EditorGUILayoutExtension_DragDropArea.cs │ │ ├── EditorGUILayoutExtension_DragDropArea.cs.meta │ │ ├── EditorStylesExtension.cs │ │ ├── EditorStylesExtension.cs.meta │ │ ├── EditorUtilityExtension.cs │ │ ├── EditorUtilityExtension.cs.meta │ │ ├── LayoutUtility.cs │ │ └── LayoutUtility.cs.meta ├── IMGUI.ObjectDrawer.meta ├── IMGUI.ObjectDrawer │ ├── Editor.meta │ ├── Editor │ │ ├── EditorGUIExtension_NormalDrawer.cs │ │ ├── EditorGUIExtension_NormalDrawer.cs.meta │ │ ├── EditorGUILayoutExtension_NormalDrawer.cs │ │ ├── EditorGUILayoutExtension_NormalDrawer.cs.meta │ │ ├── ObjectEditor.meta │ │ ├── ObjectEditor │ │ │ ├── ObjectEditor.cs │ │ │ ├── ObjectEditor.cs.meta │ │ │ ├── ObjectInspector.cs │ │ │ └── ObjectInspector.cs.meta │ │ ├── PropertyDrawer.meta │ │ ├── PropertyDrawer │ │ │ ├── PropertyDrawer.cs │ │ │ └── PropertyDrawer.cs.meta │ │ ├── SerializedPropertyS.meta │ │ └── SerializedPropertyS │ │ │ ├── EditorGUIExtension_Property.cs │ │ │ ├── EditorGUIExtension_Property.cs.meta │ │ │ ├── EditorGUILayoutExtension_Property.cs │ │ │ ├── EditorGUILayoutExtension_Property.cs.meta │ │ │ ├── SerializedPropertyS.cs │ │ │ └── SerializedPropertyS.cs.meta │ └── Runtime.meta ├── IMGUI.meta └── IMGUI │ ├── Editor.meta │ ├── Editor │ ├── BaseEditor.cs │ ├── BaseEditor.cs.meta │ ├── BaseEditorWindow.cs │ ├── BaseEditorWindow.cs.meta │ ├── MenuEditorWindow.cs │ ├── MenuEditorWindow.cs.meta │ ├── ReorderableListUtility.cs │ └── ReorderableListUtility.cs.meta │ ├── Runtime.meta │ └── Runtime │ ├── GUIHelper.cs │ └── GUIHelper.cs.meta ├── Logger.meta ├── Logger ├── Runtime.meta └── Runtime │ ├── ULogger.cs │ └── ULogger.cs.meta ├── MDIWindow.meta ├── MDIWindow ├── Editor.meta └── Editor │ ├── MDIWindow.cs │ ├── MDIWindow.cs.meta │ ├── SubWindow.cs │ ├── SubWindow.cs.meta │ ├── SubWindowLeafNode.cs │ ├── SubWindowLeafNode.cs.meta │ ├── SubWindowNode.cs │ ├── SubWindowNode.cs.meta │ ├── SubWindowParentNode.cs │ ├── SubWindowParentNode.cs.meta │ ├── SubWindowTree.cs │ └── SubWindowTree.cs.meta ├── PropertyDrawer.meta ├── PropertyDrawer ├── Editor.meta ├── Editor │ ├── HideLabelDrawer.cs │ ├── HideLabelDrawer.cs.meta │ ├── InlineEditorDrawer.cs │ ├── InlineEditorDrawer.cs.meta │ ├── MinMaxSliderDrawer.cs │ ├── MinMaxSliderDrawer.cs.meta │ ├── ObjectPreviewButtonDrawer.cs │ ├── ObjectPreviewButtonDrawer.cs.meta │ ├── PreviewObjectFieldDrawer.cs │ ├── PreviewObjectFieldDrawer.cs.meta │ ├── ProgressBarDrawer.cs │ ├── ProgressBarDrawer.cs.meta │ ├── ReadOnlyDrawer.cs │ └── ReadOnlyDrawer.cs.meta ├── Runtime.meta └── Runtime │ ├── HideLabelAttribute.cs │ ├── HideLabelAttribute.cs.meta │ ├── InlineEditorAttribute.cs │ ├── InlineEditorAttribute.cs.meta │ ├── MinMaxSliderAttribute.cs │ ├── MinMaxSliderAttribute.cs.meta │ ├── ObjectPreviewButtonAttribute.cs │ ├── ObjectPreviewButtonAttribute.cs.meta │ ├── PreviewObjectFieldAttribute.cs │ ├── PreviewObjectFieldAttribute.cs.meta │ ├── ProgressBarAttribute.cs │ ├── ProgressBarAttribute.cs.meta │ ├── ReadOnlyAttribute.cs │ └── ReadOnlyAttribute.cs.meta ├── Resource.meta ├── Resource ├── AllAssetsHandle.cs ├── AllAssetsHandle.cs.meta ├── AssetHandle.cs ├── AssetHandle.cs.meta ├── HandleBase.cs ├── HandleBase.cs.meta ├── IResourceComponent.cs ├── IResourceComponent.cs.meta ├── RawFileHandle.cs ├── RawFileHandle.cs.meta ├── ResourceManager.cs ├── ResourceManager.cs.meta ├── SceneHandle.cs └── SceneHandle.cs.meta ├── SharedVariable.meta ├── SharedVariable ├── Editor.meta ├── Editor │ ├── SharedVariablePropertyDrawer.cs │ └── SharedVariablePropertyDrawer.cs.meta ├── Runtime.meta └── Runtime │ ├── Interface.meta │ ├── Interface │ ├── IVariableOwner.cs │ └── IVariableOwner.cs.meta │ ├── SharedVariable.cs │ ├── SharedVariable.cs.meta │ ├── SharedVariableUtility.cs │ ├── SharedVariableUtility.cs.meta │ ├── SharedVariables.meta │ └── SharedVariables │ ├── SharedBool.cs │ ├── SharedBool.cs.meta │ ├── SharedFloat.cs │ ├── SharedFloat.cs.meta │ ├── SharedGameObject.cs │ ├── SharedGameObject.cs.meta │ ├── SharedGameObjectList.cs │ ├── SharedGameObjectList.cs.meta │ ├── SharedIList.cs │ ├── SharedIList.cs.meta │ ├── SharedInt.cs │ ├── SharedInt.cs.meta │ ├── SharedObject.cs │ ├── SharedObject.cs.meta │ ├── SharedString.cs │ ├── SharedString.cs.meta │ ├── SharedTransform.cs │ ├── SharedTransform.cs.meta │ ├── SharedVector2.cs │ ├── SharedVector2.cs.meta │ ├── SharedVector3.cs │ ├── SharedVector3.cs.meta │ ├── SharedVector4.cs │ └── SharedVector4.cs.meta ├── Singletons.Unity.meta ├── Singletons.Unity ├── Runtime.meta └── Runtime │ ├── AutoMonoSingleton.cs │ └── AutoMonoSingleton.cs.meta ├── Utility.meta └── Utility ├── Editor.meta ├── Editor ├── AssetDatabaseEx.cs ├── AssetDatabaseEx.cs.meta ├── EditorPrefsVariable.cs ├── EditorPrefsVariable.cs.meta ├── MenuEx.cs ├── MenuEx.cs.meta ├── PlayerSettingsEx.cs └── PlayerSettingsEx.cs.meta ├── Runtime.meta └── Runtime ├── PlayerPrefsVariable.cs ├── PlayerPrefsVariable.cs.meta ├── Util.cs └── Util.cs.meta /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | *.unitypackage 57 | 58 | # Crashlytics generated file 59 | crashlytics-build.properties 60 | 61 | -------------------------------------------------------------------------------- /Atom.Blackboard.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c36e44b22d83684ab4918baa98052b8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.Blackboard/Blackboard.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d0afa333b6d49040a3843b3dcfc91da 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.Blackboard/BlackboardProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d03f597ddc734113a43967437828e3f4 3 | timeCreated: 1692862328 -------------------------------------------------------------------------------- /Atom.Blackboard/IBlackboard.cs: -------------------------------------------------------------------------------- 1 | namespace Atom 2 | { 3 | public interface IBlackboard 4 | { 5 | bool Contains(TKey key); 6 | 7 | T Get(TKey key); 8 | 9 | object Get(TKey key); 10 | 11 | bool TryGet(TKey key, out T value); 12 | 13 | bool TryGet(TKey key, out object value); 14 | 15 | bool Set(TKey key, T value); 16 | 17 | bool Remove(TKey key); 18 | 19 | void Clear(); 20 | } 21 | } -------------------------------------------------------------------------------- /Atom.Blackboard/IBlackboard.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a8cab53327d4b04804edf2c74c30c51 3 | timeCreated: 1697791313 -------------------------------------------------------------------------------- /Atom.Collections.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c0d2d7a6d014de89b6dde0b297ad77e 3 | timeCreated: 1693364593 -------------------------------------------------------------------------------- /Atom.Collections/LinkedList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8c83b5961494731a04a6520b71dfcde 3 | timeCreated: 1693382178 -------------------------------------------------------------------------------- /Atom.Collections/LinkedListRange.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91f5592de9da4813a284224e42cdc063 3 | timeCreated: 1693382273 -------------------------------------------------------------------------------- /Atom.Collections/MultiDictionary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad96fcb9115c4d848eb3696c8ebbebc1 3 | timeCreated: 1693382244 -------------------------------------------------------------------------------- /Atom.CommandDispatcher.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b767db5cfcde400438d598242c4793a0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.CommandDispatcher/CommandDispatcher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8bd081001a3ec146907e90b02c30ee3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.CommandDispatcher/ICommand.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 主题: 指令调度器 7 | * Description: 8 | * 功能: 9 | * 提供Do Redo Undo的功能 10 | * Date: 11 | * Version: 12 | * Writer: 半只龙虾人 13 | * Github: https://github.com/haloman9527 14 | * Blog: https://www.haloman.net/ 15 | * 16 | */ 17 | 18 | #endregion 19 | 20 | namespace Atom 21 | { 22 | public interface ICommand 23 | { 24 | void Do(); 25 | 26 | void Redo(); 27 | 28 | void Undo(); 29 | } 30 | } -------------------------------------------------------------------------------- /Atom.CommandDispatcher/ICommand.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cc40f9ad08144339cade0aa428c077e 3 | timeCreated: 1678529068 -------------------------------------------------------------------------------- /Atom.Core.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Atom.Core", 3 | "rootNamespace": "", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": true, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [], 12 | "versionDefines": [], 13 | "noEngineReferences": false 14 | } -------------------------------------------------------------------------------- /Atom.Core.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5957643ee62fb75498d29ee03d7011ef 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Atom.DataNode.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d795250778779c4fb8a77a2dd86ade1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.DataNode/DataNode.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 | using System.Collections.Generic; 9 | 10 | namespace Atom 11 | { 12 | public class DataNode : IDataNode 13 | { 14 | private char seperator; 15 | private string m_Name; 16 | private string m_FullName; 17 | private IDataNode m_Parent; 18 | private object m_Data; 19 | private Dictionary m_Children = new Dictionary(); 20 | 21 | public string Name => m_Name; 22 | 23 | public string FullName => m_FullName; 24 | 25 | public IDataNode Parent => m_Parent; 26 | 27 | public int ChildCount => m_Children.Count; 28 | 29 | public IEnumerator Children => m_Children.Values.GetEnumerator(); 30 | 31 | public DataNode() 32 | { 33 | this.m_Name = string.Empty; 34 | this.m_FullName = string.Empty; 35 | this.m_Parent = null; 36 | } 37 | 38 | public static DataNode Create(string name, char seperator, DataNode parent) 39 | { 40 | var dataNode = ObjectPoolManager.Spawn(); 41 | dataNode.m_Name = name; 42 | dataNode.m_FullName = parent == null ? name : $"{parent.FullName}{seperator}{name}"; 43 | dataNode.m_Parent = parent; 44 | dataNode.seperator = seperator; 45 | parent?.m_Children.Add(name, parent); 46 | return dataNode; 47 | } 48 | 49 | public T GetData() where T : class 50 | { 51 | return m_Data as T; 52 | } 53 | 54 | public object GetData() 55 | { 56 | return m_Data; 57 | } 58 | 59 | public void SetData(T data) where T : class 60 | { 61 | this.m_Data = data; 62 | } 63 | 64 | public void SetData(object data) 65 | { 66 | this.m_Data = data; 67 | } 68 | 69 | public bool HasChild(string name) 70 | { 71 | return m_Children.ContainsKey(name); 72 | } 73 | 74 | public IDataNode GetChild(string name) 75 | { 76 | m_Children.TryGetValue(name, out var dataNode); 77 | return dataNode; 78 | } 79 | 80 | public IDataNode GetOrAddChild(string name) 81 | { 82 | if (!m_Children.TryGetValue(name, out var dataNode)) 83 | { 84 | m_Children[name] = dataNode = Create(name, this.seperator, this); 85 | } 86 | 87 | return dataNode; 88 | } 89 | 90 | public void RemoveChild(string name) 91 | { 92 | if (m_Children.TryGetValue(name, out var dataNode)) 93 | { 94 | m_Children.Remove(name); 95 | ObjectPoolManager.Recycle(typeof(DataNode), dataNode); 96 | } 97 | } 98 | 99 | public void Clear() 100 | { 101 | foreach (var pair in m_Children) 102 | { 103 | pair.Value.Clear(); 104 | ObjectPoolManager.Recycle(typeof(DataNode), pair.Value); 105 | } 106 | 107 | m_Children.Clear(); 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /Atom.DataNode/DataNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf37cc2443054817927a3445f3e9b974 3 | timeCreated: 1727544680 -------------------------------------------------------------------------------- /Atom.DataNode/IDataNode.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 | using System.Collections.Generic; 9 | 10 | namespace Atom 11 | { 12 | /// 13 | /// 数据结点接口。 14 | /// 15 | public interface IDataNode 16 | { 17 | /// 18 | /// 获取数据结点的名称。 19 | /// 20 | string Name 21 | { 22 | get; 23 | } 24 | 25 | /// 26 | /// 获取数据结点的完整名称。 27 | /// 28 | string FullName 29 | { 30 | get; 31 | } 32 | 33 | /// 34 | /// 获取父数据结点。 35 | /// 36 | IDataNode Parent 37 | { 38 | get; 39 | } 40 | 41 | /// 42 | /// 获取子数据结点的数量。 43 | /// 44 | int ChildCount 45 | { 46 | get; 47 | } 48 | 49 | /// 50 | /// 所有子数据节点。 51 | /// 52 | IEnumerator Children { get; } 53 | 54 | /// 55 | /// 根据类型获取数据结点的数据。 56 | /// 57 | /// 要获取的数据类型。 58 | /// 指定类型的数据。 59 | T GetData() where T : class; 60 | 61 | /// 62 | /// 获取数据结点的数据。 63 | /// 64 | /// 数据结点数据。 65 | object GetData(); 66 | 67 | /// 68 | /// 设置数据结点的数据。 69 | /// 70 | /// 要设置的数据类型。 71 | /// 要设置的数据。 72 | void SetData(T data) where T : class; 73 | 74 | /// 75 | /// 设置数据结点的数据。 76 | /// 77 | /// 要设置的数据。 78 | void SetData(object data); 79 | 80 | /// 81 | /// 根据名称检查是否存在子数据结点。 82 | /// 83 | /// 子数据结点名称。 84 | /// 是否存在子数据结点。 85 | bool HasChild(string name); 86 | 87 | /// 88 | /// 根据名称获取子数据结点。 89 | /// 90 | /// 子数据结点名称。 91 | /// 指定名称的子数据结点,如果没有找到,则返回空。 92 | IDataNode GetChild(string name); 93 | 94 | /// 95 | /// 根据名称获取或增加子数据结点。 96 | /// 97 | /// 子数据结点名称。 98 | /// 指定名称的子数据结点,如果对应名称的子数据结点已存在,则返回已存在的子数据结点,否则增加子数据结点。 99 | IDataNode GetOrAddChild(string name); 100 | 101 | /// 102 | /// 根据名称移除子数据结点。 103 | /// 104 | /// 子数据结点名称。 105 | void RemoveChild(string name); 106 | 107 | /// 108 | /// 移除当前数据结点的数据和所有子数据结点。 109 | /// 110 | void Clear(); 111 | 112 | /// 113 | /// 获取数据结点字符串。 114 | /// 115 | /// 数据结点字符串。 116 | string ToString(); 117 | } 118 | } -------------------------------------------------------------------------------- /Atom.DataNode/IDataNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef2defeb05ca47ef9ed4842238bb14b3 3 | timeCreated: 1727546387 -------------------------------------------------------------------------------- /Atom.Event.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34282103dcb62084ca3024d44071f0c0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.Event/Event.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Atom.Internal 5 | { 6 | public interface IEvent 7 | { 8 | bool IsNull { get; } 9 | 10 | void Clear(); 11 | } 12 | 13 | public interface IGlobalEvent 14 | { 15 | public Type EventType { get; } 16 | } 17 | 18 | public class Event : IEvent 19 | { 20 | private readonly List>> handlers = new List>>(8); 21 | 22 | public bool IsNull => handlers.Count == 0; 23 | 24 | public void Add(Action handler) 25 | { 26 | handlers.Add(new WeakReference>(handler)); 27 | } 28 | 29 | public void Remove(Action handler) 30 | { 31 | for (int i = handlers.Count - 1; i >= 0; i--) 32 | { 33 | if (handlers[i].TryGetTarget(out var existingHandler) && existingHandler == handler) 34 | { 35 | handlers.RemoveAt(i); 36 | break; 37 | } 38 | } 39 | } 40 | 41 | public void Invoke(TArg arg) 42 | { 43 | for (int i = 0; i < handlers.Count; i++) 44 | { 45 | if (handlers[i].TryGetTarget(out var handler)) 46 | { 47 | try 48 | { 49 | handler.Invoke(arg); 50 | } 51 | catch (Exception e) 52 | { 53 | Log.Error(e); 54 | } 55 | } 56 | else 57 | { 58 | handlers.RemoveAt(i--); 59 | } 60 | } 61 | } 62 | 63 | public void Clear() 64 | { 65 | handlers.Clear(); 66 | } 67 | } 68 | 69 | public class Event : IEvent 70 | { 71 | private readonly List> handlers = new List>(8); 72 | 73 | public bool IsNull => handlers.Count == 0; 74 | 75 | public void Add(Action handler) 76 | { 77 | handlers.Add(new WeakReference(handler)); 78 | } 79 | 80 | public void Remove(Action handler) 81 | { 82 | for (int i = handlers.Count - 1; i >= 0; i--) 83 | { 84 | if (handlers[i].TryGetTarget(out var existingHandler) && existingHandler == handler) 85 | { 86 | handlers.RemoveAt(i); 87 | break; 88 | } 89 | } 90 | } 91 | 92 | public void Invoke() 93 | { 94 | for (int i = 0; i < handlers.Count; i++) 95 | { 96 | if (handlers[i].TryGetTarget(out var handler)) 97 | { 98 | try 99 | { 100 | handler.Invoke(); 101 | } 102 | catch (Exception e) 103 | { 104 | Log.Error(e); 105 | } 106 | } 107 | else 108 | { 109 | handlers.RemoveAt(i--); 110 | } 111 | } 112 | } 113 | 114 | public void Clear() 115 | { 116 | handlers.Clear(); 117 | } 118 | } 119 | } -------------------------------------------------------------------------------- /Atom.Event/Event.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa0eb7b830794cfebc03006fcfd6192c 3 | timeCreated: 1739171696 -------------------------------------------------------------------------------- /Atom.Event/EventService.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f76604d9ef59c284e843995b12a3627d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.Event/GlobalEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Atom.Internal; 3 | 4 | namespace Atom 5 | { 6 | public abstract class GlobalEvent : IGlobalEvent 7 | { 8 | public Type EventType => TypeCache.TYPE; 9 | 10 | public abstract void Invoke(E arg); 11 | } 12 | } -------------------------------------------------------------------------------- /Atom.Event/GlobalEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 394f9ba297be449fb0ed68b4b9a5096d 3 | timeCreated: 1740294336 -------------------------------------------------------------------------------- /Atom.Event/GlobalEventService.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e88681ab45704f70befd52f2f8a18d16 3 | timeCreated: 1704990954 -------------------------------------------------------------------------------- /Atom.IdGenerator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e66f3aa7924643248b24c0d68c3b6a7e 3 | timeCreated: 1742891352 -------------------------------------------------------------------------------- /Atom.IdGenerator/IdGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace Atom 5 | { 6 | public class IdGenerator 7 | { 8 | private const int SEQUENCE_BITS = 12; 9 | private const long SEQUENCE_MASK = -1L ^ (-1L << SEQUENCE_BITS); 10 | 11 | private readonly long _baseTimestamp; 12 | private long _lastTimestampSequence; // 合并时间戳和序列号 13 | 14 | public IdGenerator(int year, int month, int day) 15 | { 16 | _baseTimestamp = new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000L; 17 | _lastTimestampSequence = 0L; // 初始时间戳和序列号均为0 18 | } 19 | 20 | private long GetCurrentTime() 21 | { 22 | return (DateTime.UtcNow.Ticks / 10000L) - _baseTimestamp; 23 | } 24 | 25 | public long GenerateId() 26 | { 27 | int spinCount = 0; 28 | while (spinCount++ < 1000) // 限制自旋次数防止死循环 29 | { 30 | long currentTsSeq = Interlocked.Read(ref _lastTimestampSequence); 31 | long currentTimestamp = currentTsSeq >> SEQUENCE_BITS; 32 | long currentSequence = currentTsSeq & SEQUENCE_MASK; 33 | 34 | long actualTimestamp = GetCurrentTime(); 35 | 36 | if (actualTimestamp < currentTimestamp) 37 | { 38 | throw new InvalidOperationException("Clock moved backwards."); 39 | } 40 | 41 | if (actualTimestamp == currentTimestamp) 42 | { 43 | long newSequence = (currentSequence + 1) & SEQUENCE_MASK; 44 | if (newSequence != 0) 45 | { 46 | long newTsSeq = (currentTimestamp << SEQUENCE_BITS) | newSequence; 47 | if (Interlocked.CompareExchange(ref _lastTimestampSequence, newTsSeq, currentTsSeq) == currentTsSeq) 48 | { 49 | return (actualTimestamp << SEQUENCE_BITS) | newSequence; 50 | } 51 | } 52 | else 53 | { 54 | actualTimestamp = TilNextTimestamp(currentTimestamp); 55 | } 56 | } 57 | 58 | // 时间戳已变化,尝试更新 59 | long newTsSeqForNewTimestamp = (actualTimestamp << SEQUENCE_BITS) | 0L; 60 | if (Interlocked.CompareExchange(ref _lastTimestampSequence, newTsSeqForNewTimestamp, currentTsSeq) == currentTsSeq) 61 | { 62 | return (actualTimestamp << SEQUENCE_BITS) | 0L; 63 | } 64 | } 65 | 66 | throw new InvalidOperationException("Failed to generate ID after maximum spins."); 67 | } 68 | 69 | private long TilNextTimestamp(long currentTimestamp) 70 | { 71 | long timestamp; 72 | do 73 | { 74 | Thread.SpinWait(10); 75 | timestamp = GetCurrentTime(); 76 | } while (timestamp <= currentTimestamp); 77 | 78 | return timestamp; 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /Atom.IdGenerator/IdGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f489141a23894f389fb5a48fa8e26d92 3 | timeCreated: 1742891370 -------------------------------------------------------------------------------- /Atom.Logger.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ac068af1dfeaf24c866d97ef952335f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.Logger/ILogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface ILogger 6 | { 7 | void Trace(string msg); 8 | void Warning(string msg); 9 | void Info(string msg); 10 | void Debug(string msg); 11 | void Error(string msg); 12 | void Error(Exception e); 13 | } 14 | } -------------------------------------------------------------------------------- /Atom.Logger/ILogger.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6540bd1dce624e6881472972846edba3 3 | timeCreated: 1690354682 -------------------------------------------------------------------------------- /Atom.Logger/Log.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public static class Log 6 | { 7 | private static ILogger logger; 8 | 9 | public static ILogger Logger 10 | { 11 | set => logger = value; 12 | } 13 | 14 | public static void Debug(object msg) 15 | { 16 | logger?.Debug(msg.ToString()); 17 | } 18 | 19 | public static void Debug(string msg) 20 | { 21 | logger?.Debug(msg); 22 | } 23 | 24 | public static void Info(string msg) 25 | { 26 | logger?.Info(msg); 27 | } 28 | 29 | public static void Warning(string msg) 30 | { 31 | logger?.Warning(msg); 32 | } 33 | 34 | public static void Error(string msg) 35 | { 36 | logger?.Error(msg); 37 | } 38 | 39 | public static void Error(Exception e) 40 | { 41 | logger?.Error(e); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Atom.Logger/Log.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd6ff805a3934d769fe2132092c84f0d 3 | timeCreated: 1690355269 -------------------------------------------------------------------------------- /Atom.ObjectPool.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c8c303c6d2d5cb418268ced51938d15 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.ObjectPool/IObject.cs: -------------------------------------------------------------------------------- 1 | namespace Atom 2 | { 3 | public interface IObject 4 | { 5 | void OnSpawn(); 6 | 7 | void OnRecycle(); 8 | } 9 | } -------------------------------------------------------------------------------- /Atom.ObjectPool/IObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6513c99d2d674adcab6abab2f53ede74 3 | timeCreated: 1735808520 -------------------------------------------------------------------------------- /Atom.ObjectPool/IObjectPool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface IObjectPool 6 | { 7 | Type UnitType { get; } 8 | 9 | int UnusedCount { get; } 10 | 11 | object Spawn(); 12 | 13 | void Recycle(object unit); 14 | 15 | void Release(); 16 | } 17 | 18 | public interface IObjectPool where T : class 19 | { 20 | Type UnitType { get; } 21 | 22 | int UnusedCount { get; } 23 | 24 | T Spawn(); 25 | 26 | void Recycle(T unit); 27 | 28 | void Release(); 29 | } 30 | } -------------------------------------------------------------------------------- /Atom.ObjectPool/IObjectPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee2ceda2a9264da88c51ae47162b90ce 3 | timeCreated: 1678526884 -------------------------------------------------------------------------------- /Atom.ObjectPool/ObjectPoolBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Atom 5 | { 6 | public abstract class ObjectPoolBase : IObjectPool, IObjectPool where T : class 7 | { 8 | protected Queue unusedObjects; 9 | 10 | public Type UnitType => TypeCache.TYPE; 11 | 12 | public int UnusedCount => unusedObjects.Count; 13 | 14 | public ObjectPoolBase() 15 | { 16 | this.unusedObjects = new Queue(16); 17 | } 18 | 19 | /// 生成 20 | public T Spawn() 21 | { 22 | T unit = null; 23 | if (unusedObjects.Count > 0) 24 | unit = unusedObjects.Dequeue(); 25 | else 26 | unit = Create(); 27 | OnSpawn(unit); 28 | return unit; 29 | } 30 | 31 | /// 回收 32 | public void Recycle(T unit) 33 | { 34 | unusedObjects.Enqueue(unit); 35 | OnRecycle(unit); 36 | } 37 | 38 | object IObjectPool.Spawn() 39 | { 40 | return Spawn(); 41 | } 42 | 43 | void IObjectPool.Recycle(object unit) 44 | { 45 | Recycle(unit as T); 46 | } 47 | 48 | public void Release() 49 | { 50 | while (unusedObjects.Count > 0) 51 | { 52 | OnDestroy(unusedObjects.Dequeue()); 53 | } 54 | } 55 | 56 | protected abstract T Create(); 57 | 58 | protected virtual void OnDestroy(T unit) 59 | { 60 | } 61 | 62 | protected virtual void OnSpawn(T unit) 63 | { 64 | } 65 | 66 | protected virtual void OnRecycle(T unit) 67 | { 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /Atom.ObjectPool/ObjectPoolBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4580ef637ac64097bd48398cdda7da08 3 | timeCreated: 1700126299 -------------------------------------------------------------------------------- /Atom.ObjectPool/ObjectPoolManager.ObjectPool.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Atom 3 | { 4 | public static partial class ObjectPoolManager 5 | { 6 | private class ObjectPool : ObjectPoolBase where T : class, new() 7 | { 8 | protected override T Create() 9 | { 10 | return new T(); 11 | } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Atom.ObjectPool/ObjectPoolManager.ObjectPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0a56f5a313b4135acea7566b2875100 3 | timeCreated: 1749131805 -------------------------------------------------------------------------------- /Atom.ObjectPool/ObjectPoolManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Atom 5 | { 6 | public static partial class ObjectPoolManager 7 | { 8 | private static Dictionary s_ObjectPools; 9 | 10 | static ObjectPoolManager() 11 | { 12 | s_ObjectPools = new Dictionary(64); 13 | } 14 | 15 | public static void RegisterPool(IObjectPool pool) 16 | { 17 | if (HasPool(pool.UnitType)) 18 | throw new InvalidOperationException($"already registered pool for type {pool.UnitType}"); 19 | 20 | s_ObjectPools.Add(pool.UnitType.GetHashCode(), pool); 21 | } 22 | 23 | public static void ReleasePool(Type unitType) 24 | { 25 | var objectPool = GetPool(unitType); 26 | if (objectPool == null) 27 | throw new InvalidOperationException($"can not found pool for type {unitType}"); 28 | 29 | s_ObjectPools.Remove(unitType.GetHashCode()); 30 | objectPool.Release(); 31 | } 32 | 33 | public static bool HasPool(Type unitType) 34 | { 35 | return s_ObjectPools.ContainsKey(unitType.GetHashCode()); 36 | } 37 | 38 | public static IObjectPool GetPool(Type unitType) 39 | { 40 | s_ObjectPools.TryGetValue(unitType.GetHashCode(), out var objectPool); 41 | return objectPool; 42 | } 43 | 44 | public static IObjectPool GetPool() 45 | { 46 | s_ObjectPools.TryGetValue(TypeCache.HASH, out var objectPool); 47 | return objectPool; 48 | } 49 | 50 | public static T Spawn() where T : class, new() 51 | { 52 | var objectPool = GetPool() as ObjectPoolBase; 53 | if (objectPool == null) 54 | { 55 | objectPool = new ObjectPool(); 56 | RegisterPool(objectPool); 57 | } 58 | 59 | var unit = objectPool.Spawn(); 60 | if (unit is IObject obj) 61 | obj.OnSpawn(); 62 | 63 | return unit; 64 | } 65 | 66 | public static object Spawn(Type unitType) 67 | { 68 | var objectPool = GetPool(unitType); 69 | if (objectPool == null) 70 | throw new InvalidOperationException($"can not found pool for type {unitType}"); 71 | 72 | var unit = objectPool.Spawn(); 73 | if (unit is IObject obj) 74 | obj.OnSpawn(); 75 | 76 | return unit; 77 | } 78 | 79 | public static void Recycle(object unit) 80 | { 81 | Recycle(unit.GetType(), unit); 82 | } 83 | 84 | public static void Recycle(Type unitType, object unit) 85 | { 86 | var objectPool = GetPool(unitType); 87 | if (objectPool == null) 88 | throw new InvalidOperationException($"can not found pool for type {unitType}"); 89 | 90 | if (unit is IObject poolableObject) 91 | poolableObject.OnRecycle(); 92 | 93 | objectPool.Recycle(unit); 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /Atom.ObjectPool/ObjectPoolManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae3bb2a4e86eb904fa3df61efe9cacfa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ReferenceCollector.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 849af31d6841bdb45ac012fba1a1b3e5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.ReferenceCollector/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b904dba06602c824497fb47156e0f051 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.ReferenceCollector/Editor/ReferenceCollectorInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32dd928d33b65404c8b96734f87987e4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ReferenceCollector/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 741a02f9c2694654caee31a31db156c2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.ReferenceCollector/Runtime/ReferenceCollector.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using UnityEngine; 22 | using UnityObject = UnityEngine.Object; 23 | 24 | namespace Atom 25 | { 26 | [DisallowMultipleComponent] 27 | public class ReferenceCollector : MonoBehaviour 28 | { 29 | [Serializable] 30 | public class ReferencePair 31 | { 32 | public string key; 33 | public UnityObject value; 34 | } 35 | 36 | #if !UNITY_EDITOR 37 | [SerializeField] private List references = new List(); 38 | #else 39 | [SerializeField] 40 | public List references = new List(); 41 | #endif 42 | 43 | private Dictionary referencesMap; 44 | 45 | private Dictionary ReferencesMap 46 | { 47 | get 48 | { 49 | if (referencesMap == null) 50 | { 51 | InitReferencesMap(); 52 | } 53 | return referencesMap; 54 | } 55 | } 56 | 57 | public IReadOnlyList References => references; 58 | 59 | private void InitReferencesMap() 60 | { 61 | var tempReferencesMap = new Dictionary(); 62 | foreach (var pair in references) 63 | { 64 | if (string.IsNullOrEmpty(pair.key)) 65 | continue; 66 | tempReferencesMap.Add(pair.key, pair); 67 | } 68 | 69 | referencesMap = tempReferencesMap; 70 | } 71 | 72 | public bool Contains(string key) 73 | { 74 | return ReferencesMap.ContainsKey(key); 75 | } 76 | 77 | public T Get(string key) where T : UnityObject 78 | { 79 | if (ReferencesMap.TryGetValue(key, out var obj)) 80 | { 81 | return obj.value as T; 82 | } 83 | 84 | return null; 85 | } 86 | 87 | public void Set(string key, UnityObject uo) 88 | { 89 | if (referencesMap != null && referencesMap.TryGetValue(key, out var pair)) 90 | { 91 | pair.value = uo; 92 | } 93 | else 94 | { 95 | pair = new ReferencePair() { key = key, value = uo }; 96 | if (referencesMap != null) 97 | referencesMap.Add(pair.key, pair); 98 | references.Add(pair); 99 | } 100 | } 101 | 102 | public void Remove(string key) 103 | { 104 | if (referencesMap != null && referencesMap.TryGetValue(key, out var pair)) 105 | { 106 | referencesMap.Remove(key); 107 | references.RemoveAll(item => item.key == key); 108 | } 109 | else 110 | { 111 | references.RemoveAll(item => item.key == key); 112 | } 113 | } 114 | 115 | private void OnValidate() 116 | { 117 | referencesMap = null; 118 | } 119 | } 120 | } -------------------------------------------------------------------------------- /Atom.ReferenceCollector/Runtime/ReferenceCollector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7efa2ae9f903bc74890c89bb90f515e5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.StaticMethod.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5771a5ed7af8a674a98187b52ed10dcb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.StaticMethod/IStaticMethod.cs: -------------------------------------------------------------------------------- 1 | namespace Atom 2 | { 3 | public interface IStaticMethod 4 | { 5 | void Run(object[] args); 6 | } 7 | } -------------------------------------------------------------------------------- /Atom.StaticMethod/IStaticMethod.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a405a3637574bf4dbba0fa2acb9b2b2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.StaticMethod/StaticMethod.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13f01ff9053e7cf4bab37b85081b2a5a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ViewModel.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb9561f4924a8a440a16f4a659d4894c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.ViewModel/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce20920bf7a5a394fa7eb45b7f2972c6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.ViewModel/Attributes/ViewModelAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | [AttributeUsage(AttributeTargets.Class)] 6 | public class ViewModelAttribute : Attribute 7 | { 8 | public Type modelType; 9 | 10 | public ViewModelAttribute(Type modelType) 11 | { 12 | this.modelType = modelType; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Atom.ViewModel/Attributes/ViewModelAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cb2c7be3c89a0b4fb73bdf38936fa18 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ViewModel/BindableCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b853ca0fe42c4c8bbf3ae9a6a98fe4be 3 | timeCreated: 1746775976 -------------------------------------------------------------------------------- /Atom.ViewModel/BindableDictionary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b76080bc379d5847bee11a7614e6247 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ViewModel/BindableList.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | 22 | namespace Atom 23 | { 24 | public class BindableList : BindableCollection, T> 25 | { 26 | public BindableList() : base(new List()) 27 | { 28 | } 29 | 30 | public BindableList(List list) : base(list) 31 | { 32 | } 33 | 34 | public BindableList(Func> getter, Action> setter) : base(getter, setter) 35 | { 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Atom.ViewModel/BindableList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52b498ba5ae8be940a2b5f242d300a51 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ViewModel/BindableProperty.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c973613bf826d2147950e82d193b11e6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ViewModel/BindableSharedVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c523b312e84c47dfbb5045274de5d611 3 | timeCreated: 1698136389 -------------------------------------------------------------------------------- /Atom.ViewModel/BindableStack.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using System.Collections; 18 | using System.Collections.Generic; 19 | 20 | namespace Atom 21 | { 22 | public class BindableStack : BindableProperty>, IEnumerable 23 | { 24 | public event Action onPushed; 25 | public event Action onPoped; 26 | public event Action onClear; 27 | 28 | public int Count 29 | { 30 | get { return Value.Count; } 31 | } 32 | public bool IsReadOnly 33 | { 34 | get { return false; } 35 | } 36 | 37 | public BindableStack(Func> getter, Action> setter) : base(getter, setter) { } 38 | 39 | public void Push(T item) 40 | { 41 | Value.Push(item); 42 | onPushed?.Invoke(); 43 | } 44 | 45 | public T Pop() 46 | { 47 | var t = Value.Pop(); 48 | onPoped?.Invoke(); 49 | return t; 50 | } 51 | 52 | public T Peek() 53 | { 54 | return Value.Peek(); 55 | } 56 | 57 | public void TrimExcess() 58 | { 59 | Value.TrimExcess(); 60 | } 61 | 62 | public void Clear() 63 | { 64 | Value.Clear(); 65 | onClear?.Invoke(); 66 | } 67 | 68 | public IEnumerator GetEnumerator() 69 | { 70 | return Value.GetEnumerator(); 71 | } 72 | 73 | IEnumerator IEnumerable.GetEnumerator() 74 | { 75 | return Value.GetEnumerator(); 76 | } 77 | 78 | public bool Contains(T item) 79 | { 80 | return Value.Contains(item); 81 | } 82 | 83 | public void CopyTo(T[] array, int arrayIndex) 84 | { 85 | Value.CopyTo(array, arrayIndex); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Atom.ViewModel/BindableStack.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fa8c87c5f650ea44bd275a8aaaaec44 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ViewModel/Bridged.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dfecfba602064347b141225d624f6426 3 | timeCreated: 1746782042 -------------------------------------------------------------------------------- /Atom.ViewModel/Bridged/BridgedCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 592b2085fef3417f810361e9481f7bce 3 | timeCreated: 1746781490 -------------------------------------------------------------------------------- /Atom.ViewModel/Bridged/BridgedValue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface IBridgedValue 6 | { 7 | T Value { get; set; } 8 | } 9 | 10 | [Serializable] 11 | public class BridgedValue : IBridgedValue 12 | { 13 | private T m_value; 14 | 15 | public T Value 16 | { 17 | get => m_value; 18 | set => m_value = value; 19 | } 20 | 21 | public BridgedValue(T value) 22 | { 23 | this.m_value = value; 24 | } 25 | } 26 | 27 | [Serializable] 28 | public class BridgedValueGetterSetter : IBridgedValue 29 | { 30 | private Func m_valueGetter; 31 | private Action m_valueSetter; 32 | 33 | public T Value 34 | { 35 | get => m_valueGetter(); 36 | set => m_valueSetter(value); 37 | } 38 | 39 | public BridgedValueGetterSetter(Func valueGetter, Action valueSetter) 40 | { 41 | this.m_valueGetter = valueGetter; 42 | this.m_valueSetter = valueSetter; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Atom.ViewModel/Bridged/BridgedValue.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1257f1cae4c247b5b361410a33b1d533 3 | timeCreated: 1746777091 -------------------------------------------------------------------------------- /Atom.ViewModel/ExternalViewModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f5965a69aa44898b6871f3696116fa4 3 | timeCreated: 1731553614 -------------------------------------------------------------------------------- /Atom.ViewModel/Interfaces.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1990c7f27e48b2048bd8b94e63374954 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.ViewModel/Interfaces/IBindableProperty.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom 19 | { 20 | public interface IBindableProperty 21 | { 22 | event Action BoxedValueChanged; 23 | 24 | object BoxedValue { get; set; } 25 | Type ValueType { get; } 26 | 27 | bool SetValue(object value); 28 | void SetValueWithoutNotify(object value); 29 | void NotifyValueChanged(); 30 | void ClearValueChangedEvent(); 31 | } 32 | 33 | public interface IBindableProperty 34 | { 35 | event Action ValueChanged; 36 | 37 | T Value { get; set; } 38 | 39 | bool SetValue(T value); 40 | void SetValueWithoutNotify(T value); 41 | void RegisterValueChangedEvent(Action onValueChanged); 42 | void UnregisterValueChangedEvent(Action onValueChanged); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Atom.ViewModel/Interfaces/IBindableProperty.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02b0d6add3190a04189a121ddfdaefae 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ViewModel/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 473674ae3cdc4f94caf369be02d5d22f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Atom.ViewModel/Utils/BindablePropertyEX.cs: -------------------------------------------------------------------------------- 1 | namespace Atom 2 | { 3 | public static class BindablePropertyEX 4 | { 5 | public static IBindableProperty AsBindableProperty(this IBindableProperty property) 6 | { 7 | return property as IBindableProperty; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /Atom.ViewModel/Utils/BindablePropertyEX.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80737d005ab4422285160c69d7105586 3 | timeCreated: 1699238936 -------------------------------------------------------------------------------- /Atom.ViewModel/Utils/ViewModelFactory.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71b75784623aab64d9d668641be5fe9e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Atom.ViewModel/ViewModel.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace Atom 25 | { 26 | public abstract class ViewModel : INotifyPropertyChanged 27 | { 28 | public struct ValueChangedArg 29 | { 30 | public T oldValue; 31 | public T newValue; 32 | } 33 | 34 | public event PropertyChangedEventHandler PropertyChanged; 35 | 36 | private EventService Events { get; } = new EventService(); 37 | 38 | /// 39 | /// 只在属性中调用 40 | /// 41 | /// 42 | /// 43 | /// 44 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 45 | public ref T GetFieldValue(ref T field) => ref field; 46 | 47 | /// 48 | /// 只在属性中调用 49 | /// 50 | /// 51 | /// 52 | /// 53 | /// 54 | /// 55 | public bool SetFieldValue(ref T field, T value, string propertyName) 56 | { 57 | if (EqualityComparer.Default.Equals(field, value)) 58 | { 59 | return false; 60 | } 61 | 62 | var oldValue = field; 63 | field = value; 64 | Events.Publish(propertyName, new ValueChangedArg() { oldValue = oldValue, newValue = value }); 65 | 66 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 67 | OnPropertyChanged(propertyName); 68 | return true; 69 | } 70 | 71 | public void RegisterValueChanged(string name, Action> valueChangedCallback) => Events.Subscribe(name, valueChangedCallback); 72 | 73 | public void UnregisterValueChanged(string name, Action> valueChangedCallback) => Events.Unsubscribe(name, valueChangedCallback); 74 | 75 | public void UnregisterAllValueChanged(string name) => Events.Remove(name); 76 | 77 | protected virtual void OnPropertyChanged(string propertyName) 78 | { 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /Atom.ViewModel/ViewModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6abd36ebaa168a49859d775a165877b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 021496a6708849009db0bf35de9e4556 3 | timeCreated: 1698401397 -------------------------------------------------------------------------------- /Core/CommonTrees.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ac1b0be39f7428fa507fad32041c1a3 3 | timeCreated: 1693364636 -------------------------------------------------------------------------------- /Core/CommonTrees/BinaryTree.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23453d051c24a4144b6f8d09991eeb05 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/CommonTrees/FullBinaryTree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public class FullBinaryTreeNode 6 | { 7 | 8 | private int type; 9 | private object userData; 10 | public FullBinaryTreeNode parent; 11 | public FullBinaryTreeNode[] children = new FullBinaryTreeNode[2]; 12 | 13 | public int Type 14 | { 15 | get { return type; } 16 | } 17 | 18 | public object UserData 19 | { 20 | get { return userData; } 21 | set { userData = value; } 22 | } 23 | 24 | public FullBinaryTreeNode Left 25 | { 26 | get { return children[0]; } 27 | set { children[0] = value; } 28 | } 29 | 30 | public FullBinaryTreeNode Right 31 | { 32 | get { return children[1]; } 33 | set { children[1] = value; } 34 | } 35 | 36 | public void SetChild(int nodeType, FullBinaryTreeNode child) 37 | { 38 | if (child == null) 39 | throw new NullReferenceException(); 40 | 41 | child.parent = this; 42 | child.type = nodeType; 43 | children[nodeType] = child; 44 | } 45 | 46 | public FullBinaryTreeNode GetOrCreateChild(int nodeType) 47 | { 48 | var child = children[nodeType]; 49 | if (child == null) 50 | { 51 | child = new FullBinaryTreeNode(); 52 | SetChild(nodeType, child); 53 | } 54 | 55 | return child; 56 | } 57 | 58 | public void RemoveChild(FullBinaryTreeNode child) 59 | { 60 | if (child == null) 61 | throw new NullReferenceException(); 62 | 63 | if (child.parent != this) 64 | throw new InvalidOperationException(); 65 | 66 | if (child != children[child.type]) 67 | throw new InvalidOperationException(); 68 | 69 | child.parent = null; 70 | children[child.type] = null; 71 | } 72 | 73 | public void RemoveChild(int nodeType) 74 | { 75 | var child = children[nodeType]; 76 | RemoveChild(child); 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /Core/CommonTrees/FullBinaryTree.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eff28234c8e0443a99396d0a57dd5b88 3 | timeCreated: 1718267397 -------------------------------------------------------------------------------- /Core/CommonTrees/Octree.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ac9163bc3ee4617b4579d2c3af41df6 3 | timeCreated: 1693191852 -------------------------------------------------------------------------------- /Core/CommonTrees/QuadTree.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4ea1e69adb689d459f235658e88f30d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Game.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51c5d57c78a9467693ce81270edaeb1d 3 | timeCreated: 1737524235 -------------------------------------------------------------------------------- /Core/Game/Game.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e90a195813974859acbfcaa179dfd794 3 | timeCreated: 1690354204 -------------------------------------------------------------------------------- /Core/Game/Singletons.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5a827049f9a333479e79703abdaff9c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/Game/Singletons/Singletons.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9d0ab214d4ac4b088ae4f09fee70373e 3 | timeCreated: 1693896094 -------------------------------------------------------------------------------- /Core/Game/Singletons/Singletons/AutoSingleton.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 主题: 单例基类 7 | * Description: 8 | * 功能: 自动创建单例对象 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | 21 | namespace Atom 22 | { 23 | public abstract class AutoSingleton : ISingleton where T : AutoSingleton, new() 24 | { 25 | #region Static 26 | 27 | private static object @lock = new object(); 28 | private bool isDisposed; 29 | 30 | private static T instance; 31 | 32 | public static T Instance 33 | { 34 | get 35 | { 36 | if (instance == null) 37 | { 38 | lock (@lock) 39 | { 40 | if (instance == null) 41 | { 42 | Game.AddSingleton(new T()); 43 | } 44 | } 45 | } 46 | 47 | return instance; 48 | } 49 | } 50 | 51 | public static bool IsInitialized() 52 | { 53 | return instance != null; 54 | } 55 | 56 | #endregion 57 | 58 | public bool IsDisposed => this.isDisposed; 59 | 60 | public void Register() 61 | { 62 | if (instance != null) 63 | throw new Exception($"singleton register twice! {TypeCache.TYPE.Name}"); 64 | 65 | instance = (T)this; 66 | } 67 | 68 | public void Dispose() 69 | { 70 | if (this.isDisposed) 71 | return; 72 | 73 | this.isDisposed = true; 74 | if (this is ISingletonDestory iSingletonDestory) 75 | iSingletonDestory.Destroy(); 76 | if (this == instance) 77 | instance = null; 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /Core/Game/Singletons/Singletons/AutoSingleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 59cc2ff91c50470ca53f286b6b948047 3 | timeCreated: 1690356285 -------------------------------------------------------------------------------- /Core/Game/Singletons/Singletons/ISingleton.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 主题: 单例基类 7 | * Description: 8 | * 功能: 自动创建单例对象 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | 21 | namespace Atom 22 | { 23 | public interface ISingleton : IDisposable 24 | { 25 | bool IsDisposed { get; } 26 | 27 | void Register(); 28 | } 29 | 30 | public interface ISingletonAwake 31 | { 32 | void Awake(); 33 | } 34 | 35 | public interface ISingletonFixedUpdate 36 | { 37 | void FixedUpdate(); 38 | } 39 | 40 | public interface ISingletonUpdate 41 | { 42 | void Update(); 43 | } 44 | 45 | public interface ISingletonLateUpdate 46 | { 47 | void LateUpdate(); 48 | } 49 | 50 | public interface ISingletonDestory 51 | { 52 | void Destroy(); 53 | } 54 | } -------------------------------------------------------------------------------- /Core/Game/Singletons/Singletons/ISingleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08e2cc7cd8e144438d09eb1047e0c6bb 3 | timeCreated: 1690354327 -------------------------------------------------------------------------------- /Core/Game/Singletons/Singletons/Singleton.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 主题: 单例基类 7 | * Description: 8 | * 功能: 自动创建单例对象 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | 21 | namespace Atom 22 | { 23 | [Serializable] 24 | public abstract class Singleton : ISingleton where T : Singleton 25 | { 26 | #region Static 27 | 28 | private static T s_Instance; 29 | 30 | public static T Instance => s_Instance; 31 | 32 | public static bool IsInitialized() 33 | { 34 | return s_Instance != null; 35 | } 36 | 37 | #endregion 38 | 39 | private bool isDisposed; 40 | 41 | public bool IsDisposed => this.isDisposed; 42 | 43 | public void Register() 44 | { 45 | if (s_Instance != null) 46 | throw new Exception($"singleton register twice! {TypeCache.TYPE.Name}"); 47 | 48 | s_Instance = (T)this; 49 | } 50 | 51 | public void Dispose() 52 | { 53 | if (this.isDisposed) 54 | return; 55 | 56 | this.isDisposed = true; 57 | if (s_Instance is ISingletonDestory iSingletonDestory) 58 | iSingletonDestory.Destroy(); 59 | s_Instance = null; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Core/Game/Singletons/Singletons/Singleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db182c9f2492da147a629de68d888c05 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Game/World.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa8530a65f1e41918b45abd2d24c1308 3 | timeCreated: 1703572468 -------------------------------------------------------------------------------- /Core/Game/World/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf375ed8aad042478464ea06c411de6b 3 | timeCreated: 1737524154 -------------------------------------------------------------------------------- /Core/Game/World/Core/IScene.cs: -------------------------------------------------------------------------------- 1 | namespace Atom 2 | { 3 | public interface IScene 4 | { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/IScene.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0c30f94d5344edebe30569da6c288b4 3 | timeCreated: 1742354981 -------------------------------------------------------------------------------- /Core/Game/World/Core/MainWorld.cs: -------------------------------------------------------------------------------- 1 | namespace Atom 2 | { 3 | public class MainWorld : Singleton, ISingletonAwake, ISingletonDestory, ISingletonFixedUpdate, ISingletonUpdate, ISingletonLateUpdate 4 | { 5 | private World world; 6 | 7 | public World World => world; 8 | 9 | public Scene Root => world.Root; 10 | 11 | public void Awake() 12 | { 13 | this.world = new World(); 14 | } 15 | 16 | public void Destroy() 17 | { 18 | world.Dispose(); 19 | } 20 | 21 | public void FixedUpdate() 22 | { 23 | world.Publish(); 24 | } 25 | 26 | public void Update() 27 | { 28 | world.Publish(); 29 | } 30 | 31 | public void LateUpdate() 32 | { 33 | world.Publish(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/MainWorld.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e773ad6f61ca496a9d723acf78c1a5ad 3 | timeCreated: 1703572475 -------------------------------------------------------------------------------- /Core/Game/World/Core/Node.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4fef5d0c9da2409884abb54fc0a14fd3 3 | timeCreated: 1703570787 -------------------------------------------------------------------------------- /Core/Game/World/Core/Scene.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Atom 3 | { 4 | public class Scene : Node, IScene 5 | { 6 | private string name; 7 | 8 | public override string ViewName => name; 9 | 10 | public Scene(string name, World world) 11 | { 12 | this.name = name; 13 | this.World = world; 14 | this.Scene = this; 15 | this.InstanceId = World.GenerateInstanceId(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/Scene.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e573f60e663d43b6a31cf72e4165f6dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Game/World/Core/System.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a5dda9d1a3a4b60a623ce401768daeb 3 | timeCreated: 1703576726 -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IAddComponentSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface IAddComponentSystem : ISystem_EA 6 | { 7 | 8 | } 9 | 10 | public abstract class AddComponentSystem : IAddComponentSystem where T : Node 11 | { 12 | public Type NodeType() => TypeCache.TYPE; 13 | 14 | public Type SystemType() => typeof(IAddComponentSystem); 15 | 16 | public void Execute(Node o, Node c) => AddComponent((T)o, c); 17 | 18 | protected abstract void AddComponent(T self, Node component); 19 | } 20 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IAddComponentSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41d335324e1c4b68bd886bfc73edbaa7 3 | timeCreated: 1703577045 -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IAwakeSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface IAwakeSystem : ISystem_E 6 | { 7 | } 8 | 9 | public interface IAwakeSystem : ISystem_EA 10 | { 11 | } 12 | 13 | public abstract class AwakeSystem : IAwakeSystem where N : Node 14 | { 15 | public Type NodeType() => TypeCache.TYPE; 16 | 17 | public Type SystemType() => TypeCache.TYPE; 18 | 19 | public void Execute(Node o) => Awake((N)o); 20 | 21 | protected abstract void Awake(N o); 22 | } 23 | 24 | public abstract class AwakeSystem : IAwakeSystem where N : Node 25 | { 26 | public Type NodeType() => TypeCache.TYPE; 27 | 28 | public Type SystemType() => TypeCache>.TYPE; 29 | 30 | public void Execute(Node o, TArg arg) => Awake((N)o, arg); 31 | 32 | protected abstract void Awake(N o, TArg arg); 33 | } 34 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IAwakeSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2872c4f7b32d47baa518a755ca585c0a 3 | timeCreated: 1703576733 -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IDestroySystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface IDestroySystem : ISystem_E 6 | { 7 | } 8 | 9 | public abstract class DestroySystem : IDestroySystem where T : Node 10 | { 11 | public Type NodeType() => TypeCache.TYPE; 12 | 13 | public Type SystemType() => typeof(IDestroySystem); 14 | 15 | public void Execute(Node o) => Destroy((T)o); 16 | 17 | protected abstract void Destroy(T o); 18 | } 19 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IDestroySystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86a0e7690e644b1aac977ce25c06a2c2 3 | timeCreated: 1703577238 -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IFixedUpdateSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface IFixedUpdateSystem : ISystem_E 6 | { 7 | } 8 | 9 | public abstract class FixedUpdateSystem : IFixedUpdateSystem where N : Node 10 | { 11 | public Type NodeType() => TypeCache.TYPE; 12 | 13 | public Type SystemType() => TypeCache.TYPE; 14 | 15 | public void Execute(Node o) => FixedUpdate((N)o); 16 | 17 | protected abstract void FixedUpdate(N o); 18 | } 19 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IFixedUpdateSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2129c4b88faf419c861434ad1e960e36 3 | timeCreated: 1704553260 -------------------------------------------------------------------------------- /Core/Game/World/Core/System/ILateUpdateSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface ILateUpdateSystem : ISystem_E 6 | { 7 | } 8 | 9 | public abstract class LateUpdateSystem : ILateUpdateSystem where N : Node 10 | { 11 | public Type NodeType() => TypeCache.TYPE; 12 | 13 | public Type SystemType() => TypeCache.TYPE; 14 | 15 | public void Execute(Node o) => LateUpdate((N)o); 16 | 17 | protected abstract void LateUpdate(N o); 18 | } 19 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/System/ILateUpdateSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a575c7b787ae4b4ea708f5e3820c3ec5 3 | timeCreated: 1703577393 -------------------------------------------------------------------------------- /Core/Game/World/Core/System/ISystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface ISystem 6 | { 7 | Type NodeType(); 8 | 9 | Type SystemType(); 10 | } 11 | 12 | public interface ISystem_E : ISystem 13 | { 14 | void Execute(Node n); 15 | } 16 | 17 | public interface ISystem_EA : ISystem 18 | { 19 | void Execute(Node n, TArg arg); 20 | } 21 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/System/ISystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc47c855e2aa4f89884698a1a49ea479 3 | timeCreated: 1703577433 -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IUpdateSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public interface IUpdateSystem : ISystem_E 6 | { 7 | } 8 | 9 | public abstract class UpdateSystem : IUpdateSystem where N : Node 10 | { 11 | public Type NodeType() => TypeCache.TYPE; 12 | 13 | public Type SystemType() => TypeCache.TYPE; 14 | 15 | public void Execute(Node o) => Update((N)o); 16 | 17 | protected abstract void Update(N o); 18 | } 19 | } -------------------------------------------------------------------------------- /Core/Game/World/Core/System/IUpdateSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21b1304faa7c41659eddde0e6a08d6f2 3 | timeCreated: 1703577330 -------------------------------------------------------------------------------- /Core/Game/World/Core/Systems.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a840c9f5e1cd48dea603acfd6b04479e 3 | timeCreated: 1703574014 -------------------------------------------------------------------------------- /Core/Game/World/Core/World.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1257d54ad5c2460b837af32bcdb80179 3 | timeCreated: 1718985824 -------------------------------------------------------------------------------- /Core/Game/World/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2296b2e3b53c8484fb17b3f78eabbfd9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/Game/World/Editor/Menus.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Linq; 3 | using UnityEditor; 4 | 5 | namespace Atom.UnityEditors 6 | { 7 | public class Menus 8 | { 9 | public const string WORLD_TREE_PREVIEW_DEFINE = "WORLD_TREE_PREVIEW"; 10 | 11 | #if HALOMAN 12 | [MenuItem("Tools/Atom/World Tree/Enable World Tree Preview")] 13 | #endif 14 | public static void SwitchPreview() 15 | { 16 | var targetGroup = BuildTargetGroup.Standalone; // 选择目标平台 17 | var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup).Split(';').ToList(); 18 | if (defines.Contains(WORLD_TREE_PREVIEW_DEFINE)) 19 | defines.Remove(WORLD_TREE_PREVIEW_DEFINE); 20 | else 21 | defines.Add(WORLD_TREE_PREVIEW_DEFINE); 22 | PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, defines.ToArray()); 23 | } 24 | 25 | #if HALOMAN 26 | [MenuItem("Tools/Atom/World Tree/Enable World Tree Preview", validate = true)] 27 | #endif 28 | public static bool EnablePreviewValid() 29 | { 30 | var targetGroup = BuildTargetGroup.Standalone; // 选择目标平台 31 | var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup).Split(';').ToList(); 32 | Menu.SetChecked("Tools/Atom/World Tree/Enable World Tree Preview", defines.Contains(WORLD_TREE_PREVIEW_DEFINE)); 33 | return true; 34 | } 35 | } 36 | } 37 | #endif -------------------------------------------------------------------------------- /Core/Game/World/Editor/Menus.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9973d5ed37622a14fa6940d6895bb624 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Game/World/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8dd92595a39191140ad4b4ffbe9f80d5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/Game/World/Runtime/WorldTreeNodePreview.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Serialization; 3 | 4 | #if UNITY_EDITOR 5 | using UnityEditor; 6 | #endif 7 | 8 | namespace Atom 9 | { 10 | public class WorldTreeNodePreview : MonoBehaviour 11 | { 12 | #if ODIN_INSPECTOR 13 | [FormerlySerializedAs("Component")] 14 | [Sirenix.OdinInspector.HideReferenceObjectPicker] 15 | [Sirenix.OdinInspector.HideLabel] 16 | #endif 17 | [SerializeReference] 18 | public Node component; 19 | } 20 | 21 | #if UNITY_EDITOR 22 | [CustomEditor(typeof(WorldTreeNodePreview))] 23 | #if ODIN_INSPECTOR 24 | public class NodePreviewInspector : Sirenix.OdinInspector.Editor.OdinEditor 25 | #else 26 | public class NodePreviewInspector : Editor 27 | #endif 28 | { 29 | #if ODIN_INSPECTOR 30 | protected override void DrawTree() 31 | { 32 | this.Tree.DrawMonoScriptObjectField = false; 33 | base.DrawTree(); 34 | } 35 | #endif 36 | 37 | public override void OnInspectorGUI() 38 | { 39 | var node = target as WorldTreeNodePreview; 40 | EditorGUI.BeginDisabledGroup(true); 41 | EditorGUILayout.LongField("Instance Id", node.component.InstanceId); 42 | EditorGUI.EndDisabledGroup(); 43 | base.OnInspectorGUI(); 44 | } 45 | } 46 | #endif 47 | } -------------------------------------------------------------------------------- /Core/Game/World/Runtime/WorldTreeNodePreview.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e91f8209d73f0cd48b4c6ac3dad72f76 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Game/World/Runtime/WorldTreePreviewRoot.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Atom 4 | { 5 | public class WorldTreePreviewRoot : MonoBehaviour 6 | { 7 | private static WorldTreePreviewRoot s_Instance; 8 | 9 | public static WorldTreePreviewRoot Instance 10 | { 11 | get { return s_Instance; } 12 | } 13 | 14 | private void Awake() 15 | { 16 | if (s_Instance != null) 17 | return; 18 | 19 | s_Instance = this; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Core/Game/World/Runtime/WorldTreePreviewRoot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85ae666c686213a428f59fe8fc627e4e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Unsafe.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fbbb64ec3c8140ddae6d47f62cc41ce9 3 | timeCreated: 1678246931 -------------------------------------------------------------------------------- /Core/Unsafe/UnsafeUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa4c544b4729b6d449752d0f73ede0b5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0bcb54507424df8a5fd7bd5b8ab5039 3 | timeCreated: 1678673877 -------------------------------------------------------------------------------- /Core/Utility/CollectionEx.BinarySearch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88ca1b43c34143f39e01e82da42e660a 3 | timeCreated: 1718087409 -------------------------------------------------------------------------------- /Core/Utility/CollectionEx.BubbleSort.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ecbaffced33441bb931c7057dd68bc1 3 | timeCreated: 1718087469 -------------------------------------------------------------------------------- /Core/Utility/CollectionEx.HeapSort.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87c33f2de0ef4c4181d5f875f4472a80 3 | timeCreated: 1718268935 -------------------------------------------------------------------------------- /Core/Utility/CollectionEx.InsertionSort.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc1f1d5843094503b148f3f5f684a904 3 | timeCreated: 1718088126 -------------------------------------------------------------------------------- /Core/Utility/CollectionEx.QuickSort.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92abaaf7f07e4a22a139fabbbf8de5ab 3 | timeCreated: 1718087350 -------------------------------------------------------------------------------- /Core/Utility/CollectionEx.SelectionSort.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c066a0bfd2e84645b1c5a20e639d70c2 3 | timeCreated: 1718093096 -------------------------------------------------------------------------------- /Core/Utility/CollectionEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Atom 5 | { 6 | public static partial class CollectionEx 7 | { 8 | /// 9 | /// 洗牌 10 | /// 11 | /// 12 | /// 13 | /// 14 | public static void Shuffle(this IList original, Random random = null) 15 | { 16 | random = random == null ? Consts.DefaultRandom : random; 17 | Shuffle(original, 0, original.Count - 1, random); 18 | } 19 | 20 | /// 21 | /// 洗牌 22 | /// 23 | /// 24 | /// 25 | /// 26 | /// 27 | /// 28 | public static void Shuffle(this IList original, int startIndex, int endIndex, Random random = null) 29 | { 30 | random = random == null ? Consts.DefaultRandom : random; 31 | while (endIndex-- - startIndex > 0) 32 | { 33 | var index = random.Next(startIndex, endIndex + 1); 34 | if (index != endIndex) 35 | (original[endIndex], original[index]) = (original[index], original[endIndex]); 36 | } 37 | } 38 | 39 | public static unsafe void Shuffle(T* original, int startIndex, int endIndex, Random random = null) where T : unmanaged 40 | { 41 | random = random == null ? Consts.DefaultRandom : random; 42 | while (endIndex-- - startIndex > 0) 43 | { 44 | var index = random.Next(startIndex, endIndex + 1); 45 | if (index != endIndex) 46 | (original[endIndex], original[index]) = (original[index], original[endIndex]); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Core/Utility/CollectionEx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 617e6e088ab44bf19a8bf3fbb24f3f7a 3 | timeCreated: 1692003860 -------------------------------------------------------------------------------- /Core/Utility/Consts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public static class Consts 6 | { 7 | public static readonly Random DefaultRandom = new Random(); 8 | } 9 | } -------------------------------------------------------------------------------- /Core/Utility/Consts.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be94400cae434f0682ab0dea26ff17b1 3 | timeCreated: 1717775469 -------------------------------------------------------------------------------- /Core/Utility/Easing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f884e404255205e469928a078b3e4ed9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Utility/ReflectionEx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe7b1170103a80142911ca48d9665d7c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Utility/Snowflake.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3733a63a16344d38ab0f0ac2f73af3d 3 | timeCreated: 1683194419 -------------------------------------------------------------------------------- /Core/Utility/TimeEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public static class TimeEx 6 | { 7 | public static long ToFileTimeUtcMs(this DateTime dateTime) 8 | { 9 | return dateTime.ToFileTimeUtc() / 10000; 10 | } 11 | 12 | public static long UTCToGMT(long utc) 13 | { 14 | return utc - 116444736000000000; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Core/Utility/TimeEx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cce255f46b1a49c595dee420c886cca9 3 | timeCreated: 1693735366 -------------------------------------------------------------------------------- /Core/Utility/TypeCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public static class TypeCache 6 | { 7 | public static readonly Type TYPE = typeof(T); 8 | 9 | public static readonly int HASH = TYPE.GetHashCode(); 10 | 11 | public static readonly long LONG_HASH = TYPE.TypeHandle.Value.ToInt64(); 12 | } 13 | } -------------------------------------------------------------------------------- /Core/Utility/TypeCache.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 382b8cae9d52445eba8d48796faea524 3 | timeCreated: 1735645563 -------------------------------------------------------------------------------- /Core/Utility/TypesCache.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0300a9e83eb0a5c4f8c96925283c8e27 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Atom_Common 2 | Atom的通用依赖库 3 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa6d80eb73fe1dd47b043bea4cbb569b 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2924684bdae94ea387a19416335f485a 3 | timeCreated: 1683689924 -------------------------------------------------------------------------------- /Unity/Audio.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8862c26cfd83c99429fb22fa4f5bb0ab 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/Audio/AudioManager.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Atom 3 | { 4 | public class AudioManager : Singleton, IAudioManager 5 | { 6 | private IAudioManager o; 7 | 8 | public void Install(IAudioManager o) 9 | { 10 | this.o = o; 11 | } 12 | 13 | public void Init(bool force = false) 14 | { 15 | this.o.Init(force); 16 | } 17 | 18 | public void Play(int audioId) 19 | { 20 | o.Play(audioId); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Unity/Audio/AudioManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97c73acd405fa7848a534be927295271 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/Audio/IAudioManager.cs: -------------------------------------------------------------------------------- 1 | namespace Atom 2 | { 3 | public interface IAudioManager 4 | { 5 | void Init(bool force = false); 6 | 7 | void Play(int audioId); 8 | } 9 | } -------------------------------------------------------------------------------- /Unity/Audio/IAudioManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad9231a9453745ada55c199dca5243b7 3 | timeCreated: 1716297654 -------------------------------------------------------------------------------- /Unity/EditorCoroutine.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d26536cd7404203b4b8ab23f2e8752f 3 | timeCreated: 1678674173 -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43441cf53aad5cd47b807fcfa0bcde01 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/CoroutineService.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System.Collections; 17 | using System.Collections.Generic; 18 | 19 | namespace Atom.UnityEditors.EditorCoroutine 20 | { 21 | public abstract class CoroutineService where T : class, ICoroutine 22 | { 23 | protected readonly Queue coroutineQueue = new Queue(); 24 | 25 | public void Update() 26 | { 27 | int count = coroutineQueue.Count; 28 | while (count-- > 0) 29 | { 30 | T coroutine = coroutineQueue.Dequeue(); 31 | if (!coroutine.IsRunning) continue; 32 | IYield condition = coroutine.Current; 33 | if (condition == null || condition.Result(coroutine)) 34 | { 35 | if (!coroutine.MoveNext()) 36 | continue; 37 | } 38 | coroutineQueue.Enqueue(coroutine); 39 | } 40 | } 41 | 42 | public abstract T StartCoroutine(IEnumerator enumerator); 43 | 44 | public abstract void StopCoroutine(T coroutine); 45 | } 46 | } -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/CoroutineService.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03c9886c4410cc64db1039134d0c5b5f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/EditorCoroutineService.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using System.Collections; 18 | 19 | namespace Atom.UnityEditors.EditorCoroutine 20 | { 21 | public partial class EditorCoroutineService : CoroutineService 22 | { 23 | public override EditorCoroutine StartCoroutine(IEnumerator enumerator) 24 | { 25 | EditorCoroutine coroutine = new EditorCoroutine(enumerator); 26 | coroutineQueue.Enqueue(coroutine); 27 | return coroutine; 28 | } 29 | 30 | public override void StopCoroutine(EditorCoroutine coroutine) 31 | { 32 | coroutine.Stop(); 33 | } 34 | } 35 | } 36 | #endif -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/EditorCoroutineService.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83d2bed93acb9e043873cf88fac1027c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/GlobalEditorCoroutineService.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | #region 注 释 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | #endregion 17 | using System.Collections; 18 | using UnityEditor; 19 | using UnityEngine; 20 | 21 | namespace Atom.UnityEditors.EditorCoroutine 22 | { 23 | [InitializeOnLoad] 24 | public class GlobalEditorCoroutineService 25 | { 26 | public class GlobalEditorCoroutineSetting 27 | { 28 | public bool open = false; 29 | } 30 | 31 | private static GlobalEditorCoroutineSetting s_Settings; 32 | private static EditorCoroutineService s_CoroutineService = new EditorCoroutineService(); 33 | 34 | static GlobalEditorCoroutineSetting Settings 35 | { 36 | get 37 | { 38 | if (s_Settings == null) 39 | { 40 | if (EditorPrefs.HasKey(KEY)) 41 | s_Settings = JsonUtility.FromJson(EditorPrefs.GetString(KEY)); 42 | else 43 | s_Settings = new GlobalEditorCoroutineSetting(); 44 | } 45 | return s_Settings; 46 | } 47 | } 48 | 49 | #region Perference 50 | public const string NAME = nameof(GlobalEditorCoroutineService); 51 | public const string KEY = "GlobalEditorCoroutine.Settings"; 52 | 53 | #if UNITY_2019_1_OR_NEWER && HALOMAN 54 | [SettingsProvider] 55 | public static SettingsProvider CreateSettingsProvider() 56 | { 57 | SettingsProvider provider = new SettingsProvider("Preferences/" + NAME, SettingsScope.User) 58 | { 59 | guiHandler = (searchContext) => { PreferencesGUI(); }, 60 | }; 61 | return provider; 62 | } 63 | #endif 64 | 65 | #if !UNITY_2019_1_OR_NEWER && HALOMAN 66 | [PreferenceItem(Name)] 67 | #endif 68 | private static void PreferencesGUI() 69 | { 70 | EditorGUI.BeginChangeCheck(); 71 | Settings.open = EditorGUILayout.Toggle("Open", Settings.open); 72 | if (EditorGUI.EndChangeCheck()) 73 | { 74 | EditorPrefs.SetString(KEY, JsonUtility.ToJson(Settings)); 75 | InitGlobalCoroutine(); 76 | 77 | } 78 | } 79 | #endregion 80 | 81 | static GlobalEditorCoroutineService() 82 | { 83 | InitGlobalCoroutine(); 84 | } 85 | 86 | static void InitGlobalCoroutine() 87 | { 88 | if (Settings.open) 89 | EditorApplication.update += Update; 90 | else 91 | EditorApplication.update -= Update; 92 | } 93 | 94 | static void Update() 95 | { 96 | s_CoroutineService.Update(); 97 | } 98 | 99 | public static ICoroutine StartCoroutine(IEnumerator enumerator) 100 | { 101 | return s_CoroutineService.StartCoroutine(enumerator); 102 | } 103 | 104 | public static void StopCoroutine(EditorCoroutine coroutine) 105 | { 106 | s_CoroutineService.StopCoroutine(coroutine); 107 | } 108 | } 109 | } 110 | #endif -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/GlobalEditorCoroutineService.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 506f9787a0a5c4548932e2e36e95cc22 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/Interfaces.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | namespace Atom.UnityEditors.EditorCoroutine 18 | { 19 | public interface IYield 20 | { 21 | bool Result(ICoroutine coroutine); 22 | } 23 | 24 | public interface ICoroutine 25 | { 26 | bool IsRunning { get; } 27 | IYield Current { get; } 28 | 29 | bool MoveNext(); 30 | void Stop(); 31 | } 32 | } -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/Interfaces.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92a5db64d9e27614cb855e5f6f853d3c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/UnityCoroutine.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using System.Collections; 18 | using System.Collections.Generic; 19 | using System.Reflection; 20 | using UnityEditor; 21 | using UnityEngine; 22 | 23 | namespace Atom.UnityEditors.EditorCoroutine 24 | { 25 | public class EditorCoroutine : ICoroutine, IYield 26 | { 27 | IEnumerator enumerator; 28 | Dictionary cache = new Dictionary(); 29 | 30 | public bool IsRunning { get; private set; } = true; 31 | public double TimeSinceStartup { get; private set; } 32 | public int FrameSinceStartup { get; private set; } 33 | public IYield Current { get { return Get(enumerator.Current); } } 34 | 35 | public IYield Get(object source) 36 | { 37 | if (source == null) 38 | return null; 39 | switch (source) 40 | { 41 | case WaitForSeconds wfs: 42 | { 43 | int hash = wfs.GetHashCode(); 44 | if (!cache.TryGetValue(hash, out IYield y)) 45 | { 46 | const BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; 47 | FieldInfo field = typeof(WaitForSeconds).GetField("m_Seconds", bindingFlags); 48 | if (field != null) 49 | y = new EditorWaitForSeconds(float.Parse(field.GetValue(wfs).ToString())); 50 | else 51 | y = null; 52 | cache[hash] = y; 53 | } 54 | return y; 55 | } 56 | default: 57 | break; 58 | } 59 | return source as IYield; 60 | } 61 | 62 | public EditorCoroutine(IEnumerator enumerator) 63 | { 64 | this.enumerator = enumerator; 65 | } 66 | 67 | public bool MoveNext() 68 | { 69 | TimeSinceStartup = EditorApplication.timeSinceStartup; 70 | return IsRunning = enumerator.MoveNext(); 71 | } 72 | 73 | public void Stop() 74 | { 75 | IsRunning = false; 76 | } 77 | 78 | public bool Result(ICoroutine coroutine) 79 | { 80 | return !IsRunning; 81 | } 82 | } 83 | } 84 | #endif -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/UnityCoroutine.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 061db785244249d586e78a38329aa7db 3 | timeCreated: 1678674873 -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/YieldInstruction.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using System; 18 | using UnityEditor; 19 | 20 | namespace Atom.UnityEditors.EditorCoroutine 21 | { 22 | public class EditorWaitForSeconds : IYield 23 | { 24 | readonly float seconds; 25 | 26 | public EditorWaitForSeconds(float seconds) 27 | { 28 | this.seconds = seconds; 29 | } 30 | 31 | public bool Result(ICoroutine coroutine) 32 | { 33 | var editorCoroutine = coroutine as EditorCoroutine; 34 | return EditorApplication.timeSinceStartup >= editorCoroutine.TimeSinceStartup + seconds; 35 | } 36 | } 37 | 38 | public class EditorWaitUntil : IYield 39 | { 40 | readonly Func predicate; 41 | 42 | public EditorWaitUntil(Func predicate) 43 | { 44 | this.predicate = predicate; 45 | } 46 | 47 | public bool Result(ICoroutine coroutine) 48 | { 49 | return predicate(); 50 | } 51 | } 52 | } 53 | #endif -------------------------------------------------------------------------------- /Unity/EditorCoroutine/Editor/YieldInstruction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5481a1a7f07403a44a50c99933d47541 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7962b27e0c64bcd81e522450e4a70bb 3 | timeCreated: 1683367813 -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.Controls.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68cb7aa5347eec343a2e6f5e157657d6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.Controls/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d2e64ffee3762f408fc9fea1cd4697b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.Controls/Editor/AdvanceDropDown.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 989d720c7ca5f87429c9cc440d728c56 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.Controls/Editor/ResizableArea.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66fface3947fcef4298e416f3de28e98 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.Controls/Editor/SplitView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58271d7a72374f9ab4091c11edeba934 3 | timeCreated: 1682672279 -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.Controls/Editor/TreeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ca61045adc0df948a29800841dc49de 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e9c6ad23c884fb48acb12a6fd65e15e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e5107f89fc800c449e1fe1dbf392eda 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor/EditorGUIExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f706ddda20f335340925d83cd18cbb95 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor/EditorGUIExtension_DragDropArea.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9d2d6e5a031d61408139464284635ea 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor/EditorGUILayoutExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f09b75eab43c8b04e82b1b703083d9b8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor/EditorGUILayoutExtension_DragDropArea.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using UnityEditor; 18 | using UnityEngine; 19 | 20 | using UnityObject = UnityEngine.Object; 21 | 22 | namespace Atom.UnityEditors 23 | { 24 | public static partial class EditorGUILayoutExtension 25 | { 26 | /// 绘制一个可接收拖拽资源的区域 27 | public static UnityObject[] DragDropAreaMulti(params GUILayoutOption[] options) 28 | { 29 | Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUI.skin.label, options); 30 | return EditorGUIExtension.DragDropAreaMulti(rect); 31 | } 32 | 33 | /// 绘制一个可接收拖拽资源的区域 34 | public static UnityObject[] DragDropAreaMulti(DragAndDropVisualMode dropVisualMode, params GUILayoutOption[] options) 35 | { 36 | Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUI.skin.label, options); 37 | return EditorGUIExtension.DragDropAreaMulti(rect, dropVisualMode); 38 | } 39 | 40 | /// 绘制一个可接收拖拽资源的区域 41 | public static UnityObject[] DragDropAreaMulti(Color hightlightColor, params GUILayoutOption[] options) 42 | { 43 | Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUI.skin.label, options); 44 | return EditorGUIExtension.DragDropAreaMulti(rect, hightlightColor); 45 | } 46 | 47 | /// 绘制一个可接收拖拽资源的区域 48 | public static UnityObject[] DragDropAreaMulti(DragAndDropVisualMode dropVisualMode, Color hightlightColor, params GUILayoutOption[] options) 49 | { 50 | Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUI.skin.label, options); 51 | return EditorGUIExtension.DragDropAreaMulti(rect, dropVisualMode, hightlightColor); 52 | } 53 | 54 | /// 绘制一个可接收拖拽资源的区域 55 | public static UnityObject DragDropAreaSingle(params GUILayoutOption[] options) 56 | { 57 | Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUI.skin.label, options); 58 | return EditorGUIExtension.DragDropAreaSingle(rect); 59 | } 60 | 61 | /// 绘制一个可接收拖拽资源的区域 62 | public static UnityObject DragDropAreaSingle(DragAndDropVisualMode dropVisualMode, params GUILayoutOption[] options) 63 | { 64 | Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUI.skin.label, options); 65 | return EditorGUIExtension.DragDropAreaSingle(rect, dropVisualMode); 66 | } 67 | 68 | /// 绘制一个可接收拖拽资源的区域 69 | public static UnityObject DragDropAreaSingle(Color hightlightColor, params GUILayoutOption[] options) 70 | { 71 | Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUI.skin.label, options); 72 | return EditorGUIExtension.DragDropAreaSingle(rect, hightlightColor); 73 | } 74 | 75 | /// 绘制一个可接收拖拽资源的区域 76 | public static UnityObject DragDropAreaSingle(DragAndDropVisualMode dropVisualMode, Color hightlightColor, params GUILayoutOption[] options) 77 | { 78 | Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUI.skin.label, options); 79 | return EditorGUIExtension.DragDropAreaSingle(rect, dropVisualMode, hightlightColor); 80 | } 81 | } 82 | } 83 | #endif -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor/EditorGUILayoutExtension_DragDropArea.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a62fed79332db364da8f062f13418fb8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor/EditorStylesExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f34b992dc6151af4e9af50c8894ad3af 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor/EditorUtilityExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebb72a46df737574197ac719789e7bec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.EditorGUI/Editor/LayoutUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69c507d15a27aed4198a59d8994970de 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16be72a69eb752642b10501571101df9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3757b891498aeba4fbafbc1d6704c3ce 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/EditorGUIExtension_NormalDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9cebb7de27042cc4597cfe2b8f7d7dee 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/EditorGUILayoutExtension_NormalDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11e0abf6227467047b0a7518a1ae8a14 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/ObjectEditor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91e6ae123648dac408fcc2169dc8052e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/ObjectEditor/ObjectEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81c29a2774bd3e34694349caa51fe45f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/ObjectEditor/ObjectInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccdb122253c5c274898933a906a113b1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/PropertyDrawer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81c27dac80428b2489ba49529421dc0d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/PropertyDrawer/PropertyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1030a9eab84fb5143b00b1ca13246440 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/SerializedPropertyS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77cf7c2c07288544489c1d969137a426 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/SerializedPropertyS/EditorGUIExtension_Property.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fe8f0f2492c5734fb9ddee8197628f6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/SerializedPropertyS/EditorGUILayoutExtension_Property.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddeaa00eebea91d41aadd532e4bd74b2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Editor/SerializedPropertyS/SerializedPropertyS.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 992ab5a214665434089acbda7f455a1b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.ObjectDrawer/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54159c4584b290f44af0c146cbf2c7c0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05770dd369294537a39cf3bef11e7994 3 | timeCreated: 1678673919 -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06887f1eebad4ffaa2350c9d9c7d0f73 3 | timeCreated: 1678674632 -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Editor/BaseEditor.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using UnityEditor; 18 | 19 | namespace Atom.UnityEditors 20 | { 21 | public abstract class BaseEditor : Editor 22 | { 23 | public override void OnInspectorGUI() 24 | { 25 | EditorGUI.BeginChangeCheck(); 26 | SerializedProperty iterator = serializedObject.GetIterator(); 27 | 28 | bool enterChildren = true; 29 | while (iterator.NextVisible(enterChildren)) 30 | { 31 | enterChildren = false; 32 | EditorGUILayout.PropertyField(iterator, true); 33 | } 34 | 35 | if (EditorGUI.EndChangeCheck()) 36 | serializedObject.ApplyModifiedProperties(); 37 | } 38 | 39 | protected virtual void OnPropertyGUI(SerializedProperty property) 40 | { 41 | EditorGUILayout.PropertyField(property); 42 | } 43 | } 44 | } 45 | #endif -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Editor/BaseEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 322746ff2ec5c694bafcf78c00ae1252 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Editor/BaseEditorWindow.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using System.Collections; 18 | using Atom.UnityEditors.EditorCoroutine; 19 | using UnityEditor; 20 | using UnityEngine; 21 | 22 | namespace Atom.UnityEditors 23 | { 24 | public abstract class BaseEditorWindow : EditorWindow 25 | { 26 | static GUIStyle csIconStyle; 27 | static GUIContent csIcon; 28 | 29 | public static GUIStyle CSIconStyle 30 | { 31 | get 32 | { 33 | if (csIconStyle == null) 34 | { 35 | csIconStyle = new GUIStyle(GUI.skin.button); 36 | csIconStyle.padding.left = 0; 37 | csIconStyle.padding.right = 0; 38 | csIconStyle.padding.top = 0; 39 | csIconStyle.padding.bottom = 0; 40 | } 41 | return csIconStyle; 42 | } 43 | } 44 | public static GUIContent CSIcon 45 | { 46 | get 47 | { 48 | if (csIcon == null) 49 | csIcon = new GUIContent(EditorGUIUtility.FindTexture("cs Script Icon"), "打开窗口脚本"); 50 | return csIcon; 51 | } 52 | } 53 | 54 | MonoScript monoScript; 55 | MonoScript MonoScript 56 | { 57 | get 58 | { 59 | if (monoScript == null) 60 | monoScript = MonoScript.FromScriptableObject(this); 61 | return monoScript; 62 | } 63 | } 64 | 65 | EditorCoroutineService coroutineMachine; 66 | EditorCoroutineService CoroutineMachine 67 | { 68 | get 69 | { 70 | if (coroutineMachine == null) 71 | coroutineMachine = new EditorCoroutineService(); 72 | return coroutineMachine; 73 | } 74 | } 75 | 76 | private void ShowButton(Rect rect) 77 | { 78 | #if UNITY_6000_0_OR_NEWER 79 | rect.x = 0; 80 | rect.y = 5; 81 | rect.height = 20; 82 | rect.width = position.width - 25; 83 | #else 84 | rect.x = 0; 85 | rect.width = position.width - 60; 86 | #endif 87 | GUILayout.BeginArea(rect); 88 | GUILayout.BeginHorizontal(); 89 | GUILayout.FlexibleSpace(); 90 | 91 | OnShowButton(rect); 92 | 93 | GUILayout.EndHorizontal(); 94 | GUILayout.EndArea(); 95 | } 96 | 97 | protected virtual void OnShowButton(Rect rect) 98 | { 99 | if (GUILayout.Button(CSIcon, (GUIStyle)"IconButton")) 100 | AssetDatabase.OpenAsset(MonoScript); 101 | } 102 | 103 | protected virtual void Update() 104 | { 105 | CoroutineMachine.Update(); 106 | } 107 | 108 | public EditorCoroutine.EditorCoroutine StartCoroutine(IEnumerator enumerator) 109 | { 110 | return CoroutineMachine.StartCoroutine(enumerator); 111 | } 112 | 113 | public void StopCoroutine(EditorCoroutine.EditorCoroutine coroutine) 114 | { 115 | CoroutineMachine.StopCoroutine(coroutine); 116 | } 117 | } 118 | } 119 | #endif -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Editor/BaseEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d70d36a86bf374459e24756e509fb4c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Editor/MenuEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77ceaee544ffae54ca35f8c6815138c4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Editor/ReorderableListUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 167ae498047c2f14089e7ff63aa5732a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad15f99ae0b242cc8a7361843270cfeb 3 | timeCreated: 1678674627 -------------------------------------------------------------------------------- /Unity/IMGUI/IMGUI/Runtime/GUIHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2f486174e913b84f9cfa5c72ba14205 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/Logger.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd9e74a1093149cc8448f65050ebac4f 3 | timeCreated: 1695294771 -------------------------------------------------------------------------------- /Unity/Logger/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0b9ee4b81d94fb0ab4cd69f7ca16013 3 | timeCreated: 1695294780 -------------------------------------------------------------------------------- /Unity/Logger/Runtime/ULogger.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2500b6ed9704be2afb08f4694498442 3 | timeCreated: 1692254113 -------------------------------------------------------------------------------- /Unity/MDIWindow.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 599ef3bcb0e142f9a60bc90ab2384842 3 | timeCreated: 1728799762 -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2bca5b301dc48749e5f3e73301577f9 3 | timeCreated: 1728799772 -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/MDIWindow.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System; 3 | using UnityEngine; 4 | 5 | namespace Atom.UnityEditors 6 | { 7 | [Serializable] 8 | public abstract class MDIWindow : BaseEditorWindow 9 | { 10 | [SerializeField] private SubWindowTree m_subWindowTree = new SubWindowTree(); 11 | 12 | public MDIWindow Window => this; 13 | 14 | public SubWindowTree SubWindowTree => m_subWindowTree; 15 | 16 | protected virtual void OnEnable() 17 | { 18 | m_subWindowTree.Refresh(); 19 | m_subWindowTree.DoEnable(this); 20 | } 21 | 22 | protected virtual void OnDisable() 23 | { 24 | m_subWindowTree.DoDisable(); 25 | } 26 | 27 | protected virtual void OnDestroy() 28 | { 29 | m_subWindowTree.DoDestroy(); 30 | } 31 | 32 | protected virtual void OnGUI() 33 | { 34 | m_subWindowTree.DoGUI(new Rect(Vector2.zero, position.size)); 35 | this.Repaint(); 36 | } 37 | 38 | protected override void Update() 39 | { 40 | base.Update(); 41 | m_subWindowTree.DoUpdate(); 42 | } 43 | 44 | private void OnInspectorUpdate() 45 | { 46 | m_subWindowTree.DoInspectorUpdate(); 47 | } 48 | 49 | private void OnProjectChange() 50 | { 51 | m_subWindowTree.DoProjectChange(); 52 | } 53 | 54 | public void Refresh() 55 | { 56 | m_subWindowTree.Refresh(); 57 | } 58 | } 59 | } 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/MDIWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9126f8ec65e4684bd88e7718929394b 3 | timeCreated: 1728799781 -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/SubWindow.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System; 3 | using UnityEngine; 4 | 5 | namespace Atom.UnityEditors 6 | { 7 | [Serializable] 8 | public abstract class SubWindow 9 | { 10 | private bool active; 11 | private GUIContent m_title; 12 | private Rect m_position; 13 | 14 | public GUIContent Title 15 | { 16 | get 17 | { 18 | if (m_title == null) 19 | { 20 | m_title = new GUIContent(this.GetType().Name); 21 | } 22 | 23 | return m_title; 24 | } 25 | set { m_title = value; } 26 | } 27 | 28 | public Rect Position => m_position; 29 | 30 | public SubWindowLeafNode LeafNode { get; private set; } 31 | 32 | public MDIWindow LocalEditorWindow => LeafNode.LocalEditorWindow; 33 | 34 | internal void SetLeafNode(SubWindowLeafNode node) 35 | { 36 | this.LeafNode = node; 37 | } 38 | 39 | public void DoEnable() 40 | { 41 | OnEnable(); 42 | } 43 | 44 | public void DoDisable() 45 | { 46 | OnDisable(); 47 | } 48 | 49 | public void DoDestroy() 50 | { 51 | OnDestroy(); 52 | } 53 | 54 | public void DoGUI(Rect rect) 55 | { 56 | this.m_position = rect; 57 | OnGUI(); 58 | } 59 | 60 | public void DoUpdate() 61 | { 62 | OnUpdate(); 63 | } 64 | 65 | public void DoInspectorUpdate() 66 | { 67 | OnInspectorUpdate(); 68 | } 69 | 70 | public void DoProjectChange() 71 | { 72 | OnProjectChange(); 73 | } 74 | 75 | protected virtual void OnEnable() 76 | { 77 | } 78 | 79 | protected virtual void OnDisable() 80 | { 81 | } 82 | 83 | protected virtual void OnDestroy() 84 | { 85 | } 86 | 87 | protected virtual void OnGUI() 88 | { 89 | } 90 | 91 | protected virtual void OnUpdate() 92 | { 93 | } 94 | 95 | protected virtual void OnInspectorUpdate() 96 | { 97 | } 98 | 99 | protected virtual void OnProjectChange() 100 | { 101 | } 102 | 103 | public void Close() 104 | { 105 | this.LeafNode.CloseWindow(this); 106 | } 107 | } 108 | 109 | [Serializable] 110 | public class SubWindowChildren 111 | { 112 | public enum Layout 113 | { 114 | Horizontal, 115 | Vertical, 116 | } 117 | 118 | public Layout layout; 119 | } 120 | } 121 | #endif -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/SubWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4cca78b6ee242c9bf798146993964d4 3 | timeCreated: 1728805307 -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/SubWindowLeafNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14845609c7154edaa42ed84e5b83dada 3 | timeCreated: 1730479229 -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/SubWindowNode.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System; 3 | using UnityEngine; 4 | 5 | namespace Atom.UnityEditors 6 | { 7 | [Serializable] 8 | public abstract class SubWindowNode 9 | { 10 | /// 11 | /// 权重-(所有兄弟节点的权重和应为1) 12 | /// 13 | public float weight = 1; 14 | 15 | protected Rect position; 16 | 17 | public MDIWindow LocalEditorWindow { get; protected set; } 18 | 19 | public abstract void DoEnable(MDIWindow localEditorWindow); 20 | 21 | public abstract void DoDisable(); 22 | 23 | public abstract void DoDestroy(); 24 | 25 | public abstract void DoGUI(Rect rect); 26 | 27 | public abstract void DoUpdate(); 28 | 29 | public abstract void DoInspectorUpdate(); 30 | 31 | public abstract void DoProjectChange(); 32 | 33 | public abstract T OpenWindow() where T : SubWindow; 34 | 35 | public abstract SubWindow OpenWindow(Type windowType); 36 | 37 | public abstract void AddWindow(SubWindow window); 38 | 39 | public abstract void InsertWindow(SubWindow window, int index); 40 | 41 | public abstract void Refresh(); 42 | 43 | public abstract bool DragWindow(Vector2 pos, out SubWindowParentNode parent, out SubWindowLeafNode node, out SubWindow window); 44 | 45 | public abstract bool TriggerAnchorArea(Vector2 pos, out SubWindowParentNode parent, out SubWindowLeafNode node, out AnchorAreaDirection direction); 46 | 47 | 48 | } 49 | } 50 | #endif -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/SubWindowNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1562c150681c40f889eaf7b9567765b9 3 | timeCreated: 1730478164 -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/SubWindowParentNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d33250818e784db39712d21ea6da334a 3 | timeCreated: 1730479236 -------------------------------------------------------------------------------- /Unity/MDIWindow/Editor/SubWindowTree.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f44ce45983c458ba66173b709da96ac 3 | timeCreated: 1730482449 -------------------------------------------------------------------------------- /Unity/PropertyDrawer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c0594583dd674542bd795a496771527 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58fb9293b545ab145b7c5aa39313bc6e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/HideLabelDrawer.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using Atom.Unity; 18 | using UnityEngine; 19 | using UnityEditor; 20 | 21 | namespace Atom.UnityEditors 22 | { 23 | [global::UnityEditor.CustomPropertyDrawer(typeof(HideLabelAttribute))] 24 | public class HideLabelDrawer : global::UnityEditor.PropertyDrawer 25 | { 26 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 27 | { 28 | //base.OnGUI(position, property, label); 29 | EditorGUI.PropertyField(position, property, GUIContent.none); 30 | } 31 | } 32 | } 33 | #endif -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/HideLabelDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 892b35dfc26b45b44a4358cba2ad14cd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/InlineEditorDrawer.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using Atom.Unity; 18 | using UnityEditor; 19 | using UnityEngine; 20 | 21 | namespace Atom.UnityEditors 22 | { 23 | [global::UnityEditor.CustomPropertyDrawer(typeof(InlineEditorAttribute))] 24 | public class InlineEditorDrawer : global::UnityEditor.PropertyDrawer 25 | { 26 | Editor editor; 27 | bool foldout; 28 | 29 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 30 | { 31 | EditorGUI.BeginChangeCheck(); 32 | EditorGUI.PropertyField(position, property, label); 33 | if (EditorGUI.EndChangeCheck() && property.objectReferenceValue != null) 34 | editor = Editor.CreateEditor(property.objectReferenceValue); 35 | 36 | foldout = EditorGUI.Foldout(position, foldout, string.Empty, true); 37 | if (foldout) 38 | { 39 | if (property.objectReferenceValue != null) 40 | { 41 | if (editor == null) 42 | editor = Editor.CreateEditor(property.objectReferenceValue); 43 | editor.OnInspectorGUI(); 44 | } 45 | } 46 | } 47 | } 48 | } 49 | #endif -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/InlineEditorDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c5956b540ed1de4dba4f89e76968989 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/MinMaxSliderDrawer.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using Atom.Unity; 18 | using UnityEditor; 19 | using UnityEngine; 20 | 21 | namespace Atom.UnityEditors 22 | { 23 | [global::UnityEditor.CustomPropertyDrawer(typeof(MinMaxSliderAttribute))] 24 | public class MinMaxSliderDrawer : global::UnityEditor.PropertyDrawer 25 | { 26 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 27 | { 28 | MinMaxSliderAttribute minMaxSliderAttribute = (attribute as MinMaxSliderAttribute); 29 | EditorGUI.BeginChangeCheck(); 30 | GUILayout.BeginHorizontal(); 31 | 32 | float min = minMaxSliderAttribute.min; 33 | float max = minMaxSliderAttribute.max; 34 | Vector2 value = property.vector2Value; 35 | 36 | Rect rect = position; 37 | rect.width = minMaxSliderAttribute.fieldWidth; 38 | value.x = Mathf.Clamp(EditorGUI.FloatField(rect, value.x), min, value.y); 39 | 40 | rect.x += rect.width + 5; 41 | rect.width = position.width - minMaxSliderAttribute.fieldWidth * 2 - 10; 42 | EditorGUI.MinMaxSlider(rect, ref value.x, ref value.y, min, max); 43 | 44 | rect.x += rect.width + 5; 45 | rect.width = minMaxSliderAttribute.fieldWidth; 46 | value.y = Mathf.Clamp(EditorGUI.FloatField(rect, value.y), value.x, max); 47 | 48 | property.vector2Value = value; 49 | 50 | GUILayout.EndHorizontal(); 51 | if (EditorGUI.EndChangeCheck()) 52 | property.serializedObject.ApplyModifiedProperties(); 53 | property.serializedObject.Update(); 54 | } 55 | } 56 | } 57 | #endif -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/MinMaxSliderDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b4badd0e099bab4b8d2d59394f27809 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/ObjectPreviewButtonDrawer.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using Atom.Unity; 18 | using Atom.UnityEditors; 19 | using UnityEditor; 20 | using UnityEngine; 21 | 22 | using UnityObject = UnityEngine.Object; 23 | 24 | namespace Atom.UnityEditors 25 | { 26 | [@CustomPropertyDrawer(typeof(ObjectPreviewButtonAttribute), true)] 27 | public class ObjectPreviewButtonDrawer : global::UnityEditor.PropertyDrawer 28 | { 29 | public class ObjectPreviewPopupWindow : PopupWindowContent 30 | { 31 | Editor editor; 32 | UnityObject unityObject; 33 | Vector2 scroll; 34 | public ObjectPreviewPopupWindow(UnityObject _unityObject) 35 | { 36 | unityObject = _unityObject; 37 | editor = Editor.CreateEditor(_unityObject); 38 | } 39 | 40 | public override Vector2 GetWindowSize() 41 | { 42 | return new Vector2(300, 400); 43 | } 44 | 45 | public override void OnGUI(Rect rect) 46 | { 47 | //if (Event.current.type == EventType.MouseDrag && rect.Contains(Event.current.mousePosition)) 48 | //{ 49 | // Rect p = editorWindow.position; 50 | // p.position += Event.current.delta; 51 | // editorWindow.position = p; 52 | // Event.current.Use(); 53 | //} 54 | scroll = EditorGUILayout.BeginScrollView(scroll); 55 | if (editor != null) 56 | { 57 | editor.DrawHeader(); 58 | editor.OnInspectorGUI(); 59 | } 60 | EditorGUILayout.EndScrollView(); 61 | } 62 | } 63 | 64 | ObjectPreviewPopupWindow popupWindow; 65 | 66 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 67 | { 68 | position.xMax -= 20; 69 | EditorGUI.PropertyField(position, property, label, true); 70 | position.xMin = position.xMax; 71 | position.xMax += 20; 72 | if (GUI.Button(position, EditorGUIUtility.IconContent("search_menu"), EditorStylesExtension.OnlyIconButtonStyle)) 73 | { 74 | if (popupWindow == null) 75 | popupWindow = new ObjectPreviewPopupWindow(property.objectReferenceValue); 76 | PopupWindow.Show(position, popupWindow); 77 | } 78 | } 79 | } 80 | } 81 | #endif -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/ObjectPreviewButtonDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7308ff50cc59fb49a182636340bcf45 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/PreviewObjectFieldDrawer.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using Atom.Unity; 18 | using UnityEditor; 19 | using UnityEngine; 20 | 21 | namespace Atom.UnityEditors 22 | { 23 | [global::UnityEditor.CustomPropertyDrawer(typeof(PreviewObjectFieldAttribute), true)] 24 | public class PreviewObjectFieldDrawer : global::UnityEditor.PropertyDrawer 25 | { 26 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 27 | { 28 | property.objectReferenceValue = EditorGUILayout.ObjectField(label, property.objectReferenceValue as Texture2D, typeof(Texture2D), false); 29 | } 30 | 31 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 32 | { 33 | return EditorGUI.GetPropertyHeight(property, true); 34 | } 35 | } 36 | } 37 | #endif -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/PreviewObjectFieldDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f891103993c2f9d4eadc341fb60cf9fa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/ProgressBarDrawer.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using Atom.Unity; 18 | using UnityEditor; 19 | using UnityEngine; 20 | 21 | namespace Atom.UnityEditors 22 | { 23 | [global::UnityEditor.CustomPropertyDrawer(typeof(ProgressBarAttribute))] 24 | public class ProgressBarDrawer : global::UnityEditor.PropertyDrawer 25 | { 26 | ProgressBarAttribute progressBarAttribute; 27 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 28 | { 29 | progressBarAttribute = (attribute as ProgressBarAttribute); 30 | switch (property.propertyType) 31 | { 32 | case SerializedPropertyType.Integer: 33 | property.intValue = (int)EditorGUIExtension.ProgressBar(position, property.intValue, 34 | progressBarAttribute.min, 35 | progressBarAttribute.max, 36 | string.Concat(property.intValue.ToString(), "(", property.displayName, ")") 37 | , true, progressBarAttribute.drawMinMaxValue); 38 | break; 39 | case SerializedPropertyType.Float: 40 | property.floatValue = EditorGUIExtension.ProgressBar(position, property.floatValue, 41 | progressBarAttribute.min, 42 | progressBarAttribute.max, 43 | string.Concat(property.floatValue.ToString("0.00"),"(", "property.displayName", ")"), 44 | true, progressBarAttribute.drawMinMaxValue); 45 | break; 46 | default: 47 | break; 48 | } 49 | } 50 | 51 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 52 | { 53 | progressBarAttribute = (attribute as ProgressBarAttribute); 54 | return progressBarAttribute.height; 55 | } 56 | } 57 | } 58 | #endif -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/ProgressBarDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e091b2a6bce4c5444b506485758b0421 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/ReadOnlyDrawer.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using Atom.Unity; 18 | using UnityEditor; 19 | using UnityEngine; 20 | 21 | namespace Atom.UnityEditors 22 | { 23 | [global::UnityEditor.CustomPropertyDrawer(typeof(ReadOnlyAttribute), true)] 24 | public class ReadOnlyDrawer : global::UnityEditor.PropertyDrawer 25 | { 26 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 27 | { 28 | EditorGUI.BeginDisabledGroup(true); 29 | EditorGUI.PropertyField(position, property, label, true); 30 | EditorGUI.EndDisabledGroup(); 31 | } 32 | 33 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 34 | { 35 | return EditorGUI.GetPropertyHeight(property, true); 36 | } 37 | } 38 | } 39 | #endif -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Editor/ReadOnlyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 116a18fd8f8b61a40bbf8e83693992b1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b42fdede01e46b44b1bee0544d644bd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/HideLabelAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using UnityEngine; 17 | 18 | namespace Atom.Unity 19 | { 20 | public class HideLabelAttribute : UnityEngine.PropertyAttribute { } 21 | } 22 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/HideLabelAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d11ced47c6730c44b63301193580d32 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/InlineEditorAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using UnityEngine; 17 | using System; 18 | 19 | namespace Atom.Unity 20 | { 21 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true)] 22 | public class InlineEditorAttribute : UnityEngine.PropertyAttribute { } 23 | } 24 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/InlineEditorAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88619cfe8d177b94598283f69bcb7b41 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/MinMaxSliderAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using UnityEngine; 17 | using System; 18 | 19 | namespace Atom.Unity 20 | { 21 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true,Inherited = true)] 22 | public class MinMaxSliderAttribute : UnityEngine.PropertyAttribute { 23 | 24 | public float min, max; 25 | public float fieldWidth = 50; 26 | public MinMaxSliderAttribute(float min,float max) 27 | { 28 | this.min = min; 29 | this.max = max; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/MinMaxSliderAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccc5423f171bfc1439461b1c253ba164 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/ObjectPreviewButtonAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using UnityEngine; 17 | using System; 18 | 19 | namespace Atom.Unity 20 | { 21 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true)] 22 | public class ObjectPreviewButtonAttribute : UnityEngine.PropertyAttribute { } 23 | } 24 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/ObjectPreviewButtonAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38d27c9fa4c9d3c47b370231a83dc1ea 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/PreviewObjectFieldAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using System.Collections; 18 | using System.Collections.Generic; 19 | using UnityEngine; 20 | 21 | namespace Atom.Unity 22 | { 23 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] 24 | public class PreviewObjectFieldAttribute : UnityEngine.PropertyAttribute 25 | { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/PreviewObjectFieldAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c66be9b0e3a4df24884c6765993f4acf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/ProgressBarAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using UnityEngine; 18 | 19 | namespace Atom.Unity 20 | { 21 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] 22 | public class ProgressBarAttribute : UnityEngine.PropertyAttribute 23 | { 24 | public readonly float min; 25 | public readonly float max; 26 | public readonly bool drawMinMaxValue; 27 | public float height = 20; 28 | 29 | public ProgressBarAttribute(float _min, float _max, bool _drawMinMaxValue = false) 30 | { 31 | min = _min; 32 | max = _max; 33 | drawMinMaxValue = _drawMinMaxValue; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/ProgressBarAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c496bd83bf778743808289d469a2e7a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/ReadOnlyAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using UnityEngine; 17 | using System; 18 | 19 | namespace Atom.Unity 20 | { 21 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true)] 22 | public class ReadOnlyAttribute : UnityEngine.PropertyAttribute { } 23 | } 24 | -------------------------------------------------------------------------------- /Unity/PropertyDrawer/Runtime/ReadOnlyAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f261ddc75f9ec14bbb93db9b32dca88 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/Resource.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a80f021106c4c5286a0b4a101881a10 3 | timeCreated: 1698294824 -------------------------------------------------------------------------------- /Unity/Resource/AllAssetsHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public abstract class AllAssetsHandle : HandleBase 6 | { 7 | public abstract UnityEngine.Object[] AllAssets { get; } 8 | 9 | 10 | public abstract event Action OnCompleted; 11 | 12 | public abstract void Release(); 13 | } 14 | } -------------------------------------------------------------------------------- /Unity/Resource/AllAssetsHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff232e9b0e4b45ea879dc3644e51af7d 3 | timeCreated: 1716912835 -------------------------------------------------------------------------------- /Unity/Resource/AssetHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityObject = UnityEngine.Object; 3 | 4 | namespace Atom 5 | { 6 | public abstract class AssetHandle : HandleBase 7 | { 8 | public abstract UnityObject Asset { get; } 9 | 10 | public abstract event Action OnCompleted; 11 | 12 | public abstract void Release(); 13 | } 14 | } -------------------------------------------------------------------------------- /Unity/Resource/AssetHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e0652b20f6446d0ae16e6946999fb3f 3 | timeCreated: 1716445432 -------------------------------------------------------------------------------- /Unity/Resource/HandleBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Threading.Tasks; 4 | 5 | namespace Atom 6 | { 7 | public abstract class HandleBase 8 | { 9 | private event Action callback; 10 | 11 | public abstract IEnumerator Enumerator { get; } 12 | 13 | public abstract Task Task { get; } 14 | 15 | public abstract bool IsDone { get; } 16 | 17 | public abstract bool IsValid { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /Unity/Resource/HandleBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edfb63b0032c486b82c22e717404bd6e 3 | timeCreated: 1716911042 -------------------------------------------------------------------------------- /Unity/Resource/IResourceComponent.cs: -------------------------------------------------------------------------------- 1 | using UnityObject = UnityEngine.Object; 2 | 3 | namespace Atom 4 | { 5 | public interface IResourceComponent 6 | { 7 | AssetHandle LoadAsset(string location) where TObject : UnityEngine.Object; 8 | 9 | public AssetHandle LoadAssetAsync(string location) where TObject : UnityObject; 10 | 11 | public SceneHandle LoadScene(string location); 12 | 13 | public SceneHandle LoadSceneAsync(string location); 14 | 15 | public void UnloadUnusedAssets(); 16 | } 17 | } -------------------------------------------------------------------------------- /Unity/Resource/IResourceComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76c4716f9d6d4884b30e66327e23414e 3 | timeCreated: 1698294835 -------------------------------------------------------------------------------- /Unity/Resource/RawFileHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public abstract class RawFileHandle : HandleBase 6 | { 7 | public abstract event Action OnCompleted; 8 | 9 | public abstract byte[] GetRawFileData(); 10 | 11 | public abstract string GetRawFileText(); 12 | 13 | public abstract string GetRawFilePath(); 14 | 15 | public abstract void Release(); 16 | } 17 | } -------------------------------------------------------------------------------- /Unity/Resource/RawFileHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 212665f0d1eb4b7cb91e1450aae78d62 3 | timeCreated: 1716912270 -------------------------------------------------------------------------------- /Unity/Resource/ResourceManager.cs: -------------------------------------------------------------------------------- 1 | using UnityObject = UnityEngine.Object; 2 | 3 | namespace Atom 4 | { 5 | public class ResourceManager : Singleton, IResourceComponent 6 | { 7 | private IResourceComponent o; 8 | 9 | public void Install(IResourceComponent o) 10 | { 11 | this.o = o; 12 | } 13 | 14 | public AssetHandle LoadAsset(string location) where T : UnityObject 15 | { 16 | return o.LoadAsset(location); 17 | } 18 | 19 | public AssetHandle LoadAssetAsync(string location) where T : UnityObject 20 | { 21 | return o.LoadAssetAsync(location); 22 | } 23 | 24 | public SceneHandle LoadScene(string location) 25 | { 26 | return o.LoadScene(location); 27 | } 28 | 29 | public SceneHandle LoadSceneAsync(string location) 30 | { 31 | return o.LoadSceneAsync(location); 32 | } 33 | 34 | public void UnloadUnusedAssets() 35 | { 36 | o.UnloadUnusedAssets(); 37 | } 38 | 39 | public T As() where T : class, IResourceComponent 40 | { 41 | return o as T; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Unity/Resource/ResourceManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a2091dc03bd4cb6aae66790bf2849e5 3 | timeCreated: 1698294978 -------------------------------------------------------------------------------- /Unity/Resource/SceneHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom 4 | { 5 | public abstract class SceneHandle : HandleBase 6 | { 7 | public abstract string SceneName { get; } 8 | 9 | public abstract UnityEngine.SceneManagement.Scene SceneObject { get; } 10 | 11 | public abstract event Action OnCompleted; 12 | 13 | public abstract void UnloadAsync(); 14 | } 15 | } -------------------------------------------------------------------------------- /Unity/Resource/SceneHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31db016ee1aa4a45970322fc4f3bc9f3 3 | timeCreated: 1716911139 -------------------------------------------------------------------------------- /Unity/SharedVariable.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 567e21f4b74525347b607773d14d3259 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e01b0e7e23017149b3b40b10084d3fb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Editor/SharedVariablePropertyDrawer.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using UnityEditor; 18 | using UnityEngine; 19 | 20 | namespace Atom.SharedVariable.Editors 21 | { 22 | [CustomPropertyDrawer(typeof(SharedVariable), true)] 23 | public class SharedVariablePropertyDrawer : PropertyDrawer 24 | { 25 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 26 | { 27 | //base.OnGUI(position, property, label); 28 | EditorGUI.PropertyField(position, property.FindPropertyRelative("value"), label, true); 29 | } 30 | 31 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 32 | { 33 | return EditorGUI.GetPropertyHeight(property.FindPropertyRelative("value"), true); 34 | } 35 | } 36 | } 37 | #endif -------------------------------------------------------------------------------- /Unity/SharedVariable/Editor/SharedVariablePropertyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74d9abaf45811d64f97d44d5e4f82577 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 579e74388cb99444e833a2d3aa7448ca 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/Interface.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7dde7026b4f0204cb110465acfcda58 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/Interface/IVariableOwner.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System.Collections.Generic; 17 | 18 | namespace Atom.SharedVariable 19 | { 20 | public interface IVariableOwner 21 | { 22 | IVariableSource VariableSource { get; } 23 | 24 | IEnumerable Variables(); 25 | } 26 | 27 | public interface IVariableSource 28 | { 29 | bool TryGetValue(long id, out T value); 30 | 31 | bool SetValue(long id, T value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/Interface/IVariableOwner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49c0bc0d71b8c2f4ba9351098a92dc4a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariable.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using UnityEngine; 21 | 22 | namespace Atom.SharedVariable 23 | { 24 | [Serializable] 25 | #if ODIN_INSPECTOR 26 | [Sirenix.OdinInspector.HideReferenceObjectPicker] 27 | #endif 28 | public abstract class SharedVariable 29 | { 30 | [SerializeField, HideInInspector] protected long id = Snowflake.BaseUTC2020.NextId(); 31 | 32 | public long Id 33 | { 34 | get => this.id; 35 | protected set => this.id = value; 36 | } 37 | 38 | public IVariableOwner Owner { get; protected set; } 39 | 40 | public void SetVariableOwner(IVariableOwner owner) 41 | { 42 | this.Owner = owner; 43 | } 44 | } 45 | 46 | [Serializable] 47 | public class SharedVariable : SharedVariable 48 | { 49 | [SerializeField] protected T value; 50 | 51 | public T Value 52 | { 53 | get { return (this.Owner != null && this.Owner.VariableSource != null && this.Owner.VariableSource.TryGetValue(this.Id, out T v)) ? v : value; } 54 | set 55 | { 56 | if (this.Owner != null && this.Owner.VariableSource != null) 57 | { 58 | this.Owner.VariableSource.SetValue(this.id, value); 59 | } 60 | else 61 | { 62 | this.value = value; 63 | } 64 | } 65 | } 66 | 67 | public SharedVariable() 68 | { 69 | 70 | } 71 | 72 | public SharedVariable(T v) 73 | { 74 | this.value = v; 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96205d7b6f75f8b4f8504b2eff9eaac2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariableUtility.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Reflection; 19 | 20 | namespace Atom.SharedVariable 21 | { 22 | public static class SharedVariableUtility 23 | { 24 | public static IEnumerable CollectionObjectSharedVariables(object obj) 25 | { 26 | Type sharedType = typeof(SharedVariable); 27 | foreach (var fieldInfo in ReflectionEx.GetFields(obj.GetType(), BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) 28 | { 29 | if (sharedType.IsAssignableFrom(fieldInfo.FieldType)) 30 | { 31 | SharedVariable variable = fieldInfo.GetValue(obj) as SharedVariable; 32 | if (variable == null) 33 | { 34 | variable = Activator.CreateInstance(fieldInfo.FieldType) as SharedVariable; 35 | fieldInfo.SetValue(obj, variable); 36 | } 37 | yield return variable; 38 | } 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariableUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1a36634594448f49a1bbb87832aa81a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 440294e428ac8104eb374f13c4b1d417 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedBool.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.SharedVariable 19 | { 20 | [Serializable] 21 | public class SharedBool : SharedVariable 22 | { 23 | public SharedBool() : base() { } 24 | 25 | public SharedBool(bool v) : base(v) { } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedBool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 750f2524e42ff2d47b4125e91ef4663c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedFloat.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.SharedVariable 19 | { 20 | [Serializable] 21 | public class SharedFloat : SharedVariable 22 | { 23 | public SharedFloat() : base() { } 24 | 25 | public SharedFloat(float v) : base(v) { } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedFloat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26c4e0b0095045248bfc052664e9cfb0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedGameObject.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using UnityEngine; 18 | 19 | namespace Atom.SharedVariable 20 | { 21 | [Serializable] 22 | public class SharedGameObject : SharedObject 23 | { 24 | public SharedGameObject() : base() { } 25 | 26 | public SharedGameObject(GameObject v) : base(v) { } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedGameObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85288982964d96648a399e527bdaae4d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedGameObjectList.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using System.Collections.Generic; 18 | using UnityEngine; 19 | 20 | namespace Atom.SharedVariable 21 | { 22 | [Serializable] 23 | public class SharedGameObjectList : SharedObjectList 24 | { 25 | public SharedGameObjectList() : base() { value = new List(); } 26 | 27 | public SharedGameObjectList(List v) : base(v) { } 28 | } 29 | } -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedGameObjectList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63e581fa952612f4190ca52ed4116bad 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedIList.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using System.Collections; 18 | using System.Collections.Generic; 19 | 20 | using UnityObject = UnityEngine.Object; 21 | 22 | namespace Atom.SharedVariable 23 | { 24 | public interface ISharedObjectList 25 | { 26 | Type GetElementType(); 27 | 28 | IList GetList(); 29 | 30 | void FillList(List _other); 31 | } 32 | 33 | public abstract class SharedObjectList : SharedVariable>, ISharedObjectList where T : UnityObject 34 | { 35 | protected SharedObjectList() { } 36 | 37 | protected SharedObjectList(List v) : base(v) { } 38 | 39 | public Type GetElementType() 40 | { 41 | return TypeCache.TYPE; 42 | } 43 | 44 | public IList GetList() 45 | { 46 | return Value; 47 | } 48 | 49 | public void FillList(List _other) 50 | { 51 | // if (VariableOwner != null && VariableOwner.GetVariable(GUID) == null) 52 | // VariableOwner.SetVariable(this.Clone() as SharedVariable); 53 | // Value.Clear(); 54 | // foreach (var item in _other) 55 | // { 56 | // Value.Add(item as T); 57 | // } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedIList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb2e148c27491d546ab90340baf75ea9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedInt.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.SharedVariable 19 | { 20 | [Serializable] 21 | public class SharedInt : SharedVariable 22 | { 23 | public SharedInt() : base() { } 24 | 25 | public SharedInt(int v) : base(v) { } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedInt.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aecd8ecbef86e8844865b8a3d5ca9039 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedObject.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System.Collections; 17 | using System.Collections.Generic; 18 | using UnityEngine; 19 | 20 | using UnityObject = UnityEngine.Object; 21 | 22 | namespace Atom.SharedVariable 23 | { 24 | public interface ISharedObject 25 | { 26 | UnityObject GetObject(); 27 | void SetObject(UnityObject _object); 28 | } 29 | 30 | public abstract class SharedObject : SharedVariable, ISharedObject where T : UnityObject 31 | { 32 | protected SharedObject() { } 33 | 34 | protected SharedObject(T v) : base(v) { } 35 | 36 | public UnityObject GetObject() 37 | { 38 | return Value; 39 | } 40 | 41 | public void SetObject(UnityObject _object) 42 | { 43 | Value = _object as T; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e4c4bc2fb4b08449bf4d3761c7cf823 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedString.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.SharedVariable 19 | { 20 | [Serializable] 21 | public class SharedString : SharedVariable 22 | { 23 | public SharedString() : base() { } 24 | 25 | public SharedString(string v) : base(v) { } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedString.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96a97d3215bfa954da39c2bcd2e9b25d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedTransform.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using UnityEngine; 18 | 19 | namespace Atom.SharedVariable 20 | { 21 | [Serializable] 22 | public class SharedTransform : SharedObject 23 | { 24 | public SharedTransform() : base() { } 25 | 26 | public SharedTransform(Transform v) : base(v) { } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedTransform.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cacd6033cc588164fbad80e8dc24c81e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedVector2.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using UnityEngine; 18 | 19 | namespace Atom.SharedVariable 20 | { 21 | [Serializable] 22 | public class SharedVector2 : SharedVariable 23 | { 24 | public SharedVector2() : base() { } 25 | 26 | public SharedVector2(Vector2 v) : base(v) { } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedVector2.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 505d6da0519c78141812d5bef43c9479 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedVector3.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using UnityEngine; 18 | 19 | namespace Atom.SharedVariable 20 | { 21 | [Serializable] 22 | public class SharedVector3 : SharedVariable 23 | { 24 | public SharedVector3() : base() { } 25 | 26 | public SharedVector3(Vector3 v) : base(v) { } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedVector3.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06ed141bdcd17f742aae5d342f190fea 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedVector4.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | using UnityEngine; 18 | 19 | namespace Atom.SharedVariable 20 | { 21 | [Serializable] 22 | public class SharedVector4 : SharedVariable 23 | { 24 | public SharedVector4() : base() { } 25 | 26 | public SharedVector4(Vector4 v) : base(v) { } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Unity/SharedVariable/Runtime/SharedVariables/SharedVector4.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8649b8622fbd7264983e8b893d2f462e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/Singletons.Unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4669e87be43848bb8a654f8ed22b3d0b 3 | timeCreated: 1692254030 -------------------------------------------------------------------------------- /Unity/Singletons.Unity/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b9894979f074672a133b8ab2548f4f9 3 | timeCreated: 1692254030 -------------------------------------------------------------------------------- /Unity/Singletons.Unity/Runtime/AutoMonoSingleton.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 主题: Mono单例基类 7 | * Description: 8 | * 功能: 自动创建单例对象 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using UnityEngine; 20 | 21 | namespace Atom.Unity 22 | { 23 | public class AutoMonoSingleton : MonoBehaviour, ISingleton where T : AutoMonoSingleton 24 | { 25 | #region Static 26 | 27 | private static readonly object @lock = new object(); 28 | private static T instance; 29 | 30 | public static T Instance 31 | { 32 | get 33 | { 34 | if (instance == null) 35 | { 36 | lock (@lock) 37 | { 38 | Initialize(); 39 | } 40 | } 41 | 42 | return instance; 43 | } 44 | } 45 | 46 | public static bool IsInitialized() 47 | { 48 | return instance != null; 49 | } 50 | 51 | public static void Initialize() 52 | { 53 | if (instance != null) 54 | return; 55 | instance = GameObject.FindObjectOfType(); 56 | if (instance == null) 57 | instance = new GameObject(TypeCache.TYPE.Name).AddComponent(); 58 | Game.AddSingleton(instance); 59 | } 60 | 61 | #endregion 62 | 63 | private bool isDisposed; 64 | 65 | public bool IsDisposed => this.isDisposed; 66 | 67 | public void Register() 68 | { 69 | instance = this as T; 70 | DontDestroyOnLoad(gameObject); 71 | } 72 | 73 | public void Dispose() 74 | { 75 | if (this.isDisposed) 76 | return; 77 | 78 | this.isDisposed = true; 79 | if (instance is ISingletonDestory iSingletonDestory) 80 | iSingletonDestory.Destroy(); 81 | Destroy(gameObject); 82 | instance = null; 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Unity/Singletons.Unity/Runtime/AutoMonoSingleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b64867f63d942e08c4c1595e148289b 3 | timeCreated: 1692254030 -------------------------------------------------------------------------------- /Unity/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb078f7371b940ac880b77dd34f258de 3 | timeCreated: 1678673885 -------------------------------------------------------------------------------- /Unity/Utility/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a659bb4aeb3481980da85423a65b4e2 3 | timeCreated: 1695710440 -------------------------------------------------------------------------------- /Unity/Utility/Editor/AssetDatabaseEx.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using UnityEditor; 6 | 7 | namespace Atom.UnityEditors 8 | { 9 | public static class AssetDatabaseEx 10 | { 11 | public static void ValidAndCreateFolder(string folder) 12 | { 13 | if (!Directory.Exists(folder)) 14 | { 15 | Directory.CreateDirectory(folder); 16 | } 17 | 18 | if (!AssetDatabase.IsValidFolder(folder)) 19 | { 20 | AssetDatabase.Refresh(); 21 | } 22 | } 23 | 24 | public static string[] FindAssetsFromSelection(string filter) where T : UnityEngine.Object 25 | { 26 | var guids = new HashSet(); 27 | var searchInFolders = new string[1]; 28 | foreach (var s in Selection.objects) 29 | { 30 | if (s is T) 31 | { 32 | guids.Add(AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(s))); 33 | } 34 | else if (s is DefaultAsset) 35 | { 36 | var path = AssetDatabase.GetAssetPath(s); 37 | if (AssetDatabase.IsValidFolder(path)) 38 | { 39 | searchInFolders[0] = path; 40 | foreach (var guid in AssetDatabase.FindAssets(filter, searchInFolders)) 41 | { 42 | guids.Add(AssetDatabase.GUIDToAssetPath(guid)); 43 | } 44 | } 45 | } 46 | } 47 | 48 | return guids.ToArray(); 49 | } 50 | } 51 | } 52 | #endif -------------------------------------------------------------------------------- /Unity/Utility/Editor/AssetDatabaseEx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c620e4327756435da11292a2bae833c4 3 | timeCreated: 1737438650 -------------------------------------------------------------------------------- /Unity/Utility/Editor/EditorPrefsVariable.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System; 3 | using System.Collections.Generic; 4 | using UnityEditor; 5 | 6 | namespace Atom.UnityEditors 7 | { 8 | public class EditorPrefsVariable 9 | { 10 | private string key; 11 | private T value; 12 | public event Action onValueChanged; 13 | 14 | public EditorPrefsVariable(string key, T defaultValue = default(T)) 15 | { 16 | this.key = key; 17 | this.value = defaultValue; 18 | this.LoadValue(); 19 | } 20 | 21 | public T Value 22 | { 23 | get { return value; } 24 | set 25 | { 26 | if (EqualityComparer.Default.Equals(this.value, value)) 27 | { 28 | return; 29 | } 30 | 31 | this.value = value; 32 | this.SaveValue(); 33 | this.onValueChanged?.Invoke(this.value); 34 | } 35 | } 36 | 37 | private void LoadValue() 38 | { 39 | if (typeof(T) == typeof(int)) 40 | { 41 | var v = this as EditorPrefsVariable; 42 | v!.value = EditorPrefs.GetInt(key, v.value); 43 | } 44 | else if (typeof(T) == typeof(float)) 45 | { 46 | var v = this as EditorPrefsVariable; 47 | v!.value = EditorPrefs.GetFloat(key, v.value); 48 | } 49 | else if (typeof(T) == typeof(bool)) 50 | { 51 | var v = this as EditorPrefsVariable; 52 | v!.value = EditorPrefs.GetBool(key, v.value); 53 | } 54 | else if (typeof(T) == typeof(string)) 55 | { 56 | var v = this as EditorPrefsVariable; 57 | v!.value = EditorPrefs.GetString(key, v.value); 58 | } 59 | else 60 | { 61 | throw new ArgumentException($"variable type {typeof(T).Name} is not supported, Only [int|float|bool|string] types are supported."); 62 | } 63 | } 64 | 65 | private void SaveValue() 66 | { 67 | if (typeof(T) == typeof(int)) 68 | { 69 | var v = this as EditorPrefsVariable; 70 | EditorPrefs.SetInt(key, v!.value); 71 | } 72 | else if (typeof(T) == typeof(float)) 73 | { 74 | var v = this as EditorPrefsVariable; 75 | EditorPrefs.SetFloat(key, v!.value); 76 | } 77 | else if (typeof(T) == typeof(bool)) 78 | { 79 | var v = this as EditorPrefsVariable; 80 | EditorPrefs.SetBool(key, v!.value); 81 | } 82 | else if (typeof(T) == typeof(string)) 83 | { 84 | var v = this as EditorPrefsVariable; 85 | EditorPrefs.SetString(key, v!.value); 86 | } 87 | else 88 | { 89 | throw new ArgumentException($"variable type {typeof(T).Name} is not supported, Only [int|float|bool|string] types are supported."); 90 | } 91 | } 92 | } 93 | } 94 | #endif -------------------------------------------------------------------------------- /Unity/Utility/Editor/EditorPrefsVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c421d2c839164b478b6aba9ed136e3a2 3 | timeCreated: 1744942790 -------------------------------------------------------------------------------- /Unity/Utility/Editor/MenuEx.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace Atom.UnityEditors 6 | { 7 | public static class MenuEx 8 | { 9 | 10 | #if HALOMAN 11 | [MenuItem("Tools/Atom/Path Print/DataPath")] 12 | #endif 13 | public static void PrintDataPath() 14 | { 15 | Debug.Log(Application.dataPath); 16 | } 17 | 18 | #if HALOMAN 19 | [MenuItem("Tools/Atom/Path Print/StreamingAssetsPath")] 20 | #endif 21 | public static void PrintStreamingAssetsPath() 22 | { 23 | Debug.Log(Application.streamingAssetsPath); 24 | } 25 | 26 | #if HALOMAN 27 | [MenuItem("Tools/Atom/Path Print/PersistentDataPath")] 28 | #endif 29 | public static void PrintPersistentDataPath() 30 | { 31 | Debug.Log(Application.persistentDataPath); 32 | } 33 | 34 | #if HALOMAN 35 | [MenuItem("Tools/Atom/Path Print/TemporaryCachePath")] 36 | #endif 37 | public static void PrintTemporaryCachePath() 38 | { 39 | Debug.Log(Application.temporaryCachePath); 40 | } 41 | 42 | #if HALOMAN 43 | [MenuItem("Tools/Atom/Path Print/ComsoleLogPath")] 44 | #endif 45 | public static void PrintComsoleLogPath() 46 | { 47 | Debug.Log(Application.consoleLogPath); 48 | } 49 | 50 | #if HALOMAN 51 | [MenuItem("Assets/Copy Paths", priority = 100)] 52 | #endif 53 | public static void CopySelectionPath() 54 | { 55 | var count = Selection.objects.Length; 56 | var paths = new string[count]; 57 | for (int i = 0; i < count; i++) 58 | { 59 | paths[i] = AssetDatabase.GetAssetPath(Selection.objects[i]); 60 | } 61 | 62 | GUIUtility.systemCopyBuffer = string.Join('\n', paths); 63 | } 64 | 65 | #if HALOMAN 66 | [MenuItem("Assets/Print Paths", priority = 100)] 67 | #endif 68 | public static void PrintSelectionPath() 69 | { 70 | var count = Selection.objects.Length; 71 | var paths = new string[count]; 72 | for (int i = 0; i < count; i++) 73 | { 74 | paths[i] = AssetDatabase.GetAssetPath(Selection.objects[i]); 75 | } 76 | 77 | Debug.Log(string.Join('\n', paths)); 78 | } 79 | } 80 | } 81 | #endif -------------------------------------------------------------------------------- /Unity/Utility/Editor/MenuEx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 038a3287afc4414aa2cce60a65058e26 3 | timeCreated: 1737439238 -------------------------------------------------------------------------------- /Unity/Utility/Editor/PlayerSettingsEx.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | 3 | #region 注 释 4 | 5 | /*** 6 | * 7 | * Title: 8 | * 9 | * Description: 10 | * 11 | * Date: 12 | * Version: 13 | * Writer: 半只龙虾人 14 | * Github: https://github.com/haloman9527 15 | * Blog: https://www.haloman.net/ 16 | * 17 | */ 18 | 19 | #endregion 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using UnityEditor; 24 | using UnityEngine; 25 | 26 | namespace Atom.UnityEditors 27 | { 28 | public static class PlayerSettingsEx 29 | { 30 | public static void OpenDefineSymbols(List defines, BuildTargetGroup targetGroup) 31 | { 32 | foreach (var def in defines) 33 | { 34 | if (def.Contains(";")) 35 | throw new InvalidOperationException(); 36 | } 37 | 38 | var defs = new List(PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup).Split(';')); 39 | 40 | foreach (var def in defines) 41 | { 42 | if (def.Contains(";")) 43 | throw new InvalidOperationException(); 44 | if (defs.Contains(def.Trim())) 45 | defs.Add(def.Trim()); 46 | } 47 | 48 | PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, string.Join(";", defs)); 49 | } 50 | 51 | public static void CloseDefineSymbols(List defines, BuildTargetGroup targetGroup) 52 | { 53 | foreach (var def in defines) 54 | { 55 | if (def.Contains(";")) 56 | throw new InvalidOperationException(); 57 | } 58 | 59 | var defs = new List(PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup).Split(';')); 60 | 61 | foreach (var def in defines) 62 | { 63 | if (defs.Contains(def.Trim())) 64 | defs.Remove(def.Trim()); 65 | } 66 | 67 | PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, string.Join(";", defs)); 68 | } 69 | } 70 | } 71 | #endif -------------------------------------------------------------------------------- /Unity/Utility/Editor/PlayerSettingsEx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e955f70c979476696b55626d61b9523 3 | timeCreated: 1695710468 -------------------------------------------------------------------------------- /Unity/Utility/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60836afb094646109563035e0b76b4e9 3 | timeCreated: 1695710445 -------------------------------------------------------------------------------- /Unity/Utility/Runtime/PlayerPrefsVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Atom 6 | { 7 | public class PlayerPrefsVariable 8 | { 9 | private string key; 10 | private T value; 11 | public event Action onValueChanged; 12 | 13 | public PlayerPrefsVariable(string key, T defaultValue = default(T)) 14 | { 15 | this.key = key; 16 | this.value = defaultValue; 17 | this.LoadValue(); 18 | } 19 | 20 | public T Value 21 | { 22 | get { return value; } 23 | set 24 | { 25 | if (EqualityComparer.Default.Equals(this.value, value)) 26 | { 27 | return; 28 | } 29 | 30 | this.value = value; 31 | this.SaveValue(); 32 | this.onValueChanged?.Invoke(this.value); 33 | } 34 | } 35 | 36 | private void LoadValue() 37 | { 38 | if (typeof(T) == typeof(int)) 39 | { 40 | var v = this as PlayerPrefsVariable; 41 | v!.value = PlayerPrefs.GetInt(key, v.value); 42 | } 43 | else if (typeof(T) == typeof(float)) 44 | { 45 | var v = this as PlayerPrefsVariable; 46 | v!.value = PlayerPrefs.GetFloat(key, v.value); 47 | } 48 | else if (typeof(T) == typeof(bool)) 49 | { 50 | var v = this as PlayerPrefsVariable; 51 | v!.value = PlayerPrefs.GetInt(key, v.value ? 1 : 0) != 0; 52 | } 53 | else if (typeof(T) == typeof(string)) 54 | { 55 | var v = this as PlayerPrefsVariable; 56 | v!.value = PlayerPrefs.GetString(key, v.value); 57 | } 58 | else 59 | { 60 | throw new ArgumentException($"variable type {typeof(T).Name} is not supported, Only [int|float|bool|string] types are supported."); 61 | } 62 | } 63 | 64 | private void SaveValue() 65 | { 66 | if (typeof(T) == typeof(int)) 67 | { 68 | var v = this as PlayerPrefsVariable; 69 | PlayerPrefs.SetInt(key, v!.value); 70 | } 71 | else if (typeof(T) == typeof(float)) 72 | { 73 | var v = this as PlayerPrefsVariable; 74 | PlayerPrefs.SetFloat(key, v!.value); 75 | } 76 | else if (typeof(T) == typeof(bool)) 77 | { 78 | var v = this as PlayerPrefsVariable; 79 | PlayerPrefs.SetInt(key, v!.value ? 1 : 0); 80 | } 81 | else if (typeof(T) == typeof(string)) 82 | { 83 | var v = this as PlayerPrefsVariable; 84 | PlayerPrefs.SetString(key, v!.value); 85 | } 86 | else 87 | { 88 | throw new ArgumentException($"variable type {typeof(T).Name} is not supported, Only [int|float|bool|string] types are supported."); 89 | } 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /Unity/Utility/Runtime/PlayerPrefsVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce4517fa41cc427d9715379b8a4e4058 3 | timeCreated: 1745476094 -------------------------------------------------------------------------------- /Unity/Utility/Runtime/Util.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d7ef8748cd30234da946edb5fb1e819 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | --------------------------------------------------------------------------------