コード例 #1
0
        /// <summary>
        /// Set up the initial state of the scene
        /// </summary>
        public override void SetupScene()
        {
            // design the scene manually
            GenericItem title = new GenericItem("Title");

            title.Location = new System.Numerics.Vector2(500, 100);
            title.SetBitmapFromImageDictionary("GameOver");
            this.AddObject(title);
            CenterObject(title, true, false);


            _start_button = new EvilutionButton("Main Menu", Colors.White, 350, 50);
            CenterObject(_start_button);
            this.AddObject(_start_button);

            if (StoryBoard.SceneHistory.Count > 0)
            {
                Score = StoryBoard.SceneHistory.Peek().Score;
            }

            _score_label          = new EvilutionLabel("SCORE: " + Score, Colors.White, (uint)(this._width * 0.90f), 100);
            _score_label.Y        = _start_button.Y - 200;
            _score_label.FontSize = 50;
            CenterObject(_score_label, true, false);
            this.AddObject(_score_label);



            // event callbacks
            _start_button.ButtonClick += _start_button_ButtonClick;

            void _start_button_ButtonClick(object sender, EvilutionButton_Event e)
            {
                // create the scene switch message to switch the current scene to the main game scene
                Message_SceneSwitch mss = new Message_SceneSwitch("Generic Title Scene");

                MessageManager.AddMessageItem(mss);
            }
        }
コード例 #2
0
ファイル: TitleScene.cs プロジェクト: terrybuck/Evilution
        /// <summary>
        /// Setup the initial state of the scene
        /// </summary>
        public override void SetupScene()
        {
            // design the scene manually
            //Title scene is the only sene that starts playing audio by default
            if (AudioManager.AudioDictionary.TryGetValue("Generic Title Scene", out mp))
            {
                mp.Play();
            }

            //Evilution Title
            GenericItem title = new GenericItem("Title");

            title.Location = new System.Numerics.Vector2(500, 200);
            title.SetBitmapFromImageDictionary("Title");
            this.AddObject(title);
            CenterObject(title, true, false);

            //Buttons
            _start_button     = new EvilutionButton("New Game", Colors.White, 350, 50);
            _top_score_button = new EvilutionButton("Top Scores", Colors.White, 350, 50);
            _credits_button   = new EvilutionButton("Credits", Colors.DarkGray, 350, 50);

            //Center Buttons
            CenterObject(_start_button);
            _top_score_button.Location = new Vector2(_start_button.Location.X, _start_button.Location.Y + _start_button.Size.Height + 10);
            _credits_button.Location   = new Vector2(_top_score_button.Location.X, _top_score_button.Location.Y + _top_score_button.Size.Height + 10);

            this.AddObject(_start_button);
            this.AddObject(_top_score_button);
            this.AddObject(_credits_button);


            // event callbacks
            _start_button.ButtonClick     += _start_button_ButtonClick;
            _top_score_button.ButtonClick += _top_score_button_ButtonClick;
            _credits_button.ButtonClick   += _credits_button_ButtonClick;

            void _credits_button_ButtonClick(object sender, EvilutionButton_Event e)
            {
                // create the scene switch message to switch the current scene to the credits scene
                Message_SceneSwitch mss = new Message_SceneSwitch("Credits Scene");

                MessageManager.AddMessageItem(mss);
            }

            void _top_score_button_ButtonClick(object sender, EvilutionButton_Event e)
            {
                // create the scene switch message to switch the current scene to the top score scene
                Message_SceneSwitch mss = new Message_SceneSwitch("Top Score Scene");

                MessageManager.AddMessageItem(mss);
            }

            void _start_button_ButtonClick(object sender, EvilutionButton_Event e)
            {
                // create the scene switch message to switch the current scene to the main game scene
                Message_SceneSwitch mss = new Message_SceneSwitch("Main Game Scene");

                MessageManager.AddMessageItem(mss);
            }
        }