Initial Code

This commit is contained in:
Exil Productions
2025-11-11 03:10:52 +01:00
commit 74e53205f4
21 changed files with 2039 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;
using VMM.ModRegistry.Settings;
namespace VMM.ModRegistry.Settings
{
public abstract class SettingsElement<T> : ISettingsElement
{
public string Name { get; set; }
public T Value { get; set; }
public Action<T> OnChanged { get; set; }
public object GetValue() => Value;
public void SetValue(object value)
{
if (value is T typedValue)
{
Value = typedValue;
OnChanged?.Invoke(typedValue);
}
else
{
throw new InvalidCastException($"Invalid value type. Expected {typeof(T)}, got {value?.GetType()}");
}
}
}
}