2022-04-12 05:20:35 +10:00
|
|
|
|
using UnityExplorer.CacheObject.Views;
|
2022-01-17 19:42:05 +11:00
|
|
|
|
using UnityExplorer.Config;
|
2021-05-13 23:03:30 +10:00
|
|
|
|
|
2021-06-30 07:49:58 +10:00
|
|
|
|
namespace UnityExplorer.CacheObject
|
2021-05-13 23:03:30 +10:00
|
|
|
|
{
|
|
|
|
|
public class CacheConfigEntry : CacheObjectBase
|
|
|
|
|
{
|
|
|
|
|
public CacheConfigEntry(IConfigElement configElement)
|
|
|
|
|
{
|
|
|
|
|
this.RefConfigElement = configElement;
|
2021-08-23 18:35:08 +10:00
|
|
|
|
this.FallbackType = configElement.ElementType;
|
2021-05-13 23:03:30 +10:00
|
|
|
|
|
|
|
|
|
this.NameLabelText = $"<color=cyan>{configElement.Name}</color>" +
|
|
|
|
|
$"\r\n<color=grey><i>{configElement.Description}</i></color>";
|
2021-08-23 18:35:08 +10:00
|
|
|
|
this.NameLabelTextRaw = string.Empty;
|
2021-05-13 23:03:30 +10:00
|
|
|
|
|
|
|
|
|
configElement.OnValueChangedNotify += UpdateValueFromSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IConfigElement RefConfigElement;
|
|
|
|
|
|
|
|
|
|
public override bool ShouldAutoEvaluate => true;
|
|
|
|
|
public override bool HasArguments => false;
|
|
|
|
|
public override bool CanWrite => true;
|
|
|
|
|
|
|
|
|
|
public void UpdateValueFromSource()
|
|
|
|
|
{
|
2021-05-15 06:20:07 +10:00
|
|
|
|
//if (RefConfigElement.BoxedValue.Equals(this.Value))
|
|
|
|
|
// return;
|
2021-05-13 23:03:30 +10:00
|
|
|
|
|
|
|
|
|
SetValueFromSource(RefConfigElement.BoxedValue);
|
2021-05-14 02:45:59 +10:00
|
|
|
|
|
|
|
|
|
if (this.CellView != null)
|
|
|
|
|
this.SetDataToCell(CellView);
|
2021-05-13 23:03:30 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void TrySetUserValue(object value)
|
|
|
|
|
{
|
|
|
|
|
this.Value = value;
|
|
|
|
|
RefConfigElement.BoxedValue = value;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-18 20:19:20 +11:00
|
|
|
|
protected override bool TryAutoEvaluateIfUnitialized(CacheObjectCell cell) => true;
|
2021-05-13 23:03:30 +10:00
|
|
|
|
}
|
|
|
|
|
}
|