public MainMenu() { this.buttons = new ColouredButton[5]; const float textXDiff = 50f; int startX = 1000; ColouredButtonParams buttonParams = new ColouredButtonParams(); buttonParams.Font = ResourceManager.getInstance().Font; buttonParams.LinesTexture = ResourceManager.getInstance().ButtonsLineTexture; buttonParams.Height = ResourceManager.BUTTONS_HEIGHT; buttonParams.Width = ResourceManager.BUTTONS_WIDTH; buttonParams.MouseOverColour = ResourceManager.getInstance().ButtonsMouseOverColour; buttonParams.RegularColour = ResourceManager.getInstance().TextColour; buttonParams.ID = BUTTON_ID_EASY; buttonParams.StartX = startX; buttonParams.StartY = 415; buttonParams.Text = "Easy"; buttonParams.TextsPosition = new Vector2(startX + textXDiff, buttonParams.StartY + ResourceManager.BUTTONS_TEXT_Y_DIFFERENCE); this.buttons[0] = new ColouredButton(buttonParams); buttonParams.ID = BUTTON_ID_MODERATE; buttonParams.StartX = startX; buttonParams.StartY = 475; buttonParams.Text = "Moderate"; buttonParams.TextsPosition = new Vector2(startX + (textXDiff - 15f), buttonParams.StartY + ResourceManager.BUTTONS_TEXT_Y_DIFFERENCE); this.buttons[1] = new ColouredButton(buttonParams); buttonParams.ID = BUTTON_ID_HARD; buttonParams.StartX = startX; buttonParams.StartY = 535; buttonParams.Text = "Hard"; buttonParams.TextsPosition = new Vector2(startX + textXDiff, buttonParams.StartY + ResourceManager.BUTTONS_TEXT_Y_DIFFERENCE); this.buttons[2] = new ColouredButton(buttonParams); buttonParams.ID = BUTTON_ID_IMPOSSIBLE; buttonParams.StartX = startX; buttonParams.StartY = 595; buttonParams.Text = "Impossible"; buttonParams.TextsPosition = new Vector2(startX + (textXDiff - 30f), buttonParams.StartY + ResourceManager.BUTTONS_TEXT_Y_DIFFERENCE); this.buttons[3] = new ColouredButton(buttonParams); buttonParams.ID = BUTTON_ID_EXIT; buttonParams.StartX = startX; buttonParams.StartY = 655; buttonParams.Text = "Exit"; buttonParams.TextsPosition = new Vector2(startX + textXDiff, buttonParams.StartY + ResourceManager.BUTTONS_TEXT_Y_DIFFERENCE); this.buttons[4] = new ColouredButton(buttonParams); #if WINDOWS #if DEBUG if (this.buttons != null) { for (int i = 0; i < this.buttons.Length; i++) { ScriptManager.getInstance().registerObject(this.buttons[i], "mmButton" + i); } } #endif #endif }
public InstructionsMenu(ContentManager content) { ColouredButtonParams buttonParms = new ColouredButtonParams(); buttonParms.Font = ResourceManager.getInstance().Font; buttonParms.Height = 25; buttonParms.LinesTexture = ResourceManager.getInstance().ButtonLineTexture; buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR; buttonParms.RegularColour = ResourceManager.TEXT_COLOUR; buttonParms.StartX = 560; buttonParms.Width = 225; // return button buttonParms.StartY = 557; buttonParms.Text = "Return To Main Menu"; buttonParms.TextsPosition = new Vector2(570f, buttonParms.StartY - 2); this.returnToMainButton = new ColouredButton(buttonParms); // title StaticDrawable2DParams staticParms = new StaticDrawable2DParams(); staticParms.Position = new Vector2(0f, 0f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "Instructions"); this.title = new StaticDrawable2D(staticParms); // background staticParms.Position = new Vector2(80f, 25f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "HowToPlay"); this.backGround = new StaticDrawable2D(staticParms); // sound effects this.outroSfx = LoadingUtils.load <SoundEffect>(content, "WhereWeGonnaRob"); }
public MapSelection(GraphicsDevice device, string mapName, int index, int width, int height, int startX, int startY) { this.MapName = mapName; ColouredButtonParams buttonParms = new ColouredButtonParams(); buttonParms.Font = ResourceManager.getInstance().Font; buttonParms.Height = height; buttonParms.LinesTexture = ResourceManager.getInstance().ButtonLineTexture; buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR; buttonParms.RegularColour = ResourceManager.TEXT_COLOUR; buttonParms.StartX = startX; buttonParms.Width = width; buttonParms.StartY = startY - ((index + 1) * height + (17 * (index + 1))); buttonParms.Text = mapName; buttonParms.TextsPosition = new Vector2(startX + (width / 2 - 30), buttonParms.StartY - 2f); this.PreviewButton = new ColouredButton(buttonParms); // title StaticDrawable2DParams staticParms = new StaticDrawable2DParams(); staticParms.Position = new Vector2(20f, 100f); staticParms.Texture = LoadingUtils.loadTexture2D(device, ResourceManager.MAP_FOLDER + mapName + ".png"); staticParms.Scale = new Vector2(.8f, .8f); this.previewImage = new StaticDrawable2D(staticParms); }
public MainMenu(ContentManager content) { ColouredButtonParams buttonParms = new ColouredButtonParams(); buttonParms.Font = ResourceManager.getInstance().Font; buttonParms.Height = 25; buttonParms.LinesTexture = ResourceManager.getInstance().ButtonLineTexture; buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR; buttonParms.RegularColour = ResourceManager.TEXT_COLOUR; buttonParms.StartX = 640; buttonParms.Width = 150; // play button buttonParms.StartY = 473; buttonParms.Text = "Play"; buttonParms.TextsPosition = new Vector2(690f, buttonParms.StartY - 2f); this.playButton = new ColouredButton(buttonParms); // instructions button buttonParms.StartY = 515; buttonParms.Text = "Instructions"; buttonParms.TextsPosition = new Vector2(650f, buttonParms.StartY - 2f); this.instructionsButton = new ColouredButton(buttonParms); // exit button buttonParms.StartY = 557; buttonParms.Text = "Exit"; buttonParms.TextsPosition = new Vector2(690f, buttonParms.StartY - 2); this.exitButton = new ColouredButton(buttonParms); // title StaticDrawable2DParams staticParms = new StaticDrawable2DParams(); staticParms.Position = new Vector2(0f, -20f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "Title"); this.title = new StaticDrawable2D(staticParms); // background staticParms.Position = new Vector2(0f, 0f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "MainMenu"); this.backGround = new StaticDrawable2D(staticParms); // load sound effects this.introSfx = LoadingUtils.load <SoundEffect>(content, "Introduction"); this.outroSfx = LoadingUtils.load <SoundEffect>(content, "LetsGo"); this.idleSfxs = new SoundEffect[3]; this.idleSfxs[0] = LoadingUtils.load <SoundEffect>(content, "Rules"); this.idleSfxs[1] = LoadingUtils.load <SoundEffect>(content, "HaventGotAllDay"); this.idleSfxs[2] = LoadingUtils.load <SoundEffect>(content, "LetsRobSomething"); // tired of hearing this when debugging and not starting in this state if (StateManager.getInstance().CurrentGameState == StateManager.GameState.MainMenu) { SoundManager.getInstance().sfxEngine.playSoundEffect(this.introSfx); } #if WINDOWS #if DEBUG ScriptManager.getInstance().registerObject(((ColouredButton)this.playButton).Text, "playText"); #endif #endif }
public MapSeletMenu(GraphicsDevice device, ContentManager content) { ColouredButtonParams buttonParms = new ColouredButtonParams(); buttonParms.Font = ResourceManager.getInstance().Font; buttonParms.Height = 25; buttonParms.LinesTexture = ResourceManager.getInstance().ButtonLineTexture; buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR; buttonParms.RegularColour = ResourceManager.TEXT_COLOUR; buttonParms.StartX = 580; buttonParms.Width = 205; buttonParms.StartY = 530; buttonParms.Text = "Mode Selection"; buttonParms.TextsPosition = new Vector2(605f, buttonParms.StartY - 2); this.returnToModeSelectButton = new ColouredButton(buttonParms); // read in our map names from the Maps directory string[] maps = Directory.GetFiles(ResourceManager.MAP_FOLDER, "*.png"); for (int i = 0; i < maps.Length; i++) { maps[i] = StringUtils.scrubPathAndExtFromFileName(maps[i]); } Array.Sort(maps, new MapComparer()); // load up our map selections via the names from the dierctory this.mapSelections = new List <MapSelection>(maps.Length); for (int i = 0; i < maps.Length; i++) { // if the maps number is double digits we need to offset it a bit if (maps[i].Length == 4) { this.mapSelections.Add(new MapSelection(device, maps[i], i, buttonParms.Width, buttonParms.Height, buttonParms.StartX, buttonParms.StartY)); } else { this.mapSelections.Add(new MapSelection(device, maps[i], i, buttonParms.Width, buttonParms.Height, buttonParms.StartX - 4, buttonParms.StartY)); } } // title StaticDrawable2DParams staticParms = new StaticDrawable2DParams(); staticParms.Position = new Vector2(0f, 0f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "MapSelection"); this.title = new StaticDrawable2D(staticParms); // no preview image staticParms.Position = new Vector2(20f, 100f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "NoPreview"); staticParms.Scale = new Vector2(.8f, .8f); staticParms.LightColour = ResourceManager.TEXT_COLOUR; this.noPreviewImage = new StaticDrawable2D(staticParms); }
public GameDisplay(ContentManager content) { this.content = content; this.timer = new Timer(content); ColouredButtonParams buttonParms = new ColouredButtonParams(); buttonParms.Font = ResourceManager.getInstance().Font; buttonParms.Height = 25; buttonParms.LinesTexture = ResourceManager.getInstance().ButtonLineTexture; buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR; buttonParms.RegularColour = ResourceManager.TEXT_COLOUR; buttonParms.StartX = 700; buttonParms.Width = 75; buttonParms.StartY = 557; // start button buttonParms.Text = "Start"; buttonParms.TextsPosition = new Vector2(711f, buttonParms.StartY - 2f); this.startButton = new ColouredButton(buttonParms); // HUD Text2DParams textParms = new Text2DParams(); textParms.Font = ResourceManager.getInstance().Font; textParms.LightColour = ResourceManager.TEXT_COLOUR; textParms.Position = new Vector2(727f, 150f); this.treasureText = new Text2D(textParms); StaticDrawable2DParams staticParms = new StaticDrawable2DParams(); staticParms = new StaticDrawable2DParams(); staticParms.Position = new Vector2(702f, 148f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "Treasure1"); this.treasure = new StaticDrawable2D(staticParms); //dust particle emitter BaseParticle2DEmitterParams particleEmitterParams = new BaseParticle2DEmitterParams(); particleEmitterParams.ParticleTexture = LoadingUtils.load <Texture2D>(content, "Dust1"); particleEmitterParams.SpawnDelay = DustParticleEmitter.SPAWN_DELAY; this.dustEmitter = new DustParticleEmitter(particleEmitterParams); // load sound effects this.introSfx = LoadingUtils.load <SoundEffect>(content, LEVEL_ENTRY_SFX_NAME); this.payDaySfx = LoadingUtils.load <SoundEffect>(content, "PayDay"); this.treasureSfx = LoadingUtils.load <SoundEffect>(content, "TreasureCollect"); this.guardDetectedSfx = LoadingUtils.load <SoundEffect>(content, "GuardDetection"); this.dumpsterCrashSfx = LoadingUtils.load <SoundEffect>(content, "DumpsterCrash"); this.dumpsterCloseSfx = LoadingUtils.load <SoundEffect>(content, "DumpsterClose"); }
public ModeSelectMenu(ContentManager content) { ColouredButtonParams buttonParms = new ColouredButtonParams(); buttonParms.Font = ResourceManager.getInstance().Font; buttonParms.Height = 25; buttonParms.LinesTexture = ResourceManager.getInstance().ButtonLineTexture; buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR; buttonParms.RegularColour = ResourceManager.TEXT_COLOUR; buttonParms.StartX = 560; buttonParms.Width = 225; // Normal button buttonParms.StartY = 473; buttonParms.Text = "Normal"; buttonParms.TextsPosition = new Vector2(640f, buttonParms.StartY - 2f); this.normalButton = new ColouredButton(buttonParms); // Time attack button buttonParms.StartY = 515; buttonParms.Text = "Time Attack"; buttonParms.TextsPosition = new Vector2(610f, buttonParms.StartY - 2f); this.timeAttackButton = new ColouredButton(buttonParms); // return button buttonParms.StartY = 557; buttonParms.Text = "Return To Main Menu"; buttonParms.TextsPosition = new Vector2(570f, buttonParms.StartY - 2); this.returnToMainButton = new ColouredButton(buttonParms); // title StaticDrawable2DParams staticParms = new StaticDrawable2DParams(); staticParms.Position = new Vector2(0f, 0f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "ModeSelection"); this.title = new StaticDrawable2D(staticParms); // background staticParms.Position = new Vector2(15f, 150f); staticParms.Scale = new Vector2(.75f, .75f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "ModeHelp"); this.backGround = new StaticDrawable2D(staticParms); // sound effects this.outroSfx = LoadingUtils.load <SoundEffect>(content, "WhereWeGonnaRob"); }
public GameOverMenu(ContentManager content, ScoreCalculationDelegate scoreCalculator, ResetBoardDelegate resetCallBack) { this.scoreCalculatorCallBack = (ScoreCalculationDelegate)scoreCalculator; this.resetCallBack = resetCallBack; ColouredButtonParams buttonParms = new ColouredButtonParams(); buttonParms.Font = ResourceManager.getInstance().Font; buttonParms.Height = 25; buttonParms.LinesTexture = ResourceManager.getInstance().ButtonLineTexture; buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR; buttonParms.RegularColour = ResourceManager.TEXT_COLOUR; buttonParms.StartX = 580; buttonParms.Width = 205; buttonParms.StartY = 515; // replay button buttonParms.Text = "Replay"; buttonParms.TextsPosition = new Vector2(645f, buttonParms.StartY - 2f); this.replayButton = new ColouredButton(buttonParms); // Map selection button buttonParms.StartY = 557; buttonParms.Text = "Map Selection"; buttonParms.TextsPosition = new Vector2(610f, buttonParms.StartY - 2f); this.mapSelectionButton = new ColouredButton(buttonParms); // game over text Text2DParams textParams = new Text2DParams(); textParams.Font = ResourceManager.getInstance().Font; textParams.Position = new Vector2(200f, 50f); this.gameOverText = new Text2D(textParams); // loosing background StaticDrawable2DParams staticParms = new StaticDrawable2DParams(); staticParms.Position = new Vector2(-10f, 0f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "BackGround1"); this.looseBackGround = new StaticDrawable2D(staticParms); // winning background staticParms.Texture = LoadingUtils.load <Texture2D>(content, "BackGround2"); this.winBackGround = new StaticDrawable2D(staticParms); }
public InGameMenu(ContentManager content) { ColouredButtonParams buttonParms = new ColouredButtonParams(); buttonParms.Font = ResourceManager.getInstance().Font; buttonParms.Height = 25; buttonParms.LinesTexture = ResourceManager.getInstance().ButtonLineTexture; buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR; buttonParms.RegularColour = ResourceManager.TEXT_COLOUR; buttonParms.StartX = 580; buttonParms.Width = 205; // play button buttonParms.StartY = 515; buttonParms.Text = "Return to Game"; buttonParms.TextsPosition = new Vector2(610f, buttonParms.StartY - 2f); this.returnToGameButton = new ColouredButton(buttonParms); // exit button buttonParms.StartY = 557; buttonParms.Text = "Exit To Main Menu"; buttonParms.TextsPosition = new Vector2(590f, buttonParms.StartY - 2); this.exitToMainButton = new ColouredButton(buttonParms); // title StaticDrawable2DParams staticParms = new StaticDrawable2DParams(); staticParms.Position = new Vector2(0f, 0f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "Paused"); this.title = new StaticDrawable2D(staticParms); // background staticParms.Position = new Vector2(-10f, 0f); staticParms.Texture = LoadingUtils.load <Texture2D>(content, "InGameMenu"); this.backGround = new StaticDrawable2D(staticParms); // setup the particle emitter BaseParticle2DEmitterParams particleEmitterParams = new BaseParticle2DEmitterParams(); particleEmitterParams.ParticleTexture = LoadingUtils.load <Texture2D>(content, "QuestionParticle"); particleEmitterParams.SpawnDelay = QuestionMarkEmitter.SPAWN_DELAY; this.particleEmitter = new QuestionMarkEmitter(particleEmitterParams); }
/// <summary> /// Building of a coloured button /// </summary> /// <param name="parms"></param> public ColouredButton(ColouredButtonParams parms) { this.regularColour = parms.RegularColour; this.mouseOverColour = parms.MouseOverColour; this.renderingRectangle = new Rectangle(parms.StartX, parms.StartY, parms.Width, parms.Height); this.ID = parms.ID; // create our lines this.lines = new Line2D[4]; Line2DParams lineParams = new Line2DParams(); lineParams.Texture = parms.LinesTexture; lineParams.LightColour = this.regularColour; lineParams.Position = new Vector2(parms.StartX, parms.StartY); lineParams.EndPosition = new Vector2(parms.StartX + parms.Width, parms.StartY); this.lines[0] = new Line2D(lineParams); lineParams.Position = new Vector2(parms.StartX + parms.Width, parms.StartY); lineParams.EndPosition = new Vector2(parms.StartX + parms.Width, parms.StartY + parms.Height); this.lines[1] = new Line2D(lineParams); lineParams.Position = new Vector2(parms.StartX + parms.Width, parms.StartY + parms.Height); lineParams.EndPosition = new Vector2(parms.StartX, parms.StartY + parms.Height); this.lines[2] = new Line2D(lineParams); lineParams.Position = new Vector2(parms.StartX, parms.StartY + parms.Height); lineParams.EndPosition = new Vector2(parms.StartX, parms.StartY); this.lines[3] = new Line2D(lineParams); // create the text Text2DParams textParams = new Text2DParams(); textParams.Font = parms.Font; textParams.LightColour = this.regularColour; textParams.Position = parms.TextsPosition; textParams.WrittenText = parms.Text; this.text = new Text2D(textParams); }
private const float DELAY = 750f; //Time the conmputer takes to place a move #endregion Class variables #region Class propeties #endregion Class properties #region Constructor public GameDisplay(ContentManager content) { // create the flowers this.flowers = new Flower[9]; for (int i = 0; i < this.flowers.Length; i++) { this.flowers[i] = new Flower(content, i); } this.diggingSFX = LoadingUtils.load <SoundEffect>(content, "Digging"); // create our players float textY = (Game1.RESOLUTION.Y - 50f); Vector2 playersScorePosition = new Vector2(100f, textY); Vector2 playersTurnSpritePosition = new Vector2(playersScorePosition.X - 75f, playersScorePosition.Y + 25f); Vector2 computersScorePosition = new Vector2(Game1.RESOLUTION.X - 250f, textY); Vector2 computersTurnSpritePosition = new Vector2(computersScorePosition.X + 175f, computersScorePosition.Y + 25f); this.player = new Player(content, ResourceManager.getInstance().Font, "Player", playersScorePosition, playersTurnSpritePosition, "DaisyAlive", "DaisyDying", LogicUtils.PLAYERS_TYPE); this.computer = new Player(content, ResourceManager.getInstance().Font, "Computer", computersScorePosition, computersTurnSpritePosition, "RoseAlive", "RoseDying", LogicUtils.COMPUTERS_TYPE); // Replay button int startX = 1000; ColouredButtonParams buttonParams = new ColouredButtonParams(); buttonParams.Font = ResourceManager.getInstance().Font; buttonParams.LinesTexture = ResourceManager.getInstance().ButtonsLineTexture; buttonParams.Height = ResourceManager.BUTTONS_HEIGHT; buttonParams.Width = ResourceManager.BUTTONS_WIDTH; buttonParams.MouseOverColour = ResourceManager.getInstance().ButtonsMouseOverColour; buttonParams.RegularColour = ResourceManager.getInstance().TextColour; buttonParams.StartX = startX; buttonParams.StartY = 550; buttonParams.Text = "Replay"; buttonParams.TextsPosition = new Vector2(startX + 35f, buttonParams.StartY + ResourceManager.BUTTONS_TEXT_Y_DIFFERENCE); this.replayButton = new ColouredButton(buttonParams); reset(true); }
public InGameMenu(ResetDelegate resetDelegate) { this.resetDelegate = resetDelegate; this.buttons = new ColouredButton[2]; int startX = 1000 - 25; ColouredButtonParams buttonParams = new ColouredButtonParams(); buttonParams.Font = ResourceManager.getInstance().Font; buttonParams.LinesTexture = ResourceManager.getInstance().ButtonsLineTexture; buttonParams.Height = ResourceManager.BUTTONS_HEIGHT; buttonParams.Width = ResourceManager.BUTTONS_WIDTH + 75; // These buttons are a little wider buttonParams.MouseOverColour = ResourceManager.getInstance().ButtonsMouseOverColour; buttonParams.RegularColour = ResourceManager.getInstance().TextColour; buttonParams.ID = BUTTON_ID_RETURN_TO_GAME; buttonParams.StartX = startX; buttonParams.StartY = 500; buttonParams.Text = "Return to Game"; buttonParams.TextsPosition = new Vector2(startX + 35f, buttonParams.StartY + ResourceManager.BUTTONS_TEXT_Y_DIFFERENCE); this.buttons[0] = new ColouredButton(buttonParams); buttonParams.ID = BUTTON_ID_EXIT_TO_MAIN_MENU; buttonParams.StartX = startX; buttonParams.StartY = 575; buttonParams.Text = "Exit to Main Menu"; buttonParams.TextsPosition = new Vector2(startX + 20f, buttonParams.StartY + ResourceManager.BUTTONS_TEXT_Y_DIFFERENCE); this.buttons[1] = new ColouredButton(buttonParams); #if WINDOWS #if DEBUG if (this.buttons != null) { for (int i = 0; i < this.buttons.Length; i++) { ScriptManager.getInstance().registerObject(this.buttons[i], "igmButton" + i); } } #endif #endif }