示例#1
0
        public bool ExecuteAction(GameContext context, List<MJsonMessageAll> msgList)
        {
            var nextAction = SelectHighPriorityMessage(msgList);

            if (nextAction.IsREACH())
            {
                return context.OnReach(nextAction.actor);

            }
            else if (nextAction.IsANKAN())
            {
                return context.OnAnkan(nextAction.actor, nextAction.consumed);
            }
            else if (nextAction.IsKAKAN())
            {
                return context.OnKakan(nextAction.actor, nextAction.pai, nextAction.consumed);
            }
            else if (nextAction.IsHORA())
            {
                return context.OnHora(nextAction.actor, nextAction.target, nextAction.pai);
            }
            else if (nextAction.IsDAHAI())
            {
                return context.OnDahai(nextAction.actor, nextAction.pai, nextAction.tsumogiri);
            }
            else
            {
                // it is error if this line executed;
               Debug.Assert(false);
               return false;
            }
        }
示例#2
0
        public bool ExecuteAction(GameContext context, List<MJsonMessageAll> msgList)
        {
            var nextAction = SelectHighPriorityMessage(msgList);

            if (nextAction.IsNONE())
            {
                return context.OnOpenDora();
            }
            else if (nextAction.IsHORA())
            {
                return context.OnHora(nextAction.actor, nextAction.target, nextAction.pai);
            }
            else
            {
                Debug.Assert(false);
                return false;  // If this line executed, It is Error ;
            }
        }
示例#3
0
 public bool ExecuteAction(GameContext context, List<MJsonMessageAll> msgList)
 {
     if (msgList.Exists(e => e.IsHORA()))
     {
         var nextAction = msgList.First(e => e.IsHORA());
         return context.OnHora(nextAction.actor, nextAction.target, nextAction.pai);
     }
     else
     {
         return context.OnReachAccept();
     }
 }
示例#4
0
        public bool ExecuteAction(GameContext context, List<MJsonMessageAll> msgList)
        {
            var nextAction = SelectHighPriorityMessage(msgList);

            // check hora
            if (nextAction.IsHORA())
            {
                return context.OnHora(nextAction.actor, nextAction.target, nextAction.pai);
            }
            // check kyokuend
            if ( context.OnCheckIsRyukyoku() )
            {
                return context.OnRyukyoku();
            }

            // execute action
            if (nextAction.IsPON())
            {
                return context.OnPon(nextAction.actor, nextAction.target, nextAction.pai, nextAction.consumed);
            }
            else if (nextAction.IsCHI())
            {
                return context.OnChi(nextAction.actor, nextAction.target, nextAction.pai, nextAction.consumed);
            }
            else if (nextAction.IsDAIMINKAN())
            {
                return context.OnDaiminkan(nextAction.actor, nextAction.target, nextAction.pai, nextAction.consumed);
            }
            else if (nextAction.IsNONE())
            {
                return context.OnTsumo();
            }
            else
            {
                Debug.Assert(false);
                return false;  // If this line executed, It is Error ;
            }
        }