示例#1
0
        public bool OnActionPerformed <T>(IActionPerformer <T> sender, ActionPerformedEventArgs <T> args)
            where T : IViewModel, new()
        {
            if (this.Behaviors.ContainsKey(args.BehaviorName) == false)
            {
                return(false);
            }

            var behavior = this.Behaviors[args.BehaviorName] as IBehavior <T>;

            if (behavior == null)
            {
                return(false);
            }

            behavior.Execute(args);

            var viewName = this.Mapping[args.BehaviorName];

            var nextView = this.GetNextView(viewName);

            this.OnBeforeViewSwitch(nextView, behavior);

            this.SwitchView(sender as ApplicationViewBase, viewName, args);

            return(true);
        }
示例#2
0
        /**
         * Perform multiple actions when binding to an ActionAcceptor
         */

        public void Bind(IBinder binder)
        {
            IActionPerformer   performer   = binder as IActionPerformer;
            PerformableActions performable = performer.PerformableActions;
            AcceptableActions  acceptable  = binder.BoundAcceptor.AcceptableActions;

            performable.RefreshEnabledActions();
            acceptable.Bind(performer);
            acceptable.RefreshEnabledActions();

            PerformerAction matching = null;

            foreach (var action in performable.EnabledActions)
            {
                AcceptorAction acceptorAction;
                if (acceptable.EnabledActions.TryGetValue(action.Key, out acceptorAction))
                {
                    PerformerAction performerAction = action.Value;
                    performerAction.Bind(acceptorAction.AcceptCondition);
                    matching = performerAction;
                    break;
                }
            }

            StartCoroutine(PerformActions(binder, matching));
        }
示例#3
0
        public void Bind(IActionPerformer boundPerformer)
        {
            IInventoryHolder holder         = boundPerformer as IInventoryHolder;
            Inventory        boundInventory = holder.Inventory;

            foreach (var action in Actions)
            {
                AcceptorAction acceptorAction = action.Value as AcceptorAction;
                acceptorAction.Bind(boundInventory);
            }
        }
示例#4
0
        IEnumerator PerformActions(IBinder binder, PerformerAction action)
        {
            if (action != null)
            {
                yield return(StartCoroutine(Perform(action)));

                Bind(binder);
            }
            else
            {
                IActionPerformer performer = binder as IActionPerformer;
                performer.PerformableActions.RefreshEnabledActions();
                binder.OnEndActions();
            }
        }
示例#5
0
 public PerformableActions(IActionPerformer performer)
 {
     this.performer = performer;
 }
示例#6
0
 public override void PerformAction(IActionPerformer actionPerformer) => actionPerformer.ActivateImage(this);
示例#7
0
 public ActionScheduler(IActionPerformer actionPerformer, TActionGenerator actionGenerator, TSchedulerConfiguration settings, IContainer container)
     : base(actionPerformer, actionGenerator, settings, container)
 {
 }
示例#8
0
 public override void PerformAction(IActionPerformer actionPerformer) => actionPerformer.ActivateHyperlink(this);