コード例 #1
0
 private static void OnServerMessageReActionAllowed(Player player, MsgAllowReAction msg)
 {
     //throw new NotImplementedException();
     if (msg.ActionChairID == player.ChairId)
     {
         // my actions
         player.MyWnd.OnAllowedReActions(msg);
     }
 }
コード例 #2
0
        public void OnAllowedReActions(MsgAllowReAction msg)
        {
            HideAllActionButtons();
            CurrentAllowPlayerReAction = msg;
            CurrentAllowPlayerAction   = null;

            var actions = msg.AllowedActions;


            //if ((actions & (int)ActionType.enumActionType_KONG_Exposed) != 0)
            //{
            //    BtnAction1.Visibility = Visibility.Visible;
            //    BtnAction1.Content = "明杠";
            //    BtnAction1.Tag = (int)ActionType.enumActionType_KONG_Exposed;
            //}

            if ((actions & (int)ActionType.EnumActionTypeDiscard) != 0)
            {
                BtnAction2.Visibility = Visibility.Visible;
                BtnAction2.Content    = "出牌";
                BtnAction2.Tag        = (int)ActionType.EnumActionTypeDiscard;
            }

            //if ((actions & (int)ActionType.enumActionType_PONG) != 0)
            //{
            //    BtnAction3.Visibility = Visibility.Visible;
            //    BtnAction3.Content = "碰";
            //    BtnAction3.Tag = (int)ActionType.enumActionType_PONG;
            //}

            //if ((actions & (int)ActionType.enumActionType_SKIP) != 0)
            //{
            //    BtnAction4.Visibility = Visibility.Visible;
            //    BtnAction4.Content = "过";
            //    BtnAction4.Tag = (int)ActionType.enumActionType_SKIP;
            //}

            //if ((actions & (int)ActionType.enumActionType_WIN_Chuck) != 0)
            //{
            //    BtnAction5.Visibility = Visibility.Visible;
            //    BtnAction5.Content = "胡";
            //    BtnAction5.Tag = (int)ActionType.enumActionType_WIN_Chuck;
            //}

            if (MyOwner.CheckBoxAutoAction.IsChecked == false && IsAutoX)
            {
                // 自动打牌
                //if ((actions & (int)ActionType.enumActionType_SKIP) != 0)
                //{
                //    OnTakeActionSkip();
                //}
                if ((actions & (int)ActionType.EnumActionTypeDiscard) != 0)
                {
                    int specialCardID = -1;
                    if (CurrentAllowPlayerReAction.TimeoutInSeconds > 255)
                    {
                        specialCardID = (int)CardID.R3H;
                    }

                    //var currents = AgariIndex.FindGreatThanCardHand(CurrentAllowPlayerReAction.PrevActionHand, TilesHandList, specialCardID);
                    //if (null == currents || currents.Count == 0)
                    //{
                    //    MessageBox.Show("auto discard:oh shit, a huge bug");
                    //    throw new System.Exception("huge bug");
                    //}

                    //OnTakeActionDiscardTile(currents[0].cards);

                    HideAllActionButtons();
                }
            }
        }