예제 #1
0
        private void invokeCommand(Type cmd, ISequenceBinding binding, object data, int depth)
        {
            ISequenceCommand command = createCommand(cmd, data);

            command.sequenceId = depth;
            trackCommand(command, binding);
            executeCommand(command);
            ReleaseCommand(command);
        }
예제 #2
0
        override public void ReactTo(object key, object data)
        {
            ISequenceBinding binding = GetBinding(key) as ISequenceBinding;

            if (binding != null)
            {
                nextInSequence(binding, data, 0);
            }
        }
예제 #3
0
 public void ReleaseCommand(ISequenceCommand command)
 {
     if (command.retain == false)
     {
         if (activeSequences.ContainsKey(command))
         {
             ISequenceBinding binding = activeSequences [command] as ISequenceBinding;
             object           data    = command.data;
             activeSequences.Remove(command);
             nextInSequence(binding, data, command.sequenceId + 1);
         }
     }
 }
예제 #4
0
 private void nextInSequence(ISequenceBinding binding, object data, int depth)
 {
     object[] values = binding.value as object[];
     if (depth < values.Length)
     {
         Type cmd = values [depth] as Type;
         invokeCommand(cmd, binding, data, depth);
     }
     else
     {
         if (binding.isOneOff)
         {
             Unbind(binding);
         }
     }
 }
예제 #5
0
        public void Stop(object key)
        {
            ISequenceBinding binding = GetBinding(key) as ISequenceBinding;

            if (binding != null)
            {
                if (activeSequences.ContainsValue(binding))
                {
                    foreach (KeyValuePair <ISequenceCommand, ISequenceBinding> sequence in activeSequences)
                    {
                        if (sequence.Value == binding)
                        {
                            ISequenceCommand command = sequence.Key;
                            removeSequence(command);
                        }
                    }
                }
            }
        }
예제 #6
0
 private void trackCommand(ISequenceCommand command, ISequenceBinding binding)
 {
     activeSequences [command] = binding;
 }