Example #1
0
        private Rect DrawIsBlockingToggle(Rect rect, MetadataWrapper wrapper, Action <object> changeValueCallback, GUIContent label)
        {
            IDataOwner dataOwner = wrapper.Value as IDataOwner;

            rect = DrawRecursively(rect, wrapper, drawIsBlockingToggleName, changeValueCallback, label);

            if (dataOwner == null)
            {
                Debug.LogError("The target property of the DrawIsBlockingToggleAttribute has to implement IDataOwner.");
                return(rect);
            }

            IBackgroundBehaviorData backgroundBehaviorData = dataOwner.Data as IBackgroundBehaviorData;

            if (backgroundBehaviorData == null)
            {
                return(rect);
            }

            ITrainingDrawer boolDrawer = DrawerLocator.GetDrawerForValue(backgroundBehaviorData.IsBlocking, typeof(bool));

            rect.height += boolDrawer.Draw(new Rect(rect.x, rect.y + rect.height, rect.width, 0), backgroundBehaviorData.IsBlocking, (newValue) =>
            {
                backgroundBehaviorData.IsBlocking = (bool)newValue;
                changeValueCallback(wrapper);
            }, "Wait for completion").height;

            return(rect);
        }
Example #2
0
 public SerieAEventLoader(IDataOwner <IEnumerable <FootballEventMainInfo>, FootballEventParams> matchesDataOwner,
                          IDataOwner <FootballOdds, FootballEventMainInfo> oddsDataOwner,
                          IDataOwner <FootballStats, FootballEventMainInfo> statsDataOwner)
 {
     _matchesDataOwner = matchesDataOwner;
     _oddsDataOwner    = oddsDataOwner;
     _statsDataOwner   = statsDataOwner;
 }
Example #3
0
        /// <summary>
        /// Takes a <paramref name="collection"/> of entities and filters out the ones that must be skipped due to <paramref name="mode"/>
        /// or contains a <seealso cref="IBackgroundBehaviorData"/> with `IsBlocking` set to false.
        /// </summary>
        protected IEnumerable <IEntity> GetBlockingChildren(IEntityCollectionData collection, IMode mode)
        {
            return(collection.GetChildren()
                   .Where(child => mode.CheckIfSkipped(child.GetType()) == false)
                   .Where(child =>
            {
                IDataOwner dataOwner = child as IDataOwner;
                if (dataOwner == null)
                {
                    return true;
                }

                IBackgroundBehaviorData blockingData = dataOwner.Data as IBackgroundBehaviorData;
                return blockingData == null || blockingData.IsBlocking;
            }));
        }
Example #4
0
        private static IEnumerable <TEntity> GetBlockingChildren(TData data)
        {
            return(data.GetChildren()
                   .Where(child => data.Mode.CheckIfSkipped(child.GetType()) == false)
                   .Where(child =>
            {
                IDataOwner dataOwner = child as IDataOwner;
                if (dataOwner == null)
                {
                    return true;
                }

                IBackgroundBehaviorData blockingData = dataOwner.Data as IBackgroundBehaviorData;
                return blockingData == null || blockingData.IsBlocking;
            }));
        }
        private bool DoValidate(object value, out ValidatingExceptionMessage exceptionMessage)
        {
            exceptionMessage = null;

            if (DataTransactionHelper.IsDataTransactionObject(value))
            {
                return(DataTransactionHelper.Validate(value, out exceptionMessage));
            }
            IDataOwner dataOwner = PropertyOwner as IDataOwner;
            bool       isPass    =
                (dataOwner != null)
                ? dataOwner.Validate(value)
                : (CustomAttribute.IsRequired)
                    ? Validate(value)
                    : true;

            if (!isPass)
            {
                exceptionMessage                   = new ValidatingExceptionMessage();
                exceptionMessage.Reference         = PropertyOwner;
                exceptionMessage.ReferenceProperty = this;
            }
            return(isPass);
        }
Example #6
0
 public SerieAEventLoader(IDataOwner <IEnumerable <FootballEvent>, FootballEventParams> dataOwner)
 {
 }
 public ObserverExecutor(IDataOwner <TParams, TValue> dataOwner, ObserverCommand <TParams, TValue> command)
     : base(command)
 {
     DataOwner = dataOwner ?? throw new ArgumentNullException(nameof(dataOwner));
     OldValue  = DataOwner.GetData(Command.Params);
 }