internal void OnChildValueSet(ValueDrawer child, ValueAccessResult result) { if (Parent == null) { return; } if (!Parent.ValueEntry.TypeOfValue.IsValueType) { return; } if (GetMapped(child) == null) { return; } var ownerValue = child.ValueEntry.Owner; Parent.SetValue(ownerValue, true, true); foreach (var otherChild in MappedChildren) { if (otherChild != child) { otherChild.ValueEntry.Owner = ownerValue; } } }
public bool MoveNext() { var h = ErrorRecordsLogHandler.Default; h.ClearRecords(); Exception exception = null; using (new LogHandlerScope(h)) { try { if (typedEnumerator != null) { IsDone = !typedEnumerator.MoveNext(); CurrentItem = typedEnumerator.Current; } else { IsDone = !enumerator.MoveNext(); CurrentItem = (TItem)enumerator.Current; } } catch (Exception e) { exception = e; } } CurrentGetResult = new ValueAccessResult(h.Records, exception); return(!IsDone); }
public FixedValueEntry(TOwner owner, TValue value, ValueAccessResult valueGetResult = default(ValueAccessResult)) : base(owner) { this.value = value; ValueGetResult = valueGetResult; }
protected void AfterSetValue(ValueAccessResult result) { var parentGroup = Parent as MemberGroupDrawer; if (parentGroup != null) { parentGroup.OnChildValueSet(this, result); } }
public override ValueAccessResult SetValue(TValue value, bool handleErrorLogs, bool catchException) { var result = new ValueAccessResult(); if (Owner == null) { result.Exception = new NullReferenceException(); } else { Value = value; } return(result); }
protected virtual void ValueErrorGUI() { if (!ValueAccessResult.IsNullOrFailed(drawingValueGetResult) || !ValueAccessResult.IsNullOrFailed(drawnValueSetResult)) { return; } if (DIGUI.ErrorButton(GetErrorButtonTooltip())) { var window = ValueAccessResultWindow.Open(); window.GetResult = drawingValueGetResult ?? default(ValueAccessResult); window.SetResult = drawnValueSetResult ?? default(ValueAccessResult); } }
protected static void ProcessValueAccessError( ValueAccessResult result, bool handleErrorLogs, bool catchException) { if (!handleErrorLogs && result.HasErrorLog) { foreach (var info in result.ErrorLogs) { DebugEx.UnityLogger.Log(info.Type, info.Message); } } if (!catchException && result.Exception != null) { throw result.Exception; } }
private void ChangeTabData(int tabIndex, ValueAccessResult value) { var tab = tabBar.GetTab(tabIndex); if (ValueAccessResultComparer.Default.Equals(value, tab.Data)) { return; } tab.Data = value; if (tabIndex == tabBar.SelectedTabIndex) { UpdateLogEntries(tab.Data); } }
public void Reset(IEnumerable collection) { CurrentItem = default(TItem); CurrentGetResult = default(ValueAccessResult); var typedCollection = collection as IEnumerable <TItem>; if (typedCollection != null) { typedEnumerator = typedCollection.GetEnumerator(); } else { enumerator = collection.GetEnumerator(); } IsDone = false; }
private void UpdateLogEntries(ValueAccessResult valueAccessResult) { logEntries.Clear(); var logInfos = valueAccessResult.ErrorLogs; if (!CollectionUtil.IsNullOrEmpty(logInfos)) { foreach (var logInfo in logInfos) { logEntries.Add(new LogEntry(LogEntryCount, logInfo)); } } var exception = valueAccessResult.Exception; if (exception != null) { logEntries.Add(new LogEntry(LogEntryCount, exception)); } }
public ItemInfo(TItem item, ValueAccessResult getResult) { Item = item; GetResult = getResult; }