From 029e02fd2f0a37332610f8cf4cfb20b55b978776 Mon Sep 17 00:00:00 2001 From: Alexander Filippov Date: Wed, 2 Mar 2022 01:12:44 +0100 Subject: [PATCH] Update --- ...or.asmdef => Agoxandr.Utils.Editor.asmdef} | 2 +- ...meta => Agoxandr.Utils.Editor.asmdef.meta} | 0 Editor/EventManagerEditor.cs | 8 ++--- .../{Utils.asmdef => Agoxandr.Utils.asmdef} | 1 + ...asmdef.meta => Agoxandr.Utils.asmdef.meta} | 0 Runtime/ArrayExtensions.cs | 4 +-- Runtime/EventManager.cs | 33 ++++--------------- package.json | 5 ++- 8 files changed, 18 insertions(+), 35 deletions(-) rename Editor/{Utils.Editor.asmdef => Agoxandr.Utils.Editor.asmdef} (92%) rename Editor/{Utils.Editor.asmdef.meta => Agoxandr.Utils.Editor.asmdef.meta} (100%) rename Runtime/{Utils.asmdef => Agoxandr.Utils.asmdef} (91%) rename Runtime/{Utils.asmdef.meta => Agoxandr.Utils.asmdef.meta} (100%) diff --git a/Editor/Utils.Editor.asmdef b/Editor/Agoxandr.Utils.Editor.asmdef similarity index 92% rename from Editor/Utils.Editor.asmdef rename to Editor/Agoxandr.Utils.Editor.asmdef index 5f40a9c..3461d9e 100644 --- a/Editor/Utils.Editor.asmdef +++ b/Editor/Agoxandr.Utils.Editor.asmdef @@ -1,6 +1,6 @@ { "name": "Agoxandr.Utils.Editor", - "rootNamespace": "", + "rootNamespace": "Utils", "references": [ "GUID:80ed647da8ce73c45b66c239eba0365a" ], diff --git a/Editor/Utils.Editor.asmdef.meta b/Editor/Agoxandr.Utils.Editor.asmdef.meta similarity index 100% rename from Editor/Utils.Editor.asmdef.meta rename to Editor/Agoxandr.Utils.Editor.asmdef.meta diff --git a/Editor/EventManagerEditor.cs b/Editor/EventManagerEditor.cs index b907d3e..b615c64 100644 --- a/Editor/EventManagerEditor.cs +++ b/Editor/EventManagerEditor.cs @@ -8,13 +8,13 @@ namespace Utils { public override void OnInspectorGUI() { - EventManager eventManager = (EventManager)target; + var eventManager = (EventManager)target; GUILayout.BeginHorizontal(); GUILayout.Label("Update"); if (Application.isPlaying) { GUILayout.FlexibleSpace(); - GUILayout.Label(eventManager.UpdateLength.ToString()); + GUILayout.Label(EventManager.UpdateLength.ToString()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); @@ -22,7 +22,7 @@ namespace Utils if (Application.isPlaying) { GUILayout.FlexibleSpace(); - GUILayout.Label(eventManager.FixedUpdateLength.ToString()); + GUILayout.Label(EventManager.FixedUpdateLength.ToString()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); @@ -30,7 +30,7 @@ namespace Utils if (Application.isPlaying) { GUILayout.FlexibleSpace(); - GUILayout.Label(eventManager.LateUpdateLength.ToString()); + GUILayout.Label(EventManager.LateUpdateLength.ToString()); } GUILayout.EndHorizontal(); } diff --git a/Runtime/Utils.asmdef b/Runtime/Agoxandr.Utils.asmdef similarity index 91% rename from Runtime/Utils.asmdef rename to Runtime/Agoxandr.Utils.asmdef index 2a5f5dc..c63949c 100644 --- a/Runtime/Utils.asmdef +++ b/Runtime/Agoxandr.Utils.asmdef @@ -1,5 +1,6 @@ { "name": "Agoxandr.Utils", + "rootNamespace": "Utils", "references": [], "includePlatforms": [], "excludePlatforms": [], diff --git a/Runtime/Utils.asmdef.meta b/Runtime/Agoxandr.Utils.asmdef.meta similarity index 100% rename from Runtime/Utils.asmdef.meta rename to Runtime/Agoxandr.Utils.asmdef.meta diff --git a/Runtime/ArrayExtensions.cs b/Runtime/ArrayExtensions.cs index b8fa645..929f518 100644 --- a/Runtime/ArrayExtensions.cs +++ b/Runtime/ArrayExtensions.cs @@ -9,8 +9,8 @@ namespace Utils return new T[] { item }; } - T[] result = new T[array.Length + 1]; - for (int i = 0; i < array.Length; i++) + var result = new T[array.Length + 1]; + for (var i = 0; i < array.Length; i++) { result[i] = array[i]; } diff --git a/Runtime/EventManager.cs b/Runtime/EventManager.cs index 78719e6..7e06046 100644 --- a/Runtime/EventManager.cs +++ b/Runtime/EventManager.cs @@ -28,51 +28,30 @@ namespace Utils OnLateUpdated?.Invoke(); } - public int UpdateLength + public static int UpdateLength { get { var list = OnUpdated?.GetInvocationList(); - if (list != null) - { - return list.Length; - } - else - { - return 0; - } + return list?.Length ?? 0; } } - public int FixedUpdateLength + public static int FixedUpdateLength { get { var list = OnFixedUpdated?.GetInvocationList(); - if (list != null) - { - return list.Length; - } - else - { - return 0; - } + return list?.Length ?? 0; } } - public int LateUpdateLength + public static int LateUpdateLength { get { var list = OnLateUpdated?.GetInvocationList(); - if (list != null) - { - return list.Length; - } - else - { - return 0; - } + return list?.Length ?? 0; } } } diff --git a/package.json b/package.json index c9e00f2..8c3b00c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyou.shazbot.utils", - "version": "3.0.0", + "version": "3.0.1", "displayName": "Utils", "description": "Utility useful for almost any project.", "licensesUrl": "https://github.com/Agoxandr/Utils/blob/master/LICENSE.md", @@ -11,5 +11,8 @@ "name": "Alexander Filippov", "email": "a.filippov@shazbot.cyou", "url": "https://shazbot.cyou/" + }, + "dependencies": { + "com.unity.modules.physics": "1.0.0" } } \ No newline at end of file