Example #1
0
        /// <summary>重置棋盘</summary>
        public void ResetGrid()
        {
            int[] card1 = { 1, 2, 3, 4, 5, 6, 7, 8, -1, -2, -3, -4, -5, -6, -7, -8 };//正:蓝,负:红
            card = card1;
            List <int> list = new List <int>();

            //Step 1.加入字串Apple、Banana、Blueberry、Cherry、Grape
            foreach (var i in card)
            {
                list.Add(i);
            }

            //Step 2.打亂順序
            MyCollections.shuffle(ref list);

            for (int i = 0; i < 16; i++)
            {
                card[i] = list[i];
            }
            //放入数组
            int tmp = 0;

            for (int i = 0; i < max; i++)
            {
                for (int j = 0; j < max; j++)
                {
                    grid[i, j]      = card[tmp];
                    grid_flag[i, j] = -1;
                    card[tmp]       = card[tmp];
                    tmp++;
                }
            }
        }
Example #2
0
        /// <summary>重置棋盘</summary>
        public void ResetGrid()
        {
            List <int> list = new List <int>();

            //Step 1.加入字串Apple、Banana、Blueberry、Cherry、Grape
            foreach (var i in card)
            {
                list.Add(i);
            }

            //Step 2.打亂順序
            MyCollections.shuffle(ref list);


            //放入数组
            int tmp = 0;

            for (int i = 0; i < max; i++)
            {
                for (int j = 0; j < max; j++)
                {
                    grid[i, j]      = list[tmp];
                    grid_flag[i, j] = -1;
                    tmp++;
                }
            }
        }