private void setMap(string file) { // Set the map this.mapFile = file; this.screenManager.Graphics.SetDefaultCamera(); this.bgLevel = new BackgroundLevel(this.screenManager, this.mapFile); // Choose a random colour for the walls this.bgLevel.RandomizeMapColor(); }
public FindGamesScreen(ScreenManager sM, BackgroundLevel bgLevel = null) : base(sM) { // Some settings if (bgLevel == null) { this.bgLevel = new BackgroundLevel(this.screenManager); } else { this.bgLevel = bgLevel; } this.errorMessages = ""; this.MenuSize = this.screenManager.ScreenResolution - 150 * Vector2.UnitX; this.PositionMenuScreen(MenuItem.HorizontalAlign.Center, MenuItem.VerticalAlign.Top); this.FavMenuItem.TextAlign = MenuItem.HorizontalAlign.Left; // IP and port this.miIP = new MenuItemTextbox("IP adress", this.screenManager.Graphics, 15); this.AddMenuItem(miIP); this.miPort = new MenuItemTextbox("Port", this.screenManager.Graphics, 7); this.AddMenuItem(miPort); // Create, join and back buttons MenuItem miCreate = new MenuItem("Create game", sM.Graphics); miCreate.OnClick += (o, e) => { this.Create(); }; this.AddMenuItem(miCreate); MenuItem miJoin = new MenuItem("Join game", sM.Graphics); miJoin.OnClick += (o, e) => { this.Join(); }; this.AddMenuItem(miJoin); this.miBack = new MenuItem("Back", sM.Graphics); this.miBack.OnClick += (o, e) => { this.Remove(); }; this.AddMenuItem(this.miBack); // Colour and position the menus this.FastLayout(this.FavMenuItem); miCreate.Size = new Vector2(290, miCreate.Size.Y); miJoin.Size = miCreate.Size; miBack.Size = miCreate.Size; miBack.TextAlign = MenuItem.HorizontalAlign.Right; this.miIP.Size += new Vector2(170, 0); this.positionMenuItems(miCreate, miJoin); // Load the values this.Load(); }
public TitleScreen(ScreenManager sM) : base(sM) { // Some settings this.bgLevel = new BackgroundLevel(this.screenManager); this.bgLevel.RandomizeMapColor(true); this.MenuSize = new Vector2(400, 270); this.PositionMenuScreen(MenuItem.HorizontalAlign.Center, MenuItem.VerticalAlign.Middle); this.FavMenuItem.TextAlign = MenuItem.HorizontalAlign.Center; // The menu MenuItem miSelectLevel = new MenuItem("Singleplayer", sM.Graphics); miSelectLevel.OnClick += (o, e) => { this.screenManager.AddScreen(new LobbyScreen(this.screenManager, this.bgLevel)); }; this.AddMenuItem(miSelectLevel); MenuItem miSelectLevelMP = new MenuItem("Multiplayer", sM.Graphics); miSelectLevelMP.OnClick += (o, e) => { this.screenManager.AddScreen(new FindGamesScreen(this.screenManager, this.bgLevel)); }; this.AddMenuItem(miSelectLevelMP); MenuItem miHowToPLay = new MenuItem("How to play", sM.Graphics); miHowToPLay.OnClick += (o, e) => { this.screenManager.AddScreen(new HowToPlayScreen(this.screenManager, this.bgLevel)); }; this.AddMenuItem(miHowToPLay); MenuItem miOptions = new MenuItem("Options", sM.Graphics); miOptions.OnClick += (o, e) => { this.screenManager.AddScreen(new OptionsScreen(this.screenManager, this.bgLevel)); }; this.AddMenuItem(miOptions); this.miExit = new MenuItem("Exit", sM.Graphics); this.miExit.OnClick += (o, e) => { this.screenManager.Exit(); }; this.AddMenuItem(this.miExit); // Use the fast layout method to set the layout of the menu's this.FastLayout(this.FavMenuItem, 10); }
public OptionsScreen(ScreenManager sM, BackgroundLevel bgLevel = null) : base(sM) { // Some settings if (bgLevel == null) { this.bgLevel = new BackgroundLevel(this.screenManager); } else { this.bgLevel = bgLevel; } this.errorMessages = ""; this.MenuSize = this.screenManager.ScreenResolution - 150 * Vector2.UnitX; this.PositionMenuScreen(MenuItem.HorizontalAlign.Center, MenuItem.VerticalAlign.Top); this.FavMenuItem.TextAlign = MenuItem.HorizontalAlign.Left; // The options this.miName = new MenuItemTextbox("Name", this.screenManager.Graphics); this.AddMenuItem(miName); this.miGhostSpeed = new MenuItemYesNo("Fast ghosts", this.screenManager.Graphics); this.AddMenuItem(miGhostSpeed); // Save and back buttons MenuItem miSave = new MenuItem("Save", sM.Graphics); miSave.OnClick += (o, e) => { this.Save(); }; this.AddMenuItem(miSave); this.miBack = new MenuItem("Back", sM.Graphics); this.miBack.OnClick += (o, e) => { this.Remove(); }; this.AddMenuItem(this.miBack); // Colour the menus (and position them) this.FastLayout(this.FavMenuItem); miBack.TextAlign = MenuItem.HorizontalAlign.Right; // Position the menus (override previous positioning) this.positionMenuItems(miSave); // Load the values this.Load(); }
public HowToPlayScreen(ScreenManager sM, BackgroundLevel bgLevel = null) : base(sM) { this.bgLevel = bgLevel; if (bgLevel == null) { Vector3 eye = sM.Graphics.Camera.Eye; this.bgLevel = new BackgroundLevel(sM, Settings.Get.Map); sM.Graphics.Camera.MoveTo(eye); } this.text = new ParagraphList(sM.Graphics.FontGeometry, new Vector2(120, 200), Color.White); // Some explanation text this.text.Add(new Paragraph("Controls")); this.text[0].AddLine("Use the arrow keys to move around."); this.text[0].AddLine("Use WASD to move the camera, and R to reset it."); this.text[0].AddLine("Hit P to pauze, and Esc when you get desperate."); this.text.Add(new Paragraph("Objective")); this.text[1].AddLine("PacMan's goal is to eat all the orbs without getting eaten by ghosts."); this.text[1].AddLine("The goal of the ghosts is to make sure PacMan fails that ASAP."); }
public LobbyScreen(ScreenManager sM, BackgroundLevel bgLevel = null, MultiPlayerInfo mpInfo = null) : base(sM) { // Some settings if (bgLevel == null) { this.bgLevel = new BackgroundLevel(this.screenManager); } else { this.bgLevel = bgLevel; } this.errorMessages = ""; this.multiplayerInfo = mpInfo; this.MenuSize = this.screenManager.ScreenResolution - 150 * Vector2.UnitX; this.NrOfColumns = 2; this.PositionMenuScreen(MenuItem.HorizontalAlign.Center, MenuItem.VerticalAlign.Top); this.FavMenuItem.TextAlign = MenuItem.HorizontalAlign.Left; this.HorizontalAndVerticalArrowKeys = true; // Start and back buttons MenuItem miStart = new MenuItem("Start", sM.Graphics); if (!this.MultiPlayer || this.multiplayerInfo.IsHost()) { miStart.OnClick += (o, e) => { this.Start(); } } ; this.AddMenuItem(miStart); this.miBack = new MenuItem("Back", sM.Graphics); this.miBack.OnClick += (o, e) => { this.Remove(); }; this.AddMenuItem(this.miBack, 1); // The player dropdowns List <string> options = new List <string>() { Settings.Get.Name, "Stupid", "Normal", "Euclidian", NONE }; this.miPacMan = new MenuItemList("PacMan", new List <string>(options), sM.Graphics); this.miMsPacMan = new MenuItemList("Ms PacMan", new List <string>(options), sM.Graphics); this.miGhosts = new MenuItemList[4]; for (int i = 0; i < this.miGhosts.Length; i++) { this.miGhosts[i] = new MenuItemList(Ghost.GetName(i), new List <string>(options), sM.Graphics); } if (this.MultiPlayer) { this.managePlayersMP(); } this.finishCreatingMenus(); // The maps MenuItem[] miMaps = new MenuItem[6]; for (int i = 0; i < miMaps.Length; i++) { miMaps[i] = new MenuItem("Map " + i.ToString(), sM.Graphics); miMaps[i].OnClick += generateSetMap(i); this.AddMenuItem(miMaps[i], 1); } // Colour the menus (and position them) this.FastLayout(this.FavMenuItem); miBack.TextAlign = MenuItem.HorizontalAlign.Right; // Set the PacMan and ghost colours this.miPacMan.SelectedColour = Color.Yellow; this.miMsPacMan.SelectedColour = Color.Yellow; this.miGhosts[0].SelectedColour = Color.Red; this.miGhosts[1].SelectedColour = Color.DeepPink; this.miGhosts[2].SelectedColour = Color.Cyan; this.miGhosts[3].SelectedColour = Color.Orange; // Position the menus (override previous positioning) this.positionMenuItems(miStart, miMaps); // Load the values this.Load(); // Subscribe to the multiplayer info events if (this.MultiPlayer) { this.multiplayerInfo.OnRefresh += (o, e) => { this.managePlayersMP(); } } ; }