Ejemplo n.º 1
0
        /// <summary>
        /// 玩家按下吃事件呼叫
        /// </summary>
        internal void chow(Brand brand)
        {
            CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);

            if (c.Chow())
            {
                if (c.ChowLength == 1)
                {
                    PlayerSort p = new PlayerSort(c.SuccessPlayer);
                    all.chow_pong(brand, p.getPlayer);
                }
                else
                {
                    if (all.State == table.place.Down)
                    {
                        ChowBrandCheck cbc = new ChowBrandCheck(c.ChowPlayer);
                        cbc.ShowDialog();
                        PlayerSort p = new PlayerSort(cbc.SelectBrandPlayer);
                        all.chow_pong(brand, p.getPlayer);
                    }
                    else
                    {
                        chat.SendObject(c.ChowPlayer);
                    }
                }
            }
            Chow_Pong_Brand = true;
            updatePlayer_Table();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 玩家按下碰事件呼叫
        /// </summary>
        internal void pong(Brand brand)
        {
            CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);

            if (c.Pong())
            {
                all.chow_pong(brand, c.SuccessPlayer);
            }
            Chow_Pong_Brand = true;
            updatePlayer_Table();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 把牌丟給玩家,看是否要吃 碰 槓 過水 胡
        /// </summary>
        internal virtual void toUser(Brand brand, bool chow, bool pong, bool kong, bool darkkong, bool win)
        {
            CPK         cpk = new CPK(this, brand);
            CheckBrands c   = new CheckBrands(brand, NowPlayer_removeTeam);
            CheckBrands w   = new CheckBrands(brand, all.NowPlayer);

            cpk.Enabled_Button(chow, pong, kong, darkkong, win);
            if (chow || pong || kong || win || darkkong)
            {
                cpk.ShowDialog();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 把牌丟給玩家,看是否要吃 碰 槓 過水 胡
        /// </summary>
        internal virtual void toUser(CheckUser check)
        {
            CPK cpk = new CPK(this, check);

            CheckBrands c = new CheckBrands(check.Brand, NowPlayer_removeTeam);
            CheckBrands w = new CheckBrands(check.Brand, all.NowPlayer);

            cpk.Enabled_Button(check.Chow, check.Pong, check.Kong, check.DarkKong, check.Win);
            if (check.Chow || check.Pong || check.Kong || check.Win || check.DarkKong)
            {
                cpk.ShowDialog();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 玩家按下暗槓事件呼叫
        /// </summary>
        internal void dark_kong(Brand brand)
        {
            CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
            CheckBrands d = new CheckBrands(NowPlayer_removeTeam);

            if (c.Kong())
            {
                all.DarkKong(brand, c.SuccessPlayer);
            }
            else if (d.DarkKong())
            {
                all.DarkKong(brand, d.SuccessPlayer);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 玩家按下槓事件呼叫
        /// </summary>
        internal void kong(Brand brand)
        {
            CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
            CheckBrands d = new CheckBrands(brand, all.NowPlayer);

            if (c.Kong())
            {
                all.kong(brand, c.SuccessPlayer);
            }
            else if (d.Kong())
            {
                all.kong(brand, d.SuccessPlayer);
            }
            updatePlayer_Table();
        }
Ejemplo n.º 7
0
 private bool check_chow(Brand brand)
 {
     // 有沒有人要吃
     for (int i = 0; i < 3; i++)
     {
         all.next();
         CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
         CheckBrands w = new CheckBrands(brand, all.NowPlayer);
         Ai.setPlayer(brand, all.NowPlayer);
         // 只有下家能吃
         if (c.Chow() && i == 0)
         {
             // 如果是真實玩家
             if (NowPlayer_is_Real_Player)
             {
                 CheckUser check = new Control.CheckUser((c.Chow() && i == 0), c.Pong(), c.Kong(), false, w.Win(), true, brand);
                 toUser(check);
                 if (Player_Pass_Brand)
                 {
                     Player_Pass_Brand = false;
                 }
                 else
                 {
                     return(true);
                 }
             }
             else if (Ai.Chow)
             {
                 setInforamtion();
                 if (PlayerSound)
                 {
                     soundplayer.Stream = Resources.chow;
                     soundplayer.Play();
                 }
                 if (showMessageBox)
                 {
                     ShowMessage(Mahjong.Properties.Settings.Default.Chow);
                 }
                 all.chow_pong(brand, c.SuccessPlayer);
                 updatePlayer_Table();
                 Chow_Pong_Brand = true;
                 return(true);
             }
         }
     }
     all.next();
     return(false);
 }
Ejemplo n.º 8
0
 private bool check_win(Brand brand)
 {
     // 有沒有人要胡
     for (int i = 0; i < 3; i++)
     {
         all.next();
         CheckBrands w = new CheckBrands(brand, all.NowPlayer);
         Ai.setPlayer(brand, all.NowPlayer);
         if (w.Win())
         {
             // 如果是玩家
             if (NowPlayer_is_Real_Player)
             {
                 CheckUser check = new Control.CheckUser(false, false, false, false, true, true, brand);
                 toUser(check);
                 // 如果玩家按下過水 就跳過
                 if (Player_Pass_Brand)
                 {
                     Player_Pass_Brand = false;
                 }
                 // 若不是按下過水就傳回 失敗
                 else
                 {
                     return(true);
                 }
             }
             else if (Ai.Win)
             {
                 // 更新資訊盒
                 setInforamtion();
                 if (PlayerSound)
                 {
                     soundplayer.Stream = Resources.win;
                     soundplayer.Play();
                 }
                 if (showMessageBox)
                 {
                     ShowMessage(Mahjong.Properties.Settings.Default.Win);
                 }
                 win_game(brand);
                 return(true);
             }
         }
     }
     all.next();
     return(false);
 }
Ejemplo n.º 9
0
        internal void getBrand(Brand brand)
        {
            if (myTurn)
            {
                CPK cpk = new CPK(this, checkuser);
                cpk.Network = true;
                //cpk.Checkuser = checkuser;
                CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
                CheckBrands w = new CheckBrands(brand, all.NowPlayer);
                cpk.Enabled_Button(checkuser.Chow, checkuser.Pong, checkuser.Kong, checkuser.DarkKong, checkuser.Win);
                //if (checkuser.Chow || checkuser.Pong || checkuser.Kong || checkuser.Win || checkuser.DarkKong)
                cpk.ShowDialog();

                chat.SendObject(cpk.Checkuser);
            }
            else if (iAmServer)
            {
                chat.SendObject(all);
                makeBrand(brand);
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// ��P�ᵹ���a�A�ݬO�_�n�Y �I �b �L�� �J
 /// </summary>
 internal virtual void toUser(Brand brand, bool chow, bool pong, bool kong, bool darkkong, bool win)
 {
     CPK cpk = new CPK(this, brand);
     CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
     CheckBrands w = new CheckBrands(brand, all.NowPlayer);
     cpk.Enabled_Button(chow, pong, kong, darkkong, win);
     if (chow || pong || kong || win || darkkong)
         cpk.ShowDialog();
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 摸牌
        /// </summary>
        internal void touchBrand()
        {
            table.updateNowPlayer();
            // 摸牌給現在的玩家
            Brand nextbrand = all.nextBrand();

            // 補花並加上一張牌
            if (all.Player_setFlower(nextbrand))
            {
                touchBrand();
            }
            else
            {
                // 是否胡牌或槓牌(手牌加摸到的牌)
                CheckBrands win = new CheckBrands(nextbrand, all.NowPlayer);
                // 除去顯示牌看是否有暗槓(移除牌組的牌加摸到的牌)
                CheckBrands kong = new CheckBrands(nextbrand, NowPlayer_removeTeam);
                // 除去顯示或打出的牌看是否有暗槓
                CheckBrands darkkong = new CheckBrands(NowPlayer_removeTeam);
                // 只有牌組和摸進來的牌做比較
                CheckBrands teamKong = new CheckBrands(nextbrand, NowPlayer_OnlyTeam);
                if (win.Win())
                {
                    // 更新資訊盒
                    setInforamtion();
                    if (showMessageBox)
                    {
                        ShowMessage(Settings.Default.TouchWin);
                    }
                    win_game(nextbrand);
                }
                // 手牌暗槓(摸到有暗槓和手牌中就有暗槓)
                else if (darkkong.DarkKong() || kong.Kong())
                {
                    // 如果是玩家
                    if (NowPlayer_is_Real_Player)
                    {
                        Brand br = null;
                        if (darkkong.DarkKong())
                        {
                            br = darkkong.SuccessPlayer.getBrand(0);
                        }
                        else if (kong.Kong())
                        {
                            br = kong.SuccessPlayer.getBrand(0);
                        }

                        toUser(br, false, false, false, kong.Kong() || darkkong.DarkKong(), false);
                        // 如果玩家按下過水 就跳過
                        if (Player_Pass_Brand)
                        {
                            Player_Pass_Brand = false;
                        }
                        else
                        {
                            touchBrand();
                        }
                    }
                    // 如果不是玩家
                    else
                    {
                        if (showMessageBox)
                        {
                            ShowMessage(Mahjong.Properties.Settings.Default.DarkKong);
                        }
                        if (kong.Kong())
                        {
                            if (PlayerSound)
                            {
                                soundplayer.Stream = Resources.kong;
                                soundplayer.Play();
                            }
                            all.DarkKong(nextbrand, kong.SuccessPlayer);
                        }
                        else if (darkkong.DarkKong())
                        {
                            if (PlayerSound)
                            {
                                soundplayer.Stream = Resources.kong;
                                soundplayer.Play();
                            }
                            all.DarkKong(nextbrand, darkkong.SuccessPlayer);
                        }
                        touchBrand();
                    }
                }
                // 明碰之後再槓
                else if (teamKong.Kong())
                {
                    if (NowPlayer_is_Real_Player)
                    {
                        toUser(nextbrand, false, false, teamKong.Kong(), false, false);
                        if (Player_Pass_Brand)
                        {
                            Player_Pass_Brand = false;
                        }
                        else
                        {
                            touchBrand();
                        }
                    }
                    else
                    {
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.kong;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                        {
                            ShowMessage(Mahjong.Properties.Settings.Default.Kong);
                        }
                        all.kong(nextbrand, darkkong.SuccessPlayer);
                        touchBrand();
                    }
                }
                else
                {
                    // 把牌加入玩家
                    all.NowPlayer.add(nextbrand);
                    table.updateNowPlayer();
                }
            }
        }
Ejemplo n.º 12
0
        private bool check_pong_kong(Brand brand)
        {
            // 測試是否被 槓 碰
            for (int i = 0; i < 3; i++)
            {
                all.next();
                CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
                CheckBrands w = new CheckBrands(brand, all.NowPlayer);
                Ai.setPlayer(brand, all.NowPlayer);
                // 如果是玩家
                if (NowPlayer_is_Real_Player)
                {
                    if (c.Pong() || c.Kong())
                    {
                        toUser(brand, (c.Chow() && i == 0), c.Pong(), c.Kong(), false, w.Win());
                        if (Player_Pass_Brand)
                        {
                            Player_Pass_Brand = false;
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    // 槓
                    if (c.Kong() && Ai.Kong)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.kong;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                        {
                            ShowMessage(Mahjong.Properties.Settings.Default.Kong);
                        }
                        all.kong(brand, c.SuccessPlayer);
                        Chow_Pong_Brand = false;
                        updatePlayer_Table();
                        return(true);
                    }
                    // 碰
                    else if (c.Pong() && Ai.Pong)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.pon;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                        {
                            ShowMessage(Mahjong.Properties.Settings.Default.Pong);
                        }
                        all.chow_pong(brand, c.SuccessPlayer);
                        updatePlayer_Table();
                        Chow_Pong_Brand = true;

                        return(true);
                    }
                }
            }
            all.next();
            return(false);
        }
Ejemplo n.º 13
0
        public CheckTest()
        {
            BrandPlayer a = new BrandPlayer();

            //a.add(new TenThousandBrand(5));
            //a.add(new TenThousandBrand(6));
            //a.add(new TenThousandBrand(7));
            //a.add(new TenThousandBrand(6));
            //a.add(new TenThousandBrand(7));
            //a.add(new TenThousandBrand(8));

            //a.add(new RopeBrand(4));
            //a.add(new RopeBrand(5));
            //a.add(new RopeBrand(6));

            a.add(new TubeBrand(2));
            a.add(new TubeBrand(2));
            a.add(new TubeBrand(2));
            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(5));
            //a.add(new TubeBrand(8));
            //a.add(new TubeBrand(8));

            //FlowerBrand f = new FlowerBrand(1);
            //f.Team = 1;
            //a.add(f);

            //WordBrand r = new WordBrand(9);
            ////r.Team = 2;
            //a.add(r);
            //a.add(r);
            //a.add(r);
            ////a.add(r);

            //TubeBrand t = new TubeBrand(9);
            //t.Team = 3;
            //a.add(t);
            //a.add(t);
            //a.add(t);

            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(9));
            //a.add(new TubeBrand(9));
            //WordBrand w = new WordBrand(6);
            //w.Team = 2;
            //a.add(w);
            //a.add(w);
            //a.add(w);
            //a.add(w);

            //Brand b = new TubeBrand(2);
            //CheckUser c = new Check(b,a);
            printplayer(a);
            CheckBrands c = new CheckBrands(new TubeBrand(2), a);

            a.add(new TubeBrand(2));
            CheckBrands d = new CheckBrands(a);

            //if (c.Win())
            //{
            //    Console.WriteLine("有胡!!");
            //    printplayer(c.SuccessPlayer);
            //}
            if (c.Chow())
            {
                Console.WriteLine("===========");
                Console.WriteLine("\n有吃");
                Console.WriteLine(c.ChowLength);
                printplayer(c.SuccessPlayer);
                printplayer(c.ChowPlayer[0]);
                printplayer(c.ChowPlayer[1]);
                printplayer(c.ChowPlayer[2]);
                Console.WriteLine("===========");
            }
            if (c.Pong())
            {
                Console.WriteLine("\n有碰");
                printplayer(c.SuccessPlayer);
            }
            if (c.Kong())
            {
                Console.WriteLine("\n有槓");
                printplayer(c.SuccessPlayer);
            }
            if (d.DarkKong())
            {
                Console.WriteLine("\n有暗槓");
                printplayer(c.SuccessPlayer);
            }

            if (//!c.Win() &&
                !c.Chow() && !c.Pong() && !c.Kong() && !c.DarkKong())
            {
                Console.WriteLine("\n都沒");
            }
            printplayer(a);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// ��P�ᵹ���a�A�ݬO�_�n�Y �I �b �L�� �J
        /// </summary>
        internal virtual void toUser(CheckUser check)
        {
            CPK cpk = new CPK(this, check);

            CheckBrands c = new CheckBrands(check.Brand, NowPlayer_removeTeam);
            CheckBrands w = new CheckBrands(check.Brand, all.NowPlayer);
            cpk.Enabled_Button(check.Chow, check.Pong, check.Kong, check.DarkKong, check.Win);
            if (check.Chow || check.Pong || check.Kong || check.Win || check.DarkKong)
                cpk.ShowDialog();
        }
Ejemplo n.º 15
0
 /// <summary>
 /// ���a���U�I�ƥ�I�s
 /// </summary>
 internal void pong(Brand brand)
 {
     CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
     if (c.Pong())
         all.chow_pong(brand, c.SuccessPlayer);
     Chow_Pong_Brand = true;
     updatePlayer_Table();
 }
Ejemplo n.º 16
0
 /// <summary>
 /// ���a���U�b�ƥ�I�s
 /// </summary>
 internal void kong(Brand brand)
 {
     CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
     CheckBrands d = new CheckBrands(brand, all.NowPlayer);
     if (c.Kong())
         all.kong(brand, c.SuccessPlayer);
     else if (d.Kong())
         all.kong(brand, d.SuccessPlayer);
     updatePlayer_Table();
 }
Ejemplo n.º 17
0
 /// <summary>
 /// ���a���U�t�b�ƥ�I�s
 /// </summary>
 internal void dark_kong(Brand brand)
 {
     CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
     CheckBrands d = new CheckBrands(NowPlayer_removeTeam);
     if (c.Kong())
         all.DarkKong(brand, c.SuccessPlayer);
     else if (d.DarkKong())
         all.DarkKong(brand, d.SuccessPlayer);
 }
Ejemplo n.º 18
0
        internal void getBrand(Brand brand)
        {
            if (myTurn)
            {
                CPK cpk = new CPK(this, brand);
                cpk.Network = true;
                cpk.Checkuser = checkuser;
                CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
                CheckBrands w = new CheckBrands(brand, all.NowPlayer);
                cpk.Enabled_Button(checkuser.Chow, checkuser.Pong, checkuser.Kong, checkuser.DarkKong, checkuser.Win);
                //if (checkuser.Chow || checkuser.Pong || checkuser.Kong || checkuser.Win || checkuser.DarkKong)
                    cpk.ShowDialog();

                chat.SendObject(cpk.Checkuser);
            }
            else if (iAmServer)
            {
                chat.SendObject(all);
                makeBrand(brand);
            }
        }
Ejemplo n.º 19
0
 private bool check_win(Brand brand)
 {
     // ���S���H�n�J
     for (int i = 0; i < 3; i++)
     {
         all.next();
         CheckBrands w = new CheckBrands(brand, all.NowPlayer);
         Ai.setPlayer(brand, all.NowPlayer);
         if (w.Win())
         {
             // �p�G�O���a
             if (NowPlayer_is_Real_Player)
             {
                 toUser(brand, false, false, false, false, true);
                 // �p�G���a���U�L�� �N���L
                 if (Player_Pass_Brand)
                     Player_Pass_Brand = false;
                 // �Y���O���U�L��N�Ǧ^ ����
                 else
                     return true;
             }
             else if (Ai.Win)
             {
                 // ��s��T��
                 setInforamtion();
                 if (PlayerSound)
                 {
                     soundplayer.Stream = Resources.win;
                     soundplayer.Play();
                 }
                 if (showMessageBox)
                     ShowMessage(Mahjong.Properties.Settings.Default.Win);
                 win_game(brand);
                 return true;
             }
         }
     }
     all.next();
     return false;
 }
Ejemplo n.º 20
0
        private bool check_pong_kong(Brand brand)
        {
            // ���լO�_�Q �b �I
            for (int i = 0; i < 3; i++)
            {
                all.next();
                CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
                CheckBrands w = new CheckBrands(brand, all.NowPlayer);
                Ai.setPlayer(brand, all.NowPlayer);
                // �p�G�O���a
                if (NowPlayer_is_Real_Player)
                {
                    if (c.Pong() || c.Kong())
                    {
                        toUser(brand, (c.Chow() && i == 0), c.Pong(), c.Kong(), false, w.Win());
                        if (Player_Pass_Brand)
                            Player_Pass_Brand = false;
                        else
                            return true;
                    }
                }
                else
                {
                    // �b
                    if (c.Kong() && Ai.Kong)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.kong;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                            ShowMessage(Mahjong.Properties.Settings.Default.Kong);
                        all.kong(brand, c.SuccessPlayer);
                        Chow_Pong_Brand = false;
                        updatePlayer_Table();
                        return true;
                    }
                    // �I
                    else if (c.Pong() && Ai.Pong)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.pon;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                            ShowMessage(Mahjong.Properties.Settings.Default.Pong);
                        all.chow_pong(brand, c.SuccessPlayer);
                        updatePlayer_Table();
                        Chow_Pong_Brand = true;

                        return true;
                    }
                }
            }
            all.next();
            return false;
        }
Ejemplo n.º 21
0
        private bool check_chow(Brand brand)
        {
            // ���S���H�n�Y
            for (int i = 0; i < 3; i++)
            {
                all.next();
                CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
                CheckBrands w = new CheckBrands(brand, all.NowPlayer);
                Ai.setPlayer(brand, all.NowPlayer);
                // �u���U�a��Y
                if (c.Chow() && i == 0)
                {
                    // �p�G�O�u�ꪱ�a
                    if (NowPlayer_is_Real_Player)
                    {
                        toUser(brand, (c.Chow() && i == 0), c.Pong(), c.Kong(), false, w.Win());
                        if (Player_Pass_Brand)
                            Player_Pass_Brand = false;
                        else
                            return true;
                    }
                    else if (Ai.Chow)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.chow;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                            ShowMessage(Mahjong.Properties.Settings.Default.Chow);
                        all.chow_pong(brand, c.SuccessPlayer);
                        updatePlayer_Table();
                        Chow_Pong_Brand = true;
                        return true;
                    }
                }

            }
            all.next();
            return false;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// �N�P
        /// </summary>
        internal void touchBrand()
        {
            table.updateNowPlayer();
            // �N�P���{�b�����a
            Brand nextbrand = all.nextBrand();
            // �ɪ�å[�W�@�i�P
            if (all.Player_setFlower(nextbrand))
            {
                touchBrand();
            }
            else
            {
                // �O�_�J�P�κb�P(��P�[�N�쪺�P)
                CheckBrands win = new CheckBrands(nextbrand, all.NowPlayer);
                // ���h��ܵP�ݬO�_���t�b(�����P�ժ��P�[�N�쪺�P)
                CheckBrands kong = new CheckBrands(nextbrand, NowPlayer_removeTeam);
                // ���h��ܩΥ��X���P�ݬO�_���t�b
                CheckBrands darkkong = new CheckBrands(NowPlayer_removeTeam);
                // �u���P�թM�N�i�Ӫ��P�����
                CheckBrands teamKong = new CheckBrands(nextbrand, NowPlayer_OnlyTeam);
                if (win.Win())
                {
                    // ��s��T��
                    setInforamtion();
                    if (showMessageBox)
                        ShowMessage(Settings.Default.TouchWin);
                    win_game(nextbrand);
                }
                // ��P�t�b(�N�즳�t�b�M��P���N���t�b)
                else if (darkkong.DarkKong() || kong.Kong())
                {
                    // �p�G�O���a
                    if (NowPlayer_is_Real_Player)
                    {
                        Brand br = null;
                        if (darkkong.DarkKong())
                        {
                            br = darkkong.SuccessPlayer.getBrand(0);
                        }
                        else if (kong.Kong())
                        {
                            br = kong.SuccessPlayer.getBrand(0);
                        }

                        toUser(br, false, false, false, kong.Kong() || darkkong.DarkKong(), false);
                        // �p�G���a���U�L�� �N���L
                        if (Player_Pass_Brand)
                            Player_Pass_Brand = false;
                        else
                        {
                            touchBrand();
                        }
                    }
                    // �p�G���O���a
                    else
                    {
                        if (showMessageBox)
                            ShowMessage(Mahjong.Properties.Settings.Default.DarkKong);
                        if (kong.Kong())
                        {
                            if (PlayerSound)
                            {
                                soundplayer.Stream = Resources.kong;
                                soundplayer.Play();
                            }
                            all.DarkKong(nextbrand, kong.SuccessPlayer);
                        }
                        else if (darkkong.DarkKong())
                        {
                            if (PlayerSound)
                            {
                                soundplayer.Stream = Resources.kong;
                                soundplayer.Play();
                            }
                            all.DarkKong(nextbrand, darkkong.SuccessPlayer);
                        }
                        touchBrand();
                    }
                }
                // ���I����A�b
                else if (teamKong.Kong())
                {
                    if (NowPlayer_is_Real_Player)
                    {
                        toUser(nextbrand, false, false, teamKong.Kong(), false, false);
                        if (Player_Pass_Brand)
                            Player_Pass_Brand = false;
                        else
                        {
                            touchBrand();
                        }
                    }
                    else
                    {
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.kong;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                            ShowMessage(Mahjong.Properties.Settings.Default.Kong);
                        all.kong(nextbrand, darkkong.SuccessPlayer);
                        touchBrand();
                    }
                }
                else
                {
                    // ��P�[�J���a
                    all.NowPlayer.add(nextbrand);
                    table.updateNowPlayer();
                }
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 /// ���a���U�Y�ƥ�I�s
 /// </summary>
 internal void chow(Brand brand)
 {
     CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
     if (c.Chow())
         if (c.ChowLength == 1)
         {
             PlayerSort p = new PlayerSort(c.SuccessPlayer);
             all.chow_pong(brand, p.getPlayer);
         }
         else
         {
             if (all.State == table.place.Down)
             {
                 ChowBrandCheck cbc = new ChowBrandCheck(c.ChowPlayer);
                 cbc.ShowDialog();
                 PlayerSort p = new PlayerSort(cbc.SelectBrandPlayer);
                 all.chow_pong(brand, p.getPlayer);
             }
             else
             {
                 chat.SendObject(c.ChowPlayer);
             }
         }
     Chow_Pong_Brand = true;
     updatePlayer_Table();
 }
Ejemplo n.º 24
0
        public CheckTest()
        {
            BrandPlayer a = new BrandPlayer();
            //a.add(new TenThousandBrand(5));
            //a.add(new TenThousandBrand(6));
            //a.add(new TenThousandBrand(7));
            //a.add(new TenThousandBrand(6));
            //a.add(new TenThousandBrand(7));
            //a.add(new TenThousandBrand(8));

            //a.add(new RopeBrand(4));
            //a.add(new RopeBrand(5));
            //a.add(new RopeBrand(6));

            a.add(new TubeBrand(2));
            a.add(new TubeBrand(2));
            a.add(new TubeBrand(2));
            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(5));
            //a.add(new TubeBrand(8));
            //a.add(new TubeBrand(8));

            //FlowerBrand f = new FlowerBrand(1);
            //f.Team = 1;
            //a.add(f);

            //WordBrand r = new WordBrand(9);
            ////r.Team = 2;
            //a.add(r);
            //a.add(r);
            //a.add(r);
            ////a.add(r);

            //TubeBrand t = new TubeBrand(9);
            //t.Team = 3;
            //a.add(t);
            //a.add(t);
            //a.add(t);

            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(9));
            //a.add(new TubeBrand(9));
            //WordBrand w = new WordBrand(6);
            //w.Team = 2;
            //a.add(w);
            //a.add(w);
            //a.add(w);
            //a.add(w);

            //Brand b = new TubeBrand(2);
            //CheckUser c = new Check(b,a);
            printplayer(a);
            CheckBrands c = new CheckBrands(new TubeBrand(2), a);
            a.add(new TubeBrand(2));
            CheckBrands d = new CheckBrands(a);
            //if (c.Win())
            //{
            //    Console.WriteLine("有胡!!");
            //    printplayer(c.SuccessPlayer);
            //}
            if (c.Chow())
            {
                Console.WriteLine("===========");
                Console.WriteLine("\n有吃");
                Console.WriteLine(c.ChowLength);
                printplayer(c.SuccessPlayer);
                printplayer(c.ChowPlayer[0]);
                printplayer(c.ChowPlayer[1]);
                printplayer(c.ChowPlayer[2]);
                Console.WriteLine("===========");
            }
            if (c.Pong())
            {
                Console.WriteLine("\n有碰");
                printplayer(c.SuccessPlayer);
            }
            if (c.Kong())
            {
                Console.WriteLine("\n有槓");
                printplayer(c.SuccessPlayer);
            }
            if (d.DarkKong())
            {
                Console.WriteLine("\n有暗槓");
                printplayer(c.SuccessPlayer);
            }

            if (//!c.Win() &&
                !c.Chow() && !c.Pong() && !c.Kong() && !c.DarkKong())
                Console.WriteLine("\n都沒");
            printplayer(a);
        }