예제 #1
0
        public override void LoadContent(ContentManager content)
        {
            keyboard = new KeyboardController();
            gamepad  = new GamepadController();
            board.Add(name.score, name.name);
            using (StreamReader stream = new StreamReader("LeaderBoard.txt"))
            {
                string line;
                while ((line = stream.ReadLine()) != null)
                {
                    string[] words = line.Split(' ');
                    board.Add(Int32.Parse(words[0]), words[1]);
                }
                board.Remove(board.Keys.First());
                int i = 5;
                foreach (KeyValuePair <int, string> pair in board)
                {
                    switch (i)
                    {
                    case 5:
                        fifth = pair;
                        break;

                    case 4:
                        fourth = pair;
                        break;

                    case 3:
                        third = pair;
                        break;

                    case 2:
                        second = pair;
                        break;

                    case 1:
                        first = pair;
                        break;
                    }
                    i--;
                }
            }
            File.WriteAllText("LeaderBoard.txt", string.Empty);
            using (StreamWriter sw = new StreamWriter("LeaderBoard.txt"))
            {
                foreach (KeyValuePair <int, string> pair in board)
                {
                    sw.WriteLine(pair.Key.ToString() + " " + pair.Value);
                }
            }
            font = content.Load <SpriteFont>("temp_font");
            keyboard.commandDict.Add(Keys.Q, new QuitCommand());
            keyboard.commandDict.Add(Keys.R, new ResetDJCommand(graphics, gManager, audioManager));
            controllers.Add(keyboard);
            controllers.Add(gamepad);
        }
예제 #2
0
 public override void LoadContent(ContentManager content)
 {
     keyboard = new KeyboardController();
     gamepad  = new GamepadController();
     font     = content.Load <SpriteFont>("temp_font");
     keyboard.commandDict.Add(Keys.Q, new QuitCommand());
     keyboard.commandDict.Add(Keys.R, new ResetCommand(graphics, graphicsManager, hud.audio));
     controllers.Add(keyboard);
     controllers.Add(gamepad);
     FinalScore();
 }
예제 #3
0
 public override void LoadContent(ContentManager content)
 {
     keyboard = new KeyboardController();
     gamepad  = new GamepadController();
     keyboard.commandDict.Add(Keys.P, new PauseCommand(graphics, hud, audio, graphicsManager));
     gamepad.commandDict.Add(Buttons.Back, new PauseCommand(graphics, hud, audio, graphicsManager));
     keyboard.commandDict.Add(Keys.M, new MainMenuCommand(graphics, graphicsManager));
     keyboard.commandDict.Add(Keys.Q, new QuitCommand());
     controllers.Add(keyboard);
     controllers.Add(gamepad);
     font = content.Load <SpriteFont>("temp_font");
 }
예제 #4
0
 public override void LoadContent(ContentManager content)
 {
     keyboard = new KeyboardController();
     gamepad  = new GamepadController();
     keyboard.commandDict.Add(Keys.Left, new NameLeftCommand(playerName));
     keyboard.commandDict.Add(Keys.Right, new NameRightCommand(playerName));
     keyboard.commandDict.Add(Keys.Enter, new NameEnterCommand(graphics, playerName, gman, _audio));
     keyboard.commandDict.Add(Keys.Up, new NameUpCommand(playerName));
     keyboard.commandDict.Add(Keys.Down, new NameDownCommand(playerName));
     controllers.Add(keyboard);
     controllers.Add(gamepad);
     font = content.Load <SpriteFont>("temp_font");
 }
예제 #5
0
 override public void LoadContent(ContentManager content)
 {
     keyboard = new KeyboardController();
     gamepad  = new GamepadController();
     keyboard.commandDict.Add(Keys.Enter, new SMBStartCommand(graphics, graphicsManager));
     gamepad.commandDict.Add(Buttons.Start, new SMBStartCommand(graphics, graphicsManager));
     keyboard.commandDict.Add(Keys.Space, new DJStartCommand(graphics, graphicsManager));
     gamepad.commandDict.Add(Buttons.Back, new DJStartCommand(graphics, graphicsManager));
     keyboard.commandDict.Add(Keys.Q, new QuitCommand());
     controllers.Add(keyboard);
     controllers.Add(gamepad);
     font = content.Load <SpriteFont>("temp_font");
 }
예제 #6
0
        public override void LoadContent(ContentManager content)
        {
            this.content = content;
            font         = content.Load <SpriteFont>("temp_font");
            hud          = new HudObject(font);
            string name = "world_1_1_draft.txt";
            //string name = "test_level.txt";
            // figure out the file pathing later
            Tokenizer test = new Tokenizer(name, content);

            //gameObjects = gameObjects.Concat(test.GetSprites()).ToList();
            layers[1].Objects = test.GetSprites();
            layers[0].Objects.Add(new BGObject(content));
            //layers[2].Objects.Add(hud);
            foreach (AbsObject temp in layers[1].Objects)
            {
                if (temp is MarioObject)
                {
                    avatar = (MarioObject)temp;
                }
                else if (temp is EnemyObject)
                {
                    EnemyObject enemy = (EnemyObject)temp;
                    enemy.Mario = avatar;
                }
            }
            avatar.hud = hud;
            hud.audio  = avatar.audio;
            keyboard   = new KeyboardController();
            keyboard.moveCommandDict.Add(Keys.Up, new UpCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.Up, new DownCommand(avatar));
            keyboard.moveCommandDict.Add(Keys.W, new UpCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.W, new DownCommand(avatar));

            keyboard.moveCommandDict.Add(Keys.Down, new DownCommand(avatar));
            keyboard.moveCommandDict.Add(Keys.S, new DownCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.Down, new UpCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.S, new UpCommand(avatar));

            keyboard.moveCommandDict.Add(Keys.Left, new LeftCommand(avatar));
            keyboard.moveCommandDict.Add(Keys.A, new LeftCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.Left, new RightCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.A, new RightCommand(avatar));

            keyboard.moveCommandDict.Add(Keys.Right, new RightCommand(avatar));
            keyboard.moveCommandDict.Add(Keys.D, new RightCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.Right, new LeftCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.D, new LeftCommand(avatar));

            keyboard.commandDict.Add(Keys.Space, new ThrowFireballCommand(avatar));
            keyboard.commandDict.Add(Keys.Y, new StandardCommand(avatar));
            keyboard.commandDict.Add(Keys.U, new SuperCommand(avatar));
            keyboard.commandDict.Add(Keys.I, new FireCommand(avatar));
            keyboard.commandDict.Add(Keys.O, new TakeDamageCommand(avatar));
            keyboard.commandDict.Add(Keys.Q, new QuitCommand());
            keyboard.commandDict.Add(Keys.P, new PauseCommand(graphics, hud, avatar.audio, graphicsManager));
            keyboard.commandDict.Add(Keys.M, new MuteCommand(avatar.audio));
            keyboard.commandDict.Add(Keys.Tab, new ThemeCommand(avatar.audio));
            keyboard.commandDict.Add(Keys.R, new ResetCommand(graphics, graphicsManager, hud.audio));
            gamepad = new GamepadController();
            gamepad.moveCommandDict.Add(Buttons.A, new UpCommand(avatar));
            gamepad.releaseCommandDict.Add(Buttons.A, new DownCommand(avatar));
            gamepad.moveCommandDict.Add(Buttons.DPadDown, new DownCommand(avatar));
            gamepad.releaseCommandDict.Add(Buttons.DPadDown, new UpCommand(avatar));
            gamepad.moveCommandDict.Add(Buttons.DPadLeft, new LeftCommand(avatar));
            gamepad.releaseCommandDict.Add(Buttons.DPadLeft, new RightCommand(avatar));
            gamepad.moveCommandDict.Add(Buttons.DPadRight, new RightCommand(avatar));
            gamepad.releaseCommandDict.Add(Buttons.DPadRight, new LeftCommand(avatar));
            gamepad.commandDict.Add(Buttons.B, new ThrowFireballCommand(avatar));
            gamepad.commandDict.Add(Buttons.Start, new QuitCommand());
            gamepad.commandDict.Add(Buttons.Back, new PauseCommand(graphics, hud, avatar.audio, graphicsManager));
            controllers.Add(keyboard);
            controllers.Add(gamepad);
        }
예제 #7
0
        public override void LoadContent(ContentManager content)
        {
            font = content.Load <SpriteFont>("temp_font");
            hud  = new HudObject(font);
            string name = "doodle_test.txt";

            token  = new Tokenizer(name, content);
            avatar = new DoodleObject(new Vector2(windowWidth / 2, 3450), content, token.audio);
            camera.LookAt(avatar.Position);
            generator = new Level_Generator(content, camera, avatar, token.audio);
            generator.Initialize(layers[1]);
            //collision requires everything to be in the same list, so the platforms need to be with the avatar
            //changing the level floor to be platforms instead of blocks, no need for a level definition.
            //tokenizer does something with the audio so leaving the token object around for now
            layers[1].Objects.Add(new PlatformObject(new Vector2(0, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(64, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(128, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(192, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(256, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(320, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(384, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(448, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(512, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(576, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(640, 3540), -1, content));
            layers[1].Objects.Add(new PlatformObject(new Vector2(704, 3540), -1, content));
            //layers[1].Objects.Add(new PlatformObject(new Vector2(0, 3400), new Vector2(windowWidth, 3400), -1, content));
            // nvm try and keep avatar at the end of the list
            layers[1].Objects.Add(avatar);
            layers[0].Objects.Add(new VertBGObject(content));

            avatar.hud = hud;
            hud.audio  = avatar.audio;

            keyboard = new KeyboardController();
            gamepad  = new GamepadController();
            keyboard.commandDict.Add(Keys.Z, new MainMenuCommand(graphics, graphicsManager));
            controllers.Add(keyboard);
            controllers.Add(gamepad);
            keyboard.moveCommandDict.Add(Keys.Up, new UpCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.Up, new DownCommand(avatar));
            keyboard.moveCommandDict.Add(Keys.W, new UpCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.W, new DownCommand(avatar));

            keyboard.moveCommandDict.Add(Keys.Down, new DownCommand(avatar));
            keyboard.moveCommandDict.Add(Keys.S, new DownCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.Down, new UpCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.S, new UpCommand(avatar));

            keyboard.moveCommandDict.Add(Keys.Left, new LeftCommand(avatar));
            keyboard.moveCommandDict.Add(Keys.A, new LeftCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.Left, new RightCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.A, new RightCommand(avatar));

            keyboard.moveCommandDict.Add(Keys.Right, new RightCommand(avatar));
            keyboard.moveCommandDict.Add(Keys.D, new RightCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.Right, new LeftCommand(avatar));
            keyboard.releaseCommandDict.Add(Keys.D, new LeftCommand(avatar));

            keyboard.commandDict.Add(Keys.Y, new StandardCommand(avatar));
            keyboard.commandDict.Add(Keys.U, new SuperCommand(avatar));
            keyboard.commandDict.Add(Keys.I, new FireCommand(avatar));
            keyboard.commandDict.Add(Keys.O, new TakeDamageCommand(avatar));
            keyboard.commandDict.Add(Keys.Q, new QuitCommand());
            keyboard.commandDict.Add(Keys.P, new PauseCommand(graphics, hud, avatar.audio, graphicsManager));
            keyboard.commandDict.Add(Keys.M, new MuteCommand(avatar.audio));
            keyboard.commandDict.Add(Keys.Tab, new ThemeCommand(avatar.audio));
            keyboard.commandDict.Add(Keys.R, new ResetDJCommand(graphics, graphicsManager, hud.audio));

            avatar.audio.PlaySound("doodleTheme");
        }