コード例 #1
0
ファイル: MenuScreen.cs プロジェクト: cgcoder/balloonbuster
        public MenuScreen(string bgResname)
            : base(bgResname)
        {
            /*
            FrameAnimator a = new FrameAnimator(100, 101);
            AnimationSequence anse = new AnimationSequence("loop", 0, 7);
            anse.Mode = AnimationSequence.AnimationMode.LOOP;
            a.AddAnimation(anse);
            obj.Animator = a;
            */

            menuButtons = new ButtonObj[4];

            menuButtons[0] = new ButtonObj("Play");
            menuButtons[0].SpriteName = "buttonBg";
            menuButtons[0].TouchNotifier = touchEvent;

            menuButtons[1] = new ButtonObj("High Score");
            menuButtons[1].SpriteName = "buttonBg";
            menuButtons[1].TouchNotifier = touchEvent;

            menuButtons[2] = new ButtonObj("About");
            menuButtons[2].SpriteName = "buttonBg";
            menuButtons[2].TouchNotifier = touchEvent;

            menuButtons[3] = new ButtonObj("Exit");
            menuButtons[3].SpriteName = "buttonBg";
            menuButtons[3].TouchNotifier = touchEvent;

            foreach (ButtonObj bo in menuButtons)
            {
                base.addObject(bo);
            }

            currentMenuButton = 0;

            titleObj = new GameObj();
            titleObj.SpriteName = "title";
            base.addObject(titleObj);
        }
コード例 #2
0
ファイル: PlayScreen.cs プロジェクト: cgcoder/balloonbuster
        public PlayScreen(string bgResname)
            : base(bgResname)
        {
            random = new Random(System.DateTime.UtcNow.Millisecond);
            freqDivider = 0;
            scorePos = new Vector2(5, 3);
            MinBalloonSpeed = -1.5f;
            isBannerOn = false;
            Level = 0;
            CreateMode = CreationMode.NORMAL;

            UpdateLevelParameters();
            explosionsRequired = 5;
            gameState = GameState.PLAY;
            lastPauseTouch = 0;

            // pause button
            pauseObj = new GameObj();
            pauseObj.SpriteName = "pause";
            pauseObj.TouchNotifier = PauseTouchEvent;
            this.addScreenObject(pauseObj);

            pauseTextObj = new GameObj();
            pauseTextObj.SpriteName = "pausetext";
            pauseTextObj.TouchNotifier = PauseTextTouchEvent;
            pauseTextObj.Visible = false;
            this.addScreenObject(pauseTextObj);

            quitButton = new ButtonObj("Quit");
            quitButton.SpriteName = "buttonBg";
            quitButton.TouchNotifier = delegate(TouchLocation loc, GameObj go)
            {
                reset();
                game.UnPauseGame();
                game.SetCurrentScreen(1);
            };
            quitButton.Visible = false;
            this.addScreenObject(quitButton);

            gameOverObj = new GameObj();
            gameOverObj.SpriteName = "gameover";
            gameOverObj.TouchNotifier = delegate(TouchLocation loc, GameObj go)
            {
                int screen = 1;
                if (Guide.IsVisible) return;

                if (game.ScoreManager.IsHighScore(Score))
                {
                    startInput();
                    // show input.. get name
                    // save high score..
                    // screen = 3;
                }
                else
                {
                    reset();
                    game.UnPauseGame();
                    game.SetCurrentScreen(screen);
                }
            };
            gameOverObj.Visible = false;
            this.addScreenObject(gameOverObj);
        }