예제 #1
0
파일: Menu.cs 프로젝트: kubek96/PI
        /// <summary>
        /// Konstruktor menu głównego.
        /// </summary>
        public Menu()
        {
            // Tło
            _background = new FixedGraphic();
            // Animowane tło
            _grass = new ParallaxingGraphic[3];
            for (int i = 0; i < _grass.Length; i++)
            {
                _grass[i] = new ParallaxingGraphic();
            }
            _sky          = new FixedGraphic();
            _cloud        = new ParallaxingGraphic();
            _groundBuffer = new FixedGraphic();

            // Menu
            _menuFrame = new FixedGraphic();
            _menu      = new Button[5];
            _menu[0]   = new Button(typeof(NewGame));
            _menu[1]   = new Button(typeof(LoadStage));
            _menu[2]   = new Button(typeof(BestScores));
            _menu[3]   = new Button(typeof(Help));
            _menu[4]   = new Button(typeof(Exit));

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();

            MediaPlayer.Stop();
        }
예제 #2
0
파일: Options.cs 프로젝트: kubek96/PI
        /// <summary>
        /// Konstruktor opcji.
        /// Domyślnie widok ten jest niewidoczny.
        /// </summary>
        public Options()
        {
            // Tło
            _background = new FixedGraphic();

            // Nagłówek
            _logo   = new FixedGraphic();
            _header = new Label("Options");

            // Część główna okna
            _keyboardLabel     = new Label("Control type:");
            _keyboardLayout    = new Button[2];
            _keyboardLayout[0] = new Button(null);
            _keyboardLayout[1] = new Button(null);

            _musicLabel    = new Label("Music is:");
            _musicOnOff    = new Button[2];
            _musicOnOff[0] = new Button(null);
            _musicOnOff[1] = new Button(null);

            // Nawigacja
            _goBack = new Button(null);
            _exit   = new Button(typeof(Exit));

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();
        }
예제 #3
0
파일: Win.cs 프로젝트: kubek96/PI
        /// <summary>
        /// Konstruktor.
        /// Jako paramter przyjmuje numer levelu, do którego ma prowadzić przycisk do następnego levelu.
        /// Jeżeli numer przekracza przyjęty limit wyświetlony zostje komunikat o przejściu gry.
        /// </summary>
        /// <param name="nextLevel">Numer następnego levelu.</param>
        public Win(int nextLevel)
        {
            _nextLevel = nextLevel;
            _isVisible = false;

            // Tło
            _background = new FixedGraphic();

            // Nagłówek
            _logo = new FixedGraphic();

            // Centurm
            if (_nextLevel != 7)
            {
                _infoLabel     = new Label("Congratulations!");
                _goToNextLevel = new Button(typeof(Stage), nextLevel);
            }
            else
            {
                _infoLabel = new Label("You finish the game!");
            }
            _goToMainMenuButton = new Button(typeof(Menu));

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();
        }
예제 #4
0
        /// <summary>
        /// Kontruktor widoku pausy.
        /// Widok ustawiony jest jako niewidoczny.
        /// </summary>
        public Pause()
        {
            // Tło
            _background = new FixedGraphic();

            // Nagłówek
            _logo   = new FixedGraphic();
            _header = new Label("Pause");

            // Część główna okna
            _menu    = new Button[3];
            _menu[0] = new Button(typeof(Menu));
            _menu[1] = new Button(null);
            _menu[2] = new Button(null);

            // Nawigacja
            _continue = new Button(null);
            _exit     = new Button(typeof(Exit));

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();

            // Czas
            _elapsedGoBackTime = 0;
        }
예제 #5
0
파일: Fruit.cs 프로젝트: kubek96/PI
        /// <summary>
        /// Konstruktor kopiujący
        /// </summary>
        /// <param name="fruit">Obiekt wzorcowy.</param>
        public Fruit(Fruit fruit)
        {
            _fruitType    = fruit._fruitType;
            _fruitGraphic = fruit._fruitGraphic.Clone();
            _rectangle    = fruit._rectangle;
            _playerUse    = fruit.PlayerUse;
            _enemyUse     = fruit.EnemyUse;

            _isUsed = false;
        }
예제 #6
0
파일: Fruit.cs 프로젝트: kubek96/PI
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="fruitType">Typ owocu.</param>
        /// <param name="assetName">Ścieżka do zasobu grafiki.</param>
        /// <param name="playerUse">Funkcja zjedzenia owocu przez gracza.</param>
        /// <param name="enemyUse">Funkcja zjedzenia owocu przez wroga.</param>
        public Fruit(FruitType fruitType, string assetName, PlayerUseDelegate playerUse, EnemyUseDelegate enemyUse)
        {
            _fruitType = fruitType;
            _playerUse = playerUse;
            _enemyUse  = enemyUse;

            _fruitGraphic = new FixedGraphic();

            LoadContent(Window.Context.Content, assetName);

            _isUsed = false;
        }
예제 #7
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        public Exit()
        {
            // Tło
            _background = new FixedGraphic();

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();

            Logger.Report("rozpoczęto procedurę wyłączania gry.");
        }
예제 #8
0
파일: NewGame.cs 프로젝트: kubek96/PI
        /// <summary>
        /// Konstrukotr widoku okna nowej gry.
        /// </summary>
        public NewGame()
        {
            // Tło
            _background = new FixedGraphic();
            _menuFrame  = new FixedGraphic();

            // Menu
            _menu    = new Button[3];
            _menu[0] = new Button(typeof(Stage));
            _menu[1] = new Button(typeof(Menu));
            _menu[2] = new Button(typeof(Exit));

            // UserName input
            _userName = new Input();

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();
        }
예제 #9
0
        /// <summary>
        /// Konstruktor widoku przegranej.
        /// Widok ten wyświetlany jest w momencie zabicia robaczka.
        /// Domyślnie jest niewidoczny.
        /// </summary>
        /// <param name="currentLevel">Numer bieżącego levelu.</param>
        public Lose(int currentLevel)
        {
            _currentLevel = currentLevel;
            _isVisible    = false;

            // Tło
            _background = new FixedGraphic();

            // Nagłówek
            _logo = new FixedGraphic();

            // Centurm
            _infoLabel          = new Label("You lose! Sorry!");
            _tryAgain           = new Button(typeof(Stage), _currentLevel);
            _goToMainMenuButton = new Button(typeof(Menu));

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();
        }
예제 #10
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        public Help()
        {
            // Tło
            _background = new FixedGraphic();

            // Nagłówek
            _logo   = new FixedGraphic();
            _header = new Label("Help");

            // Częśc główna okna
            _instruction = new FixedGraphic();

            // Nawigacja
            _previousPage = new Button(typeof(Menu));
            _exit         = new Button(typeof(Exit));

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();
        }
예제 #11
0
        /// <summary>
        /// Konstruktor.
        /// Wczytuje listę 16 najlepszych graczy oraz sortuje ich od najlepszego wyniku w dół.
        /// </summary>
        public BestScores()
        {
            // Tło
            _background = new FixedGraphic();

            // Nagłówek
            _logo   = new FixedGraphic();
            _header = new Label("Best scores:");

            // Część główna okna
            if (Window.Context.Players.Count == 0)
            {
                _players       = new Label[1, 1];
                _players[0, 0] = new Label("There are no players yet.");
            }
            else
            {
                List <Player> p = Window.Context.Players.ToList();
                p.Sort((p1, p2) => p2.Points.CompareTo(p1.Points));

                int howMany = p.Count < 16 ? p.Count : 16;
                _players = new Label[howMany, 2];
                for (int i = 0; i < howMany; i++)
                {
                    _players[i, 0] = new Label(p[i].Name);
                    _players[i, 1] = new Label(p[i].Points.ToString());
                }
            }

            // Nawigacja
            _previousPage = new Button(typeof(Menu));
            _exit         = new Button(typeof(Exit));

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();
        }
예제 #12
0
        /// <summary>
        /// Konstruktor widoku wczytywania istniejących rozgrywek.
        /// Wczytuje je od najstarszej (pierwszej utwożonej) do najnoweszej.
        /// </summary>
        public LoadStage()
        {
            // Tło
            _background = new FixedGraphic();

            // Nagłówek
            _logo   = new FixedGraphic();
            _header = new Label("Choose player name to play:");

            // Część główna okna
            if (Window.Context.Players.Count == 0)
            {
                _noPlayers = new Label("There are no players yet.");
            }
            else
            {
                int howMany = Window.Context.Players.Count < 16 ? Window.Context.Players.Count : 16;
                _players = new Button[howMany];
                for (int i = 0; i < howMany; i++)
                {
                    if (Window.Context.Players[i].Level > _maxLevel)
                    {
                        Window.Context.Players[i].Level = _maxLevel;
                    }
                    _players[i] = new Button(typeof(Stage), Window.Context.Players[i].Level, Window.Context.Players[i].Name);
                }
            }

            // Nawigacja
            _previousPage = new Button(typeof(Menu));
            _exit         = new Button(typeof(Exit));

            // Wczytaj zawartość
            LoadContent(Window.Context.Content);

            // Zainicjalizuj
            Initialize();
        }
예제 #13
0
 /// <summary>
 /// Konstruktor. Inicjalizuje obiekty grafiki ziemi.
 /// </summary>
 public Ground()
 {
     _groundGraphic     = new FixedGraphic();
     _freeGroundGraphic = new FixedGraphic();
 }