30 lines
734 B
C#
30 lines
734 B
C#
using System.Collections.Generic;
|
|
|
|
namespace RPGCoreCommon.DynamicValues
|
|
{
|
|
public class DynamicValueSourceContext
|
|
{
|
|
private readonly Dictionary<string, object> _sources = new();
|
|
|
|
public void SetSource(string name, object source)
|
|
{
|
|
_sources.Remove(name.ToLower());
|
|
_sources.Add(name.ToLower(), source);
|
|
}
|
|
|
|
public void RemoveResource(string name)
|
|
{
|
|
_sources.Remove(name.ToLower());
|
|
}
|
|
|
|
public void RemoveSources()
|
|
{
|
|
_sources.Clear();
|
|
}
|
|
|
|
public bool TryGetSource(string name, out object source)
|
|
{
|
|
return _sources.TryGetValue(name.ToLower(), out source);
|
|
}
|
|
}
|
|
} |