コード例 #1
0
        /// <summary>
        /// Applies an action to ALL actors found in the list based on a matching predicate (and action) defined in the eventData object
        ///
        /// Usage:
        ///    EventDispatcher.Publish(new EventData(
        ///         EventCategoryType.UI, EventActionType.OnApplyActionToFirstMatchActor,
        ///        (actor) => actor.StatusType = StatusType.Drawn,
        ///        (actor) => actor.ActorType == ActorType.UITextureObject
        ///       && actor.ID.Equals("green key"), null));
        ///
        ///
        /// </summary>
        /// <param name="eventData"></param>
        public void ApplyActionToAllActors(EventData eventData)
        {
            if (eventData.Predicate != null && eventData.Action != null)
            {
                List <DrawnActor3D> list = null;

                //we need to look in both lists for the actor since we dont know which it is in
                list = opaqueList.FindAll(eventData.Predicate);
                if (list != null)
                {
                    foreach (DrawnActor3D actor in list)
                    {
                        eventData.Action(actor);
                    }
                }
                // list.Clear();

                list = transparentList.FindAll(eventData.Predicate);
                if (list != null)
                {
                    foreach (DrawnActor3D actor in list)
                    {
                        eventData.Action(actor);
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Applies an action to the FIRST actor found in the list based on a matching predicate (and action) defined in the eventData object
 ///
 /// Usage:
 ///    EventDispatcher.Publish(new EventData(
 ///         EventCategoryType.UI, EventActionType.OnApplyActionToFirstMatchActor,
 ///        (actor) => actor.StatusType = StatusType.Drawn,
 ///        (actor) => actor.ActorType == ActorType.UITextureObject
 ///       && actor.ID.Equals("green key"), null));
 ///
 ///
 /// </summary>
 /// <param name="eventData"></param>
 public void ApplyActionToActor(EventData eventData)
 {
     if (eventData.Predicate != null && eventData.Action != null)
     {
         DrawnActor2D actor = uiObjectList.Find(eventData.Predicate);
         if (actor != null)
         {
             eventData.Action(actor);
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Applies an action to an actor found in the object manager based on a predicate (and action) defined in the eventData object
        ///
        /// Usage:
        ///    EventDispatcher.Publish(new EventData(
        ///         EventCategoryType.Object, EventActionType.OnApplyActionToActor,
        ///        (actor) => actor.StatusType = StatusType.Drawn,
        ///        (actor) => actor.ActorType == ActorType.Decorator
        ///       && actor.ID.Equals("green key"), null));
        ///
        ///
        /// </summary>
        /// <param name="eventData"></param>
        private void ApplyActionToActor(EventData eventData)
        {
            if (eventData.Predicate != null && eventData.Action != null)
            {
                DrawnActor3D actor = null;

                //we need to look in both lists for the actor since we dont know which it is in
                actor = opaqueList.Find(eventData.Predicate);
                if (actor != null)
                {
                    eventData.Action(actor);
                }

                actor = transparentList.Find(eventData.Predicate);
                if (actor != null)
                {
                    eventData.Action(actor);
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Applies an action to ALL actors found in the list based on a matching predicate (and action) defined in the eventData object
 ///
 /// Usage:
 ///    EventDispatcher.Publish(new EventData(
 ///         EventCategoryType.UI, EventActionType.OnApplyActionToFirstMatchActor,
 ///        (actor) => actor.StatusType = StatusType.Drawn,
 ///        (actor) => actor.ActorType == ActorType.UITextureObject
 ///       && actor.ID.Equals("green key"), null));
 ///
 ///
 /// </summary>
 /// <param name="eventData"></param>
 public void ApplyActionToAllActors(EventData eventData)
 {
     if (eventData.Predicate != null && eventData.Action != null)
     {
         List <DrawnActor2D> list = uiObjectList.FindAll(eventData.Predicate);
         if (list != null)
         {
             foreach (DrawnActor2D actor in list)
             {
                 eventData.Action(actor);
             }
         }
     }
 }