Merge branch 'main' into audio

This commit is contained in:
copecone committed 2026-07-07 16:00:08 +09:00
commit af8bb439f5
2 files changed
+8 -20

No files matched your search

+4 -10
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using MelonLoader; using MelonLoader;
using UnityEngine.UIElements; using UnityEngine.UIElements;
@@ -46,11 +47,8 @@ namespace ADOFAIRenderer.Data
/// </summary> /// </summary>
public void SetupValidation() public void SetupValidation()
{ {
foreach (var kvp in _fields) foreach (var (fieldName, entry) in _fields)
{ {
var fieldName = kvp.Key;
var entry = kvp.Value;
var field = _rootVisualElement.Q<DoubleField>(fieldName); var field = _rootVisualElement.Q<DoubleField>(fieldName);
if (field == null) if (field == null)
{ {
@@ -68,13 +66,9 @@ namespace ADOFAIRenderer.Data
return; return;
} }
foreach (var limit in limits) if (limits.Any(limit => !limit.Validate(evt.newValue, out _)))
{ {
if (!limit.Validate(evt.newValue, out _)) field.SetValueWithoutNotify(evt.previousValue);
{
field.SetValueWithoutNotify(evt.previousValue);
return;
}
} }
}); });
} }
+4 -10
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using MelonLoader; using MelonLoader;
using UnityEngine.UIElements; using UnityEngine.UIElements;
@@ -46,11 +47,8 @@ namespace ADOFAIRenderer.Data
/// </summary> /// </summary>
public void SetupValidation() public void SetupValidation()
{ {
foreach (var kvp in _fields) foreach (var (fieldName, entry) in _fields)
{ {
var fieldName = kvp.Key;
var entry = kvp.Value;
var field = _rootVisualElement.Q<IntegerField>(fieldName); var field = _rootVisualElement.Q<IntegerField>(fieldName);
if (field == null) if (field == null)
{ {
@@ -68,13 +66,9 @@ namespace ADOFAIRenderer.Data
return; return;
} }
foreach (var limit in limits) if (limits.Any(limit => !limit.Validate(evt.newValue, out _)))
{ {
if (!limit.Validate(evt.newValue, out _)) field.SetValueWithoutNotify(evt.previousValue);
{
field.SetValueWithoutNotify(evt.previousValue);
return;
}
} }
}); });
} }