mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-20 15:47:54 +08:00

- Use explicit type of var - Use 'new()' - Remove unnecessary usings - Sort usings - Apply formatting
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using UnityExplorer.CacheObject.Views;
|
|
using UnityExplorer.Config;
|
|
|
|
namespace UnityExplorer.CacheObject
|
|
{
|
|
public class CacheConfigEntry : CacheObjectBase
|
|
{
|
|
public CacheConfigEntry(IConfigElement configElement)
|
|
{
|
|
this.RefConfigElement = configElement;
|
|
this.FallbackType = configElement.ElementType;
|
|
|
|
this.NameLabelText = $"<color=cyan>{configElement.Name}</color>" +
|
|
$"\r\n<color=grey><i>{configElement.Description}</i></color>";
|
|
this.NameLabelTextRaw = string.Empty;
|
|
|
|
configElement.OnValueChangedNotify += UpdateValueFromSource;
|
|
}
|
|
|
|
public IConfigElement RefConfigElement;
|
|
|
|
public override bool ShouldAutoEvaluate => true;
|
|
public override bool HasArguments => false;
|
|
public override bool CanWrite => true;
|
|
|
|
public void UpdateValueFromSource()
|
|
{
|
|
//if (RefConfigElement.BoxedValue.Equals(this.Value))
|
|
// return;
|
|
|
|
SetValueFromSource(RefConfigElement.BoxedValue);
|
|
|
|
if (this.CellView != null)
|
|
this.SetDataToCell(CellView);
|
|
}
|
|
|
|
public override void TrySetUserValue(object value)
|
|
{
|
|
this.Value = value;
|
|
RefConfigElement.BoxedValue = value;
|
|
}
|
|
|
|
protected override bool TryAutoEvaluateIfUnitialized(CacheObjectCell cell) => true;
|
|
}
|
|
}
|