Exemple #1
0
        public Block GetASpecialBlock()
        {
            int    keyOrder = 7;
            int    P_num    = 0;
            string str      = strArr[keyOrder];

            for (int i = 0; i < str.Length; ++i)
            {
                if (str[i] == '1')
                {
                    P_num++;
                }
            }
            Point[] P_Arr = new Point[P_num];
            int     k     = 0;

            for (int i = 0; i < str.Length; ++i)
            {
                if (str[i] == '1')
                {
                    P_Arr[k].X = i / 4;
                    P_Arr[k].Y = i % 4;
                    ++k;
                }
            }

            return(new Block(P_Arr, new SolidColorBrush(InfoXml.GetRandomColor()), disapperColor, keyOrder));
        }
Exemple #2
0
        public Block(Point[] sa, SolidColorBrush bColor, SolidColorBrush dColor, int keyorder)
        {
            BlockColor    = bColor;
            disapperColor = dColor;
            Keyorder      = keyorder;
            structArr     = sa;
            XPos          = 0; YPos = 0;

            int RotateTime = MyRandom.GetRandomNumber(3);

            recArr = new Rectangle[Length];
            if (keyorder != 7)
            {
                for (int i = 0; i < RotateTime; ++i)
                {
                    this.Rotate();                                                // 随机旋转
                }
            }
            for (int i = 0; i < Length; ++i)
            {
                Point p = structArr[i];
                recArr[i] = new Rectangle();
                int x = (int)p.X + XPos, y = (int)p.Y + YPos;
                recArr[i].Fill = InfoXml.GetLinearGradientBrushFromSolidBrush(BlockColor);

                recArr[i].Margin  = new Thickness(1);
                recArr[i].RadiusX = 1; recArr[i].RadiusY = 1;


                recArr[i].SetValue(Grid.RowProperty, x);
                recArr[i].SetValue(Grid.ColumnProperty, y);
            }
        }
Exemple #3
0
 public BlockBuilder(SolidColorBrush Background)
 {
     disapperColor = Background;
     strArr        = InfoXml.GetTypeFromXml();
 }