コード例 #1
0
ファイル: Piece.cs プロジェクト: winterdl/mixup
    Block AddBC(Block b1, Block b2)
    {
        BColor bc1 = b1.bColor;
        BColor bc2 = b2.bColor;
        Block  res = b1;

        if (bc1 == bc2)
        {
            b1.times++;
            return(b1);
        }

        int   big;
        int   small;
        Block block_big;

        if ((int)bc1 > (int)bc2)
        {
            big       = (int)bc1;
            small     = (int)bc2;
            block_big = b1;
        }
        else
        {
            big       = (int)bc2;
            small     = (int)bc1;
            block_big = b2;
        }

        if (big > 4 && small <= 4)
        {
            res.bColor = BColor.Black;
            if (big == 5 && (small == 2 || small == 3))
            {
                res.times++; res.bColor = (BColor)big;
            }
            if (big == 6 && (small == 2 || small == 4))
            {
                res.times++; res.bColor = (BColor)big;
            }
            if (big == 7 && (small == 4 || small == 3))
            {
                res.times++; res.bColor = (BColor)big;
            }
        }
        else
        {
            int sum = big + small;
            if (sum > 7)
            {
                sum = 8;//black
            }
            res.times  = 1;
            res.bColor = (BColor)sum;
        }

        return(res);
    }
コード例 #2
0
 public void ChangeBrush(BColor color)
 {
     switch(color)
     {
         case BColor.Red:
             testWindow.Background = redBrush;
             break;
         case BColor.Black:
                testWindow.Background = blackBrush;
             break;
         case BColor.White:
             testWindow.Background = whiteBrush;
             break;
         default:
                testWindow.Background = blackBrush;
             break;
     }
 }
コード例 #3
0
        public void ChangeBrush(BColor color)
        {
            switch (color)
            {
            case BColor.Red:
                testWindow.Background = redBrush;
                break;

            case BColor.Black:
                testWindow.Background = blackBrush;
                break;

            case BColor.White:
                testWindow.Background = whiteBrush;
                break;

            default:
                testWindow.Background = blackBrush;
                break;
            }
        }
コード例 #4
0
ファイル: Overall.cs プロジェクト: winterdl/mixup
    void CheckLineY(int y)
    {
        BColor curbc  = BColor.NONE;
        int    series = 0;

        for (int x = main_piece.min.x; x <= main_piece.max.x; x++)
        {
            Vector2Int vp = new Vector2Int(x, y);
            if (main_piece.hasPiece(vp) == false)
            {
                //now we check if we got a seies
                if (curbc != BColor.NONE && series >= 3)
                {
                    if (curbc != BColor.Black)
                    {
                        //mark those blocks
                        for (int k = 0; k < series; k++)
                        {
                            RegForMatch(new Vector2Int(x - k - 1, y));
                        }
                    }
                }

                curbc  = BColor.NONE;
                series = 0;
                continue;
            }

            if (main_piece.blocks[vp].bColor == curbc)
            {
                series++;
            }
            else
            {
                //now we check if we got a seies
                if (curbc != BColor.NONE && series >= 3)
                {
                    if (curbc != BColor.Black)
                    {
                        //mark those blocks
                        for (int k = 0; k < series; k++)
                        {
                            RegForMatch(new Vector2Int(x - k - 1, y));
                        }
                    }
                }

                curbc  = main_piece.blocks[vp].bColor;
                series = 1;
            }
        }

        //now we check if we got a seies
        if (curbc != BColor.NONE && series >= 3)
        {
            if (curbc != BColor.Black)
            {
                //mark those blocks
                for (int k = 0; k < series; k++)
                {
                    RegForMatch(new Vector2Int(main_piece.max.x - k, y));
                }
            }
        }
    }
コード例 #5
0
ファイル: Piece.cs プロジェクト: winterdl/mixup
 public Block(BColor bc_)
 {
     bColor = bc_;
     times  = 1;
 }