private void UnloadEditor() { this.gui = (Gui)null; this.map = (EditMap)null; this.cameraMap = (CameraMap)null; this.pauseScreen = (Pause)null; }
protected override void LoadContent() { this.spriteBatch = new SpriteBatch(this.GraphicsDevice); switch (this.gameStateIntent) { case GameState.Menu: this.menu = new Menu(); this.menu.Instil(this.Content, this.GraphicsDevice); this.menu.start.click += new Button.ClickHandler(this.SwitchToGame); this.menu.editor.click += new Button.ClickHandler(this.SwitchToEditor); break; case GameState.InGame: this.camera = new Camera(this.GraphicsDevice.Viewport); this.player = new Player(); this.lord = new AIOverLord(); this.LoadMap(this.mapPath); this.map1.Instil(this, this.Content); this.player.Instil(this.Content, this.map1); this.camera.Instil(new Vector2(this.player.Location.X - (float)(this.GraphicsDevice.Viewport.Width / 2), this.player.Location.Y)); this.lord.Instil(this.map1, this.Content, this.player); this.gameGui = new GameGUI(this.Content, this.player, this.map1); this.dask_Backgourd = this.Content.Load <Texture2D>("Graphics\\Dask_Backgourd"); this.Cloud1 = new Scroll(new Texture2D[3] { this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer1_001"), this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer1_002"), this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer1_003") }, 4f, this.map1.xMax, this.GraphicsDevice.Viewport.Width); this.Cloud2 = new Scroll(new Texture2D[3] { this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer2_001"), this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer2_002"), this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer2_003") }, 3f, this.map1.xMax, this.GraphicsDevice.Viewport.Width); this.pauseScreen = new Pause(this.Content, this.GraphicsDevice, this.GraphicsDevice.Viewport); this.pauseScreen.menu.click += new Button.ClickHandler(this.SwitchToMenuGame); this.pauseScreen.resume.click += new Button.ClickHandler(this.ResumeGame); break; case GameState.Editor: this.GraphicsDevice.Viewport = new Viewport(0, 0, this.graphics.PreferredBackBufferWidth, this.graphics.PreferredBackBufferHeight); this.cameraMap = new CameraMap(this.GraphicsDevice.Viewport, this.currentM); this.gui = new Gui(); this.map = new EditMap(this, this.Content, this.cameraMap); this.gui.Instil(this.Content, this.GraphicsDevice, this.map, this); this.pauseScreen = new Pause(this.Content, this.GraphicsDevice, this.GraphicsDevice.Viewport); this.pauseScreen.menu.click += new Button.ClickHandler(this.SwitchToMenuEditor); this.pauseScreen.resume.click += new Button.ClickHandler(this.ResumeEditor); break; } }
public void Instil(ContentManager content, GraphicsDevice gd, EditMap map, Game1 parent) { this.mode = EditorMode.Editor; this.mapSelection = new MapSelection(content, gd, this, "Content/Map"); this.map = map; this.content = content; this.currentPath = "TestMap.amf"; this.parentGame = parent; this.view = gd.Viewport; this.lights = false; this.buttons = new List <Button>(); this.tabOneButton = new TextButton("One", content, 2, 990, 64, 64, gd); this.tabOneButton.click += new Button.ClickHandler(this.TabOneClick); this.buttons.Add((Button)this.tabOneButton); this.tabTwoButton = new TextButton("One", content, 68, 990, 64, 64, gd); this.tabTwoButton.click += new Button.ClickHandler(this.TabTwoClick); this.buttons.Add((Button)this.tabTwoButton); this.tabTwoButton = new TextButton("Two", content, 68, 990, 64, 64, gd); this.tabTwoButton.click += new Button.ClickHandler(this.TabTwoClick); this.buttons.Add((Button)this.tabTwoButton); this.tabThreeButton = new TextButton("Three", content, 134, 990, 64, 64, gd); this.tabThreeButton.click += new Button.ClickHandler(this.TabThreeClick); this.buttons.Add((Button)this.tabThreeButton); this.SaveButton = new TextButton("Save", content, this.view.Width - 66, this.view.Height - 66, 64, 64, gd); this.SaveButton.click += new Button.ClickHandler(this.SaveClick); this.buttons.Add((Button)this.SaveButton); this.OpenButton = new TextButton("Open", content, this.view.Width - 66, this.view.Height - 132, 64, 64, gd); this.OpenButton.click += new Button.ClickHandler(this.OpenClick); this.buttons.Add((Button)this.OpenButton); this.SaveAsButton = new TextButton("Save \nAs", content, this.view.Width - 66, this.view.Height - 198, 64, 64, gd); this.SaveAsButton.click += new Button.ClickHandler(this.SaveAsClick); this.buttons.Add((Button)this.SaveAsButton); this.NewButton = new TextButton("New", content, this.view.Width - 66, this.view.Height - 264, 64, 64, gd); this.NewButton.click += new Button.ClickHandler(this.NewClick); this.buttons.Add((Button)this.NewButton); this.PlayButton = new TextButton("Play", content, this.view.Width - 66, this.view.Height - 330, 64, 64, gd); this.PlayButton.click += new Button.ClickHandler(this.PlayClick); this.buttons.Add((Button)this.PlayButton); this.LightButton = new TextButton("Light", content, this.view.Width - 66, this.view.Height - 396, 64, 64, gd); this.LightButton.click += new Button.ClickHandler(this.LightClick); this.buttons.Add((Button)this.LightButton); this.ShadeButton = new TextButton("Shade", content, this.view.Width - 66, this.view.Height - 462, 64, 64, gd); this.ShadeButton.click += new Button.ClickHandler(this.ShadeClick); this.buttons.Add((Button)this.ShadeButton); this.CleanButton = new TextButton("Clean", content, this.view.Width - 66, this.view.Height - 528, 64, 64, gd); this.CleanButton.click += (Button.ClickHandler)((sender, e) => map.CleanMap()); this.buttons.Add((Button)this.CleanButton); this.mapArea = new AreaButton(332, 0, this.view.Width - 400, this.view.Height); this.mapArea.click += new AreaButton.ClickHandler(this.AreaClick); this.mapArea.rightClick += new AreaButton.RightClickHandler(this.RightAreaClick); this.currentPlaceable = (Placeable)map.tileFactory.GetTile(TileType.Metal, 0.0f, 0.0f, false, false, false, false); this.currentTexture = this.currentPlaceable.GetTexture(); this.enumNames = Enum.GetNames(typeof(TileType)); this.tabOneButtons = new List <PlaceableButton>(); this.tabTwoButtons = new List <PlaceableButton>(); this.tabThreeButtons = new List <PlaceableButton>(); this.tabOneButtons = this.GetTab(0, this.enumNames.Length, gd); this.tabTwoButtons = this.GetPickUpTab(); this.tabThreeButtons = this.GetDecorationTab(); this.currentTab = new List <Button>(); foreach (Button tabOneButton in this.tabOneButtons) { this.currentTab.Add(tabOneButton); } this.buttonArea = Div.getTexture(gd, (int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 332, 992); }