Esempio n. 1
0
        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;
                }
            }
        }
Esempio n. 2
0
            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);
            }
Esempio n. 3
0
 public FixedValueEntry(TOwner owner, TValue value,
                        ValueAccessResult valueGetResult = default(ValueAccessResult))
     : base(owner)
 {
     this.value     = value;
     ValueGetResult = valueGetResult;
 }
Esempio n. 4
0
        protected void AfterSetValue(ValueAccessResult result)
        {
            var parentGroup = Parent as MemberGroupDrawer;

            if (parentGroup != null)
            {
                parentGroup.OnChildValueSet(this, result);
            }
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 9
0
            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));
            }
        }
Esempio n. 11
0
 public ItemInfo(TItem item, ValueAccessResult getResult)
 {
     Item      = item;
     GetResult = getResult;
 }