Exemplo n.º 1
0
        public EndGameView(int _points, Song _song, MatchOption _matchOptions)
        {
            points       = _points;
            song         = _song;
            matchOptions = _matchOptions;


            Elements.Add("title", new ViewElement(20, 4, 10, 1, new List <string>()
            {
                "KONIEC GRY"
            }));
            Elements.Add("playAgain", new ViewElement(20, 10, 15, 1, new List <string>()
            {
                "Zagraj ponownie"
            }));
            Elements.Add("backToMenu", new ViewElement(20, 12, 14, 1, new List <string>()
            {
                "Powrót do menu"
            }));
            Elements.Add("exit", new ViewElement(20, 14, 11, 1, new List <string>()
            {
                "Wyjdź z gry"
            }));

            Elements.Add("points", new ViewElement(20, 20, 6, 2, new List <string>()
            {
                @"WYNIK:",
                @"" + points.ToString()
            }
                                                   ));
            selectedElement = Elements[list[0]];

            init();
        }
Exemplo n.º 2
0
        public MenuView()
        {
            Elements.Add("Logo", new ViewElement((Console.WindowWidth / 2) - (logo[0].Length / 2), 1, logo[0].Length, logo.Count, logo));


            Elements.Add("play", new ViewElement((Console.WindowWidth / 2) - 10, Console.WindowHeight / 2 - 7, 21, 3, new List <string>()
            {
                @"___  _    ____ _   _  ",
                @"|__] |    |__|  \_/   ",
                @"|    |___ |  |   |    "
            }));
            Elements.Add("rank", new ViewElement((Console.WindowWidth / 2) - 10, Console.WindowHeight / 2 - 2, 20, 3, new List <string>()
            {
                @"____ ____ _  _ _  _ ",
                @"|__/ |__| |\ | |_/  ",
                @"|  \ |  | | \| | \_ "
            }));
            Elements.Add("exit", new ViewElement((Console.WindowWidth / 2) - 8, Console.WindowHeight / 2 + 3, 16, 3, new List <string>()
            {
                @"____ _  _ _ ___ ",
                @"|___  \/  |  |  ",
                @"|___ _/\_ |  |  "
            }));
            selectedElement = Elements[list[0]];

            Elements["Logo"].ForegroundColor = ConsoleColor.Red;
        }
Exemplo n.º 3
0
        public NewGameView()
        {
            pressedKey = new ConsoleKeyInfo();
            nick       = "";

            _logo  = new ViewElement((Console.WindowWidth / 2) - (logo[0].Length / 2), 1, logo[0].Length, logo.Count, logo);
            border = new ViewElement(Console.WindowWidth / 2 - 20, Console.WindowHeight / 2 - 2, 40, 5, DrawRect(40, 5));
            header = new ViewElement(Console.WindowWidth / 2 - 5, border.PosY - 2, 11, 1, new List <string>()
            {
                "Podaj nick:"
            });
            nickname = new ViewElement(border.PosX + 2, border.PosY + 2, 36, 1, new List <string>()
            {
                ""
            });

            _logo.ForegroundColor = ConsoleColor.Red;

            Elements.Add("Logo", _logo);
            Elements.Add("Header", header);
            Elements.Add("NicknameBorder", border);
            Elements.Add("Nickname", nickname);

            Elements.Add("alert", new ViewElement(Console.WindowWidth / 2 - 18, Console.WindowHeight / 2 + 6, 19, 1, new List <string>()
            {
                "Nieprawidłowa nazwa"
            }));
        }
Exemplo n.º 4
0
 public void MoveSelectedDown()
 {
     StopAnimation();
     selectedElement.Update();
     selectedElement = Elements[list[++counter % list.Length]];
     AnimateMenuItem();
 }
Exemplo n.º 5
0
        public void AnimateMenuItem()
        {
            animatedElem = selectedElement;

            animationTimer          = new System.Timers.Timer(75);
            animationTimer.Elapsed += Animate;

            animationTimer.Start();
        }
Exemplo n.º 6
0
        internal void MoveSelectedUp()
        {
            selectedElement.Update();

            counter += list.Length - 1;
            int index = counter % list.Length;

            selectedElement = Elements[list[index]];
            selectedElement.UpdateReverseColours();
        }
Exemplo n.º 7
0
        internal void MoveSelectedUp()
        {
            StopAnimation();
            selectedElement.Update();

            counter += list.Length - 1;
            int index = counter % list.Length;

            selectedElement = Elements[list[index]];
            AnimateMenuItem();
        }
Exemplo n.º 8
0
 public void SetTick()
 {
     Elements["tick"] = new ViewElement(x, y, 1, 4, new List <string>()
     {
         @" ",
         @"\",
         @"/",
         @" "
     });
     Elements["tick"].Update();
 }
Exemplo n.º 9
0
 private void ReleasePos(ViewElement element)
 {
     if (element.PosX + element.Width <= Console.WindowWidth && element.PosY + element.Height <= Console.WindowHeight)
     {
         for (int i = 0; i < element.Height; i++)
         {
             for (int j = 0; j < element.Width; j++)
             {
                 vacancy[element.PosY + i, element.PosX + j] = true;
             }
         }
     }
 }
Exemplo n.º 10
0
        public GameView()
        {
            characterIndex = 0;
            charactersNo   = 3;

            characters = new ViewElement[charactersNo];
            counters   = new ViewElement[charactersNo];
            vacancy    = new bool[Console.WindowHeight, Console.WindowWidth];

            timer = new ViewElement(Console.WindowWidth - 8, 1, 5, 3,
                                    new List <string>()
            {
                "TIMER",
                "",
                "00:00"
            });
            progressBar = new ViewElement(3, 1, 27, 5, new List <string>()
            {
                ""
            });
            points = new ViewElement((Console.WindowWidth - 2) / 2, 1, 5, 1, new List <string>()
            {
                "0"
            });


            Elements.Add("ProgressBar", progressBar);
            Elements.Add("Points", points);
            Elements.Add("Timer", timer);

            progressBar.ForegroundColor = ConsoleColor.Green;
            DisplayProgressBar(100);



            InitCharacters();
        }
Exemplo n.º 11
0
        private void InitCharacters()
        {
            for (int i = 0; i < charactersNo; i++)
            {
                characters[i] = new ViewElement(-1, -1, 8, 6, new List <string>()
                {
                    ""
                });
                counters[i] = new ViewElement(-1, -1, 8, 5, new List <string>()
                {
                    ""
                });
                Elements.Add("Character" + i, characters[i]);
                Elements.Add("Counter" + i, counters[i]);
            }

            for (int i = 3; i < Console.WindowHeight; i++)
            {
                for (int j = 5; j < Console.WindowWidth - 5; j++)
                {
                    vacancy[i, j] = true;
                }
            }
        }
Exemplo n.º 12
0
 public virtual void AddElement(string name, ViewElement element)
 {
     Elements.Add(name, element);
 }
Exemplo n.º 13
0
 public void MoveSelectedDown()
 {
     selectedElement.Update();
     selectedElement = Elements[list[++counter % list.Length]];
     selectedElement.UpdateReverseColours();
 }