Example #1
0
 void LoadGame(string saveName)
 {
     gameFiles.LoadGame(graphics.GraphicsDevice, hero.player, numTilesScreen, mapEditor.GetLayerNumber(), saveName);
     cam.MoveCamera(hero.player.GetPosition(), gameFiles.GetTileMaps().TilePixSize(), numTilesScreen.Width, numTilesScreen.Height, gameFiles.GetMap().Width(), gameFiles.GetMap().Height());
     gameState.SetGameState(GameState.Play);
     this.IsMouseVisible = false;
     mapEditor.Refresh();
 }
Example #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            string filePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\My Games\\DrawMamon";

            gameFiles = new GameFiles(Content.Load <Texture2D>("Textures\\EmptyTile"), windowSize, numTilesScreen, filePath);

            GameFont = Content.Load <SpriteFont>("Fonts\\Font");

            mainMenu = new MainMenu(Content.Load <Texture2D>("Textures\\UI\\MapEditor\\ToolBar"),
                                    Content.Load <Texture2D>("Textures\\UI\\EscapeMenu\\MenUKnop Blauw"),
                                    Content.Load <Texture2D>("Textures\\UI\\EscapeMenu\\MenUKnop Blauw"),
                                    Content.Load <Texture2D>("Textures\\UI\\MainMenu\\Menuknop play"),
                                    Content.Load <Texture2D>("Textures\\UI\\General\\textBoxBG"),
                                    Content.Load <Texture2D>("Textures\\UI\\General\\textBoxBG"),
                                    Content.Load <Texture2D>("Textures\\UI\\General\\SelectedBox"),
                                    Content.Load <Texture2D>("Textures\\UI\\General\\VScrollbarBG"),
                                    Content.Load <Texture2D>("Textures\\UI\\General\\VScrollbarButton"),
                                    Content.Load <Texture2D>("Textures\\UI\\MainMenu\\Menuknop play"),
                                    Content.Load <Texture2D>("Textures\\UI\\EscapeMenu\\MenUKnop Blauw"),
                                    Content.Load <Texture2D>("Textures\\UI\\General\\File"),
                                    windowSize, screenOffset, GameFont, gameFiles.GetSaveFolder(), gameFiles.GetWorldFolder());
            mainMenu.NewGameEvent  += new NewGameHandler(NewGame);
            mainMenu.LoadGameEvent += new LoadGameHandler(LoadGame);
            mainMenu.JoinGameEvent += new JoinGameHandler(JoinGame);


            escapeMenu = new EscapeMenu(Content.Load <Texture2D>("Textures\\UI\\EscapeMenu\\Menuknop BLAUW SAVE"),
                                        Content.Load <Texture2D>("Textures\\UI\\EscapeMenu\\Menuknop BLAUW EXIT"),
                                        windowSize, screenOffset, GameFont);
            escapeMenu.ExitEvent += new ExitEventHandler(ExitGame);
            escapeMenu.SaveEvent += new SaveEventHandler(SaveGame);


            hero                  = new Hero();
            hero.player           = new Player(new Point(160, 160), Content.Load <Texture2D>("Textures\\Boer16x32Animatie"), new Size(16, 32), gameFiles.GetTileMaps().TilePixSize());
            cam                   = new Camera(hero.player.GetPosition());
            hero.playerController = new PlayerController(gameFiles.GetTileMaps().TilePixSize(), 2);

            network = new Network(Content.Load <Texture2D>("Textures\\Boer16x32Animatie"), hero, gameFiles.GetTileMaps().TilePixSize(), gameFiles);
            network.ConnectionMadeEvent += new ConnectionMadeHandler(ConnectionMade);
            network.ConnectionLostEvent += new ConnectionLostHandler(LostConnection);
            network.AddTileMapEvent     += new AddTileMapHandler(AddTileMap);

            mapEditor = new MapEditor(Content.Load <Texture2D>("Textures\\UI\\MapEditor\\ToolBar"),
                                      Content.Load <Texture2D>("Textures\\UI\\MapEditor\\FloorLayerWhite"),
                                      Content.Load <Texture2D>("Textures\\UI\\MapEditor\\RoofLayerWhite"),
                                      Content.Load <Texture2D>("Textures\\UI\\MapEditor\\TileBoxbg"),
                                      Content.Load <Texture2D>("Textures\\UI\\MapEditor\\PijlLinks"),
                                      Content.Load <Texture2D>("Textures\\UI\\MapEditor\\PijlRechts"),
                                      Content.Load <Texture2D>("Textures\\UI\\MapEditor\\OpenMap"),
                                      Content.Load <Texture2D>("Textures\\UI\\MapEditor\\Prullebak"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\OpenFileBG"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\closeButton"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\Map"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\File"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\SluitMap"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\HScrollbarBG"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\HScrollbarButton"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\VScrollbarBG"),
                                      Content.Load <Texture2D>("Textures\\UI\\General\\VScrollbarButton"),
                                      Content.Load <SpriteFont>("Fonts\\Font"),
                                      Content.Load <SpriteFont>("Fonts\\Font"), graphics, gameFiles.GetTileMaps(),
                                      network, windowSize, screenOffset);
            mapEditor.FinishedEvent += new FinishedHandler(closeMapEditor);
        }