コード例 #1
0
 public static void resetColors()
 {
     OBlock.resetColor();
     IBlock.resetColor();
     TBlock.resetColor();
     JBlock.resetColor();
     LBlock.resetColor();
     SBlock.resetColor();
     ZBlock.resetColor();
 }
コード例 #2
0
        private void DiscardColors(OptionArgs args)
        {
            OBlock.resetColor();
            IBlock.resetColor();
            TBlock.resetColor();
            JBlock.resetColor();
            LBlock.resetColor();
            SBlock.resetColor();
            ZBlock.resetColor();

            ColorData.saveColors();
        }
コード例 #3
0
        private void Reset(OptionArgs args)
        {
            BlockType.textureAsset = "Game/Bricks/Cat-Eye Brick";

            OBlock.resetColor();
            IBlock.resetColor();
            TBlock.resetColor();
            JBlock.resetColor();
            LBlock.resetColor();
            SBlock.resetColor();
            ZBlock.resetColor();

            ColorData.saveColors();
        }
コード例 #4
0
        BlockType randomize()
        {
            BlockType randomBlock;

            switch (random.Next(1, 8))
            {
            case 1:
                randomBlock = new OBlock();
                break;

            case 2:
                randomBlock = new IBlock();
                break;

            case 3:
                randomBlock = new TBlock();
                break;

            case 4:
                randomBlock = new LBlock();
                break;

            case 5:
                randomBlock = new JBlock();
                break;

            case 6:
                randomBlock = new SBlock();
                break;

            case 7:
                randomBlock = new ZBlock();
                break;

            default:
                randomBlock = new LBlock();
                break;
            }

            randomBlock.load(Game.Content);

            return(randomBlock);
        }
コード例 #5
0
ファイル: MonoTetris.cs プロジェクト: gajelle16/MonoGame
        /// <summary>
        /// Generates a random block
        /// </summary>
        /// <param name="block">A reference to the Block object that will be affected</param>
        private void GenerateBlock(ref Block block)
        {
            switch (random.Next(0, 7))
            {
            case 0:
                block = new IBlock();
                break;

            case 1:
                block = new LBlock();
                break;

            case 2:
                block = new RLBlock();
                break;

            case 3:
                block = new SBlock();
                break;

            case 4:
                block = new SquareBlock();
                break;

            case 5:
                block = new TBlock();
                break;

            case 6:
                block = new ZBlock();
                break;

            default:
                throw new ArgumentException("Bad block type!");
            }
        }
コード例 #6
0
        private void rearrangeData()
        {
            if (billgrid.Rows.Count <= 1)
            {
                return;
            }

            List <LBlock> lBlock = new List <LBlock>();

            for (int i = 0; i < billgrid.Rows.Count; i++)
            {
                //Check if id exists or not
                if (billgrid[6, i].Value != null && !billgrid[2, i].Value.ToString().Equals(""))
                {
                    //2 => index start point of data
                    LBlock temp = new LBlock();
                    temp.BLists.Add(billgrid[2, i].Value.ToString().Trim());
                    temp.BLists.Add(billgrid[3, i].Value.ToString().Trim());
                    temp.BLists.Add(billgrid[4, i].Value.ToString().Trim());
                    temp.BLists.Add(billgrid[5, i].Value.ToString().Trim());
                    temp.BLists.Add(billgrid[6, i].Value.ToString().Trim());
                    lBlock.Add(temp);
                    displayLists(temp.BLists);
                }
            }
            List <int> passed = new List <int>();

            for (int i = 0; i < lBlock.Count; i++)
            {
                String ID = lBlock[i].BLists[4].ToString();
                for (int j = 0; j < lBlock.Count; j++)
                {
                    if (j != i)
                    {
                        if (!isDataExists(i.ToString(), passed)) //check rows exists or not
                        {
                            if (lBlock[j].BLists[4].ToString().Equals(ID))
                            {
                                passed.Add(i);
                                if (lBlock[i].BLists[1] != null && !lBlock[i].BLists[1].Equals("") && lBlock[j].BLists[1] != null && !lBlock[j].BLists[1].Equals(""))
                                {
                                    lBlock[i].BLists[1] = (Decimal.Parse(lBlock[i].BLists[1]) + Decimal.Parse(lBlock[j].BLists[1])).ToString();
                                    lBlock[i].BLists[3] = (Decimal.Parse(lBlock[i].BLists[1]) * Decimal.Parse(lBlock[j].BLists[2])).ToString();
                                    lBlock[j].BLists[0] = "";
                                    lBlock[j].BLists[1] = "";
                                    lBlock[j].BLists[2] = "";
                                    lBlock[j].BLists[3] = "";
                                    lBlock[j].BLists[4] = "";
                                }
                            }
                        }
                    }
                }
            }
            //----------------Now rearrange the whole lists---------------------->
            int counter = 0;
            int tLists  = billgrid.Rows.Count;

            billgrid.Rows.Clear();
            for (int i = 0; i < lBlock.Count; i++)
            {
                Console.WriteLine("-->" + i);
                if (!lBlock[i].BLists[4].Equals(""))
                {
                    counter++;
                    billgrid.Rows.Add(Sales_Management.Properties.Resources.delete, (i + 1), lBlock[i].BLists[0], lBlock[i].BLists[1], lBlock[i].BLists[2], lBlock[i].BLists[3], lBlock[i].BLists[4]);
                }
            }
            for (int i = 0; i < tLists - counter; i++)
            {
                billgrid.Rows.Add(Sales_Management.Properties.Resources.delete, (i + 1), "", "1", "", "");
            }
        }