Example #1
0
        public void Draw(SpriteBatch spriteBatch, LoadButton loadButton, SaveButton saveButton)
        {
            if (AngryBallsEnvironment.gameState == AngryBallsEnvironment.GameState.dialog)
            {
                background.Draw(spriteBatch);

                if (loadButton.isClicked(Mouse.GetState()))
                {
                    labelStr = "Load Which Level?";
                }
                else if (saveButton.isClicked(Mouse.GetState()))
                {
                    labelStr = "New Level Name:";
                }

                if(!string.IsNullOrEmpty(labelStr))
                {
                    label.DrawStr(spriteBatch, labelStr, new Vector2(200, 375));
                }

                if (!string.IsNullOrEmpty(inputStr))
                {
                    input.DrawStr(spriteBatch, inputStr, new Vector2(300, 450));
                }
                okButton.Draw(spriteBatch);
                cancelButton.Draw(spriteBatch);
            }
            else
            {
                AngryBallsEnvironment.GetMap().Initialize(AngryBallsEnvironment.GameState.pause, inputStr);
            }
        }
Example #2
0
 public Dialog(LoadButton loadButton, SaveButton saveButton)
 {
     label = new GUIElement(new Vector2(300, 300), new Vector2(100, 100));
     input = new GUIElement(new Vector2(300, 500), new Vector2(100, 100));
     background = new GUIElement(Game1.dialogBkgImage, new Vector2(500, 500), new Vector2(800, 300));
     okButton = new GUIElement(Game1.okImage, new Vector2(450, 600), new Vector2(100, 100));
     cancelButton = new GUIElement(Game1.cancelImage, new Vector2(600, 600), new Vector2(100, 100));
     this.loadButton = loadButton;
     this.saveButton = saveButton;
 }
Example #3
0
        //Environment Constructor
        public AngryBallsEnvironment()
        {
            //Instantiate the Buttons
            gameState = GameState.initialize;
            playPauseButton = new PlayPauseButton(gameState);
            resetButton = new ResetButton(gameState);
            builderButton = new BuilderButton(gameState);
            saveButton = new SaveButton(gameState);
            loadButton = new LoadButton(gameState);

            // Instantiate Dialog Box
            dialog = new Dialog(loadButton, saveButton);

            //Instantiate Start Positions for environment items
            clawopenPosition = clawStartPosition;
            ballStartPose = new Vector2(clawStartPosition.X + 47, clawStartPosition.Y + 150);

            //Instantiate local images
            background = Game1.environmentBackground;
            border = Game1.borderImage;
            bigCogImage = Game1.bigCog;
            bigCogOrigin = new Vector2(bigCogImage.Width / 2, bigCogImage.Height / 2);
            springImage = Game1.springImage;
            chickenImage = Game1.chickenImage;
            clawOpen = Game1.clawOpen;

            //Instantiate environment containers
            Input = new InputManager();
            map = new Map();
            toolBox = new ToolBox();
        }
Example #4
0
 public void Interact(MouseState mouseState, SaveButton saveButton, LoadButton loadButton, SpriteBatch spriteBatch)
 {
     if (okButton.isClicked(mouseState))
     {
         if (labelStr == "Load Which Level?")
         {
             loadButton.LoadLevel(AngryBallsEnvironment.GetMap(), inputStr, AngryBallsEnvironment.gameState);
             AngryBallsEnvironment.gameState = AngryBallsEnvironment.GameState.levelBuilder;
         }
         if (labelStr == "New Level Name:")
         {
             saveButton.WriteLevel(AngryBallsEnvironment.GetMap(), inputStr, AngryBallsEnvironment.gameState);
             AngryBallsEnvironment.gameState = AngryBallsEnvironment.GameState.levelBuilder;
         }
     }
     else if (cancelButton.isClicked(mouseState))
     {
         AngryBallsEnvironment.gameState = AngryBallsEnvironment.GameState.levelBuilder;
     }
 }