From 512e29b7d149e687aded7df7b6774633b611deba Mon Sep 17 00:00:00 2001 From: Ricardo Date: Sun, 17 Sep 2023 21:46:43 +0100 Subject: [PATCH] 1.6.2 --- .../Settings/RicUtils_EditorSettings.cs | 2 +- .../Editor/Utilities/EditorGUIHelper.cs | 19 ++++++++++++++++ .../Editor/Windows/GenericEditorWindow.cs | 5 +++-- .../Scripts/Managers/SingletonCreation.cs | 2 +- .../Runtime/Scripts/Managers/TimerManager.cs | 2 +- .../Runtime/Scripts/Utilities/GameTimer.cs | 6 ++--- .../Runtime/Scripts/Utilities/RicUtilities.cs | 22 +++++++++---------- Assets/RicUtils/package.json | 2 +- 8 files changed, 40 insertions(+), 20 deletions(-) diff --git a/Assets/RicUtils/Editor/Settings/RicUtils_EditorSettings.cs b/Assets/RicUtils/Editor/Settings/RicUtils_EditorSettings.cs index 22142c4..d2563e3 100644 --- a/Assets/RicUtils/Editor/Settings/RicUtils_EditorSettings.cs +++ b/Assets/RicUtils/Editor/Settings/RicUtils_EditorSettings.cs @@ -12,7 +12,7 @@ internal class RicUtils_EditorSettings : ScriptableObject public static string version { - get { return "1.6.1"; } + get { return "1.6.2"; } } public static ScriptableEditor[] scriptableEditors diff --git a/Assets/RicUtils/Editor/Utilities/EditorGUIHelper.cs b/Assets/RicUtils/Editor/Utilities/EditorGUIHelper.cs index 74186f9..d03af5e 100644 --- a/Assets/RicUtils/Editor/Utilities/EditorGUIHelper.cs +++ b/Assets/RicUtils/Editor/Utilities/EditorGUIHelper.cs @@ -144,6 +144,25 @@ public static IntegerField AddIntField(this VisualElement root, EditorContainer< return intField; } + public static LongField AddLongField(this VisualElement root, EditorContainer data, string text = "Long", System.Action onSelectionChange = null) + { + var longField = new LongField() + { + label = text, + value = data.Value, + }; + + longField.RegisterValueChangedCallback(callback => + { + data.Value = callback.newValue; + onSelectionChange?.Invoke(); + }); + + root.Add(longField); + + return longField; + } + public static Toggle AddToggle(this VisualElement root, EditorContainer data, string text = "Boolean", System.Action onSelectionChange = null) { var toggle = new Toggle() diff --git a/Assets/RicUtils/Editor/Windows/GenericEditorWindow.cs b/Assets/RicUtils/Editor/Windows/GenericEditorWindow.cs index 4bf37ab..267573e 100644 --- a/Assets/RicUtils/Editor/Windows/GenericEditorWindow.cs +++ b/Assets/RicUtils/Editor/Windows/GenericEditorWindow.cs @@ -44,10 +44,11 @@ private void CreateGUI() _container = new ScrollView() { - showHorizontal = false, showVertical = true, + horizontalScrollerVisibility = ScrollerVisibility.Hidden, + verticalScrollerVisibility = ScrollerVisibility.Auto, }; base.rootVisualElement.Add(_container); - + onLoad = null; soObjectField = rootVisualElement.AddObjectField(scriptableObject, "Scriptable Object", () => { diff --git a/Assets/RicUtils/Runtime/Scripts/Managers/SingletonCreation.cs b/Assets/RicUtils/Runtime/Scripts/Managers/SingletonCreation.cs index b5f1f75..5dddce5 100644 --- a/Assets/RicUtils/Runtime/Scripts/Managers/SingletonCreation.cs +++ b/Assets/RicUtils/Runtime/Scripts/Managers/SingletonCreation.cs @@ -24,7 +24,7 @@ private static void OnLoad() } } - private static void CreateManager(System.Type type, DataManagerScriptableObject data=null) + private static void CreateManager(System.Type type, DataManagerScriptableObject data = null) { var method = type.GetMethod("CreateManager", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.FlattenHierarchy); var manager = method.Invoke(null, new object[] { }); diff --git a/Assets/RicUtils/Runtime/Scripts/Managers/TimerManager.cs b/Assets/RicUtils/Runtime/Scripts/Managers/TimerManager.cs index a52b5e3..b6085f1 100644 --- a/Assets/RicUtils/Runtime/Scripts/Managers/TimerManager.cs +++ b/Assets/RicUtils/Runtime/Scripts/Managers/TimerManager.cs @@ -24,7 +24,7 @@ private void Update() { timers.RemoveAll(g => g == null); - foreach(var timer in timers) + foreach (var timer in timers) { timer.Update(); } diff --git a/Assets/RicUtils/Runtime/Scripts/Utilities/GameTimer.cs b/Assets/RicUtils/Runtime/Scripts/Utilities/GameTimer.cs index 21ff50b..912d0b8 100644 --- a/Assets/RicUtils/Runtime/Scripts/Utilities/GameTimer.cs +++ b/Assets/RicUtils/Runtime/Scripts/Utilities/GameTimer.cs @@ -28,13 +28,13 @@ internal GameTimer(float timer, bool repeat) internal void Update() { - if(ended || !started) return; + if (ended || !started) return; time += Time.deltaTime; - if(time >= Timer) + if (time >= Timer) { onTick?.Invoke(); - if(!Repeat) ended = true; + if (!Repeat) ended = true; time -= Timer; } } diff --git a/Assets/RicUtils/Runtime/Scripts/Utilities/RicUtilities.cs b/Assets/RicUtils/Runtime/Scripts/Utilities/RicUtilities.cs index dc9be80..3a5a033 100644 --- a/Assets/RicUtils/Runtime/Scripts/Utilities/RicUtilities.cs +++ b/Assets/RicUtils/Runtime/Scripts/Utilities/RicUtilities.cs @@ -1,10 +1,10 @@ using RicUtils.ScriptableObjects; -using System.IO; -using System.Text.RegularExpressions; -using UnityEditor; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Text.RegularExpressions; +using UnityEditor; using UnityEngine; namespace RicUtils.Utilities @@ -88,14 +88,14 @@ public static void CreateAssetFolder(string folderPath) } } #endif - public static T GetRandomElement(this IEnumerable array) - { - return array.ElementAt(Random.Range(0, array.Count())); - } + public static T GetRandomElement(this IEnumerable array) + { + return array.ElementAt(Random.Range(0, array.Count())); + } - public static T GetRandomElement(this System.Array array) - { - return (T)array.GetValue(Random.Range(0, array.Length)); - } + public static T GetRandomElement(this System.Array array) + { + return (T)array.GetValue(Random.Range(0, array.Length)); + } } } diff --git a/Assets/RicUtils/package.json b/Assets/RicUtils/package.json index d466e9b..3491af7 100644 --- a/Assets/RicUtils/package.json +++ b/Assets/RicUtils/package.json @@ -1,6 +1,6 @@ { "name": "io.github.app24.ricutils", - "version": "1.6.1", + "version": "1.6.2", "displayName": "RicUtils", "dependencies": { "com.solidalloy.type-references": "2.16.0"