Пример #1
0
 public static void SensibilizeCell(int x, int y, int Height, int Width)
 {
     if (!Shadow)
     {
         return;
     }
     DeSensibilizeCell();
     ushort[,] SensColor    = new ushort[1, 1];
     SensColor[0, 0]        = (ushort)ConsoleColor.Gray;
     ushort[,] TempBuffer   = new ushort[1, 1];
     LastSensibilizedNumber = Width;
     for (int i = 0; i < Width; i++)
     {
         for (int j = Height + y; j < 25; j++)
         {
             if (Matriz[x + i, j])
             {
                 TempBuffer = ConsoleFunctions.ReadConsoleAttribute(x + i, j, 1, 1);
                 LastSensibilizedColors[0, i] = TempBuffer[0, 0];
                 ConsoleFunctions.WriteConsoleAttribute(x + i, j, SensColor);
                 LastSensibilizedPosition[i].X = x + i;
                 LastSensibilizedPosition[i].Y = j;
                 break;
             }
         }
     }
 }
Пример #2
0
 private static void DeSensibilizeCell()
 {
     ushort[,] SensColor = new ushort[1, 1];
     for (int i = 0; i < LastSensibilizedNumber; i++)
     {
         SensColor[0, 0] = LastSensibilizedColors[0, i];
         ConsoleFunctions.WriteConsoleAttribute(LastSensibilizedPosition[i].X,
                                                LastSensibilizedPosition[i].Y,
                                                SensColor);
     }
 }
Пример #3
0
 private static void FlashScreen()
 {
     if (!Flash)
     {
         return;
     }
     ushort[,] FlashingColors = new ushort[Console.BufferHeight, Console.BufferWidth];
     for (int i = 0; i < FlashingColors.GetLength(0); i++)
     {
         for (int j = 0; j < FlashingColors.GetLength(1); j++)
         {
             FlashingColors[i, j] = 123;
         }
     }
     ushort[,] SaveAttributes = ConsoleFunctions.ReadConsoleAttribute(0, 0, Console.BufferWidth, Console.BufferHeight);
     for (int Times = 0; Times < 4; Times++)
     {
         ConsoleFunctions.WriteConsoleAttribute(0, 0, FlashingColors);
         Thread.Sleep(45);
         ConsoleFunctions.WriteConsoleAttribute(0, 0, SaveAttributes);
         Thread.Sleep(45);
     }
 }
Пример #4
0
        public static void Options()
        {
            SetWindowWidth((int)WindowSize.Options.Width);
            afliw.Clear(0, Console.BufferHeight - 1, 31, Console.BufferWidth - 1);
            Box OptionsBox = new Box(31, 0, Console.BufferWidth - 34, Console.BufferHeight - 3);

            OptionsBox.Draw(0, "Magenta");
            string[] Opciones = { "Shadow", "Sounds", "Sound Volume", "Tetris' Flash", "Music", "Music Volume", "Back" };

            for (int i = 0; i < 7; i++)
            {
                Console.SetCursorPosition(35, 2 + (i * 3));
                Console.Write(Opciones[i]);
            }

            for (int i = 0; i < 6; i++)
            {
                OptSwitch(i, 0);
            }

            ushort[,] Normal = new ushort[1, Opciones[3].Length];
            for (int i = 0; i < Normal.GetLength(1); i++)
            {
                Normal[0, i] = 7;
            }
            int  Selected = 0;
            bool Back     = false;
            int  SaveBGM  = Sonidos.CurrentBGM;

            do
            {
                ushort[,] Highlight = new ushort[1, Opciones[Selected].Length];

                for (int i = 0; i < Highlight.GetLength(1); i++)
                {
                    Highlight[0, i] = 128;
                }
                for (int i = 0; i < Opciones.Length; i++)
                {
                    ConsoleFunctions.WriteConsoleAttribute(35, 2 + (i * 3), Normal);
                    if (i == Selected)
                    {
                        ConsoleFunctions.WriteConsoleAttribute(35, 2 + (i * 3), Highlight);
                    }
                }

                switch (Console.ReadKey(true).Key)
                {
                case ConsoleKey.UpArrow: if (Selected == 0)
                    {
                        Selected = 6;
                    }
                    else
                    {
                        Selected--;
                    } break;

                case ConsoleKey.DownArrow: if (Selected == 6)
                    {
                        Selected = 0;
                    }
                    else
                    {
                        Selected++;
                    } break;

                case ConsoleKey.RightArrow: OptSwitch(Selected, 1); break;

                case ConsoleKey.LeftArrow: OptSwitch(Selected, -1); break;

                case ConsoleKey.Enter: if (Selected == 6)
                    {
                        Back = true;
                    }
                    break;
                }
            }while(!Back);
            if (SaveBGM != Sonidos.CurrentBGM)
            {
                Sonidos.StopBGM();
                Sonidos.ChangeBGM();
            }
            SetWindowWidth((int)WindowSize.Regular.Width);
        }