Exemplo n.º 1
0
        protected override void LoadContent()
        {
            mapSpriteBatch    = new SpriteBatch(GraphicsDevice);
            screenSpriteBatch = new SpriteBatch(GraphicsDevice);

            mizjamHugeFont              = Content.Load <SpriteFont>("Fonts/mizjam48");
            mizjamBigFont               = Content.Load <SpriteFont>("Fonts/mizjam36");
            mizjamSmallFont             = Content.Load <SpriteFont>("Fonts/mizjam24");
            mizjamSmallFont.LineSpacing = mizjamSmallFont.LineSpacing + 5;
            whitePixel                      = Content.Load <Texture2D>("whitePixel");
            Textures[0]                     = Content.Load <Texture2D>("colored_packed");
            Textures[1]                     = Content.Load <Texture2D>("colored_transparent_packed");
            Textures[2]                     = Content.Load <Texture2D>("monochrome_packed");
            Textures[3]                     = Content.Load <Texture2D>("monochrome_transparent_packed");
            windowBorder                    = Content.Load <Texture2D>("Textures/WindowBorder");
            Dialogs[Actions.Move]           = Content.Load <Texture2D>("Textures/Dialogs/MoveDialog");
            Dialogs[Actions.Attack]         = Content.Load <Texture2D>("Textures/Dialogs/AttackDialog");
            Dialogs[Actions.Defend]         = Content.Load <Texture2D>("Textures/Dialogs/DefendDialog");
            Dialogs[Actions.Heal]           = Content.Load <Texture2D>("Textures/Dialogs/HealDialog");
            Dialogs[Actions.Reroll]         = Content.Load <Texture2D>("Textures/Dialogs/RerollDialog");
            Dialogs[Actions.Wait]           = Content.Load <Texture2D>("Textures/Dialogs/WaitDialog");
            Dialogs[Actions.Cancel]         = Content.Load <Texture2D>("Textures/Dialogs/CancelDialog");
            SelectedDialogs[Actions.Move]   = Content.Load <Texture2D>("Textures/Dialogs/MoveSelectedDialog");
            SelectedDialogs[Actions.Attack] = Content.Load <Texture2D>("Textures/Dialogs/AttackSelectedDialog");
            SelectedDialogs[Actions.Defend] = Content.Load <Texture2D>("Textures/Dialogs/DefendSelectedDialog");
            SelectedDialogs[Actions.Heal]   = Content.Load <Texture2D>("Textures/Dialogs/HealSelectedDialog");
            SelectedDialogs[Actions.Reroll] = Content.Load <Texture2D>("Textures/Dialogs/RerollSelectedDialog");
            SelectedDialogs[Actions.Wait]   = Content.Load <Texture2D>("Textures/Dialogs/WaitSelectedDialog");
            SelectedDialogs[Actions.Cancel] = Content.Load <Texture2D>("Textures/Dialogs/CancelSelectedDialog");
            TransparentTileSelect           = Content.Load <Texture2D>("Textures/TransparentTileSelect");
            SelectedUnitBorder              = Content.Load <Texture2D>("Textures/SelectedUnitBorder");
            statSlider                      = Content.Load <Texture2D>("Textures/Slider");
            statSliderPin                   = Content.Load <Texture2D>("Textures/SliderPin");
            Dice       = Content.Load <Texture2D>("Textures/Dice");
            RedDice    = Content.Load <Texture2D>("Textures/SolidRedDice");
            BlueDice   = Content.Load <Texture2D>("Textures/SolidBlueDice");
            YellowDice = Content.Load <Texture2D>("Textures/SolidYellowDice");
            LevelStart = Content.Load <Texture2D>("Textures/LevelStartBanner");
            LevelWon   = Content.Load <Texture2D>("Textures/LevelWonBanner");
            LevelLost  = Content.Load <Texture2D>("Textures/LevelLostBanner");
            YourTurn   = Content.Load <Texture2D>("Textures/YourTurnBanner");
            TheirTurn  = Content.Load <Texture2D>("Textures/TheirTurnBanner");
            GameOver   = Content.Load <Texture2D>("Textures/GameOverBanner");
            Congrats   = Content.Load <Texture2D>("Textures/CongratulationsBanner");
            AudioManager.Instance.AddSoundEffect("DiceShake", Content.Load <SoundEffect>("Audio/dieShuffle2"));
            AudioManager.Instance.AddSoundEffect("DiceThrow", Content.Load <SoundEffect>("Audio/diceThrow3"));
            AudioManager.Instance.AddSoundEffect("Hit", Content.Load <SoundEffect>("Audio/footstep_snow_000"));
            AudioManager.Instance.AddSoundEffect("MenuClick", Content.Load <SoundEffect>("Audio/back_003"));
            AudioManager.Instance.AddSoundEffect("Defend", Content.Load <SoundEffect>("Audio/impactMining_003"));
            AudioManager.Instance.AddSoundEffect("Miss", Content.Load <SoundEffect>("Audio/footstep_carpet_001"));
            AudioManager.Instance.AddSoundEffect("Walk", Content.Load <SoundEffect>("Audio/footstep_snow_001"));
            AudioManager.Instance.AddSoundEffect("Death", Content.Load <SoundEffect>("Audio/select_006"));
            AudioManager.Instance.AddSong("Song", Content.Load <Song>("Audio/2019-12-09_-_Retro_Forest_-_David_Fesliyan"));

            string[] levelFiles = Directory.GetFiles("Content/Levels");
            levels = new Level[levelFiles.Length];
            for (int i = 0; i < levelFiles.Length; i++)
            {
                XDocument levelDoc = XDocument.Parse(File.ReadAllText(levelFiles[i]));
                levels[i] = new Level(levelDoc, this);
            }
            currentLevel = levels[0];
            camera       = new Camera(1080, 1080, currentLevel.Width, currentLevel.Height);

            mainMenu = new UIContainer(Point.Zero, new Point(1920, 1080), true);
            UIMenu menu = new UIMenu(Point.Zero, new Point(1000, 600), true)
            {
                Vertical             = true,
                SpaceBetweenChildren = 50
            };
            UILabel startGame = new UILabel("START GAME", mizjamBigFont, Global.Colors.Main1)
            {
                SelectedTextColor = Global.Colors.Accent1
            };

            startGame.AddCommand(new StartGameCommand(this));
            UILabel restartLevel = new UILabel("RESTART LEVEL", mizjamBigFont, Global.Colors.Main1)
            {
                SelectedTextColor = Global.Colors.Accent1
            };

            restartLevel.AddCommand(new RestartLevelCommand(this));

            /*
             * UILabel options = new UILabel("OPTIONS", mizjamBigFont, Global.Colors.Main1) { SelectedTextColor = Global.Colors.Accent1 };
             * options.AddCommand(new OpenOptionsCommand(this));
             */
            UILabel exitGame = new UILabel("EXIT GAME", mizjamBigFont, Global.Colors.Main1)
            {
                SelectedTextColor = Global.Colors.Accent1
            };

            exitGame.AddCommand(new ExitGameCommand(this));

            menu.AddChild(startGame);
            menu.AddChild(restartLevel);
            //menu.AddChild(options);
            menu.AddChild(exitGame);

            mainMenu.AddChild(menu);

            string message = "MADE BY TOURMI\nFOR MIZ GAME JAM 1\nAUDIO ASSETS FROM KENNEY.NL\nSONG RETRO FOREST BY DAVID FESLIYAN";

            bottomLabel          = new UILabel(message, mizjamSmallFont, Global.Colors.Main1);
            bottomLabel.Position = new Point(50, 900);
            string titleText = "ROLL AND DICE";

            title          = new UILabel(titleText, mizjamHugeFont, Global.Colors.Main1);
            title.Position = new Point((1920 - mizjamHugeFont.MeasureString(titleText).ToPoint().X) / 2, 50);
            AudioManager.Instance.SetMusicVolume(0.5f);
            AudioManager.Instance.SetSoundEffectVolume(1f);
            AudioManager.Instance.PlaySong("Song");
        }