Пример #1
0
        public TurnResult Play(FirstAction act, String roomname)
        {
            TurnResult result = new TurnResult();

            result.nextphase  = phase;
            result.nextplayer = currentPlayer;


            if (_rooms.Any(x => x.name == roomname))
            {
                if (phase == 0)
                {
                    if (act == FirstAction.Move)
                    {
                        result.accepted = _players[currentPlayer].Move(_rooms.First(x => x.name == roomname));
                    }

                    if (result.accepted)
                    {
                        phase            = 1;
                        result.nextphase = 1;
                    }
                }
            }
            return(result);
        }
Пример #2
0
 public event Action FirstAction;//定义委托事件
 public void WaterOK()
 {
     Console.WriteLine($"{0} 烧开了....", this.GetType().Name);
     if (this.FirstAction != null)
     {
         FirstAction.Invoke();
     }
 }
Пример #3
0
        public void Should_replace_action_when_updating()
        {
            var newAction = new FirstAction();

            var rule_1 = rule_0.Update(newAction);

            Assert.NotSame(newAction, rule_0.Action);
            Assert.Same(newAction, rule_1.Action);
        }
Пример #4
0
 public void Execute()
 {
     if (IsFirst)
     {
         IsFirst = false;
         FirstAction?.Invoke();
         return;
     }
     UnFirstAction?.Invoke();
 }
Пример #5
0
        public void Should_create_with_trigger_and_action()
        {
            var ruleTrigger = new ContentChangedTrigger();
            var ruleAction  = new FirstAction();

            var newRule = new Rule(ruleTrigger, ruleAction);

            Assert.Equal(ruleTrigger, newRule.Trigger);
            Assert.Equal(ruleAction, newRule.Action);
            Assert.True(newRule.IsEnabled);
        }
Пример #6
0
 public void Compose(IContainer container)
 {
     FirstAction?.Invoke(container);
     ComposeAction?.DynamicInvoke(new object[] { new object[] { container } });
 }