Exemple #1
0
        public PopupScreen(Game game, Character character)
        {
            cursor = (Cursor)game.Services.GetService(typeof(Cursor));
            playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
            screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));

            selectedChar = character;
            selectScreen = new SelectScreen(game, character);
            screenManager.AddScreen(selectScreen, null);

            const string usageText = "A: Move" + "\nX: Attack" + "\nStart: End Turn" + "\nB: Cancel";
            this.message = message + usageText;
            if (selectedChar == null)
            {
                this.message = "Start: End Turn" + "\nB: Cancel";
            }
            else if (selectedChar.CharType == "champion")
            {
                this.message += "\nY: Buy Mercenary";
            }
            IsPopup = true;

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);

                menuMove = new InputAction(
                    new Buttons[] { Buttons.A },
                    new Keys[] { Keys.A },
                    true);
                menuAttack = new InputAction(
                    new Buttons[] { Buttons.X, },
                    new Keys[] { Keys.X },
                    true);
                menuCancel = new InputAction(
                    new Buttons[] { Buttons.B, },
                    new Keys[] { Keys.B },
                    true);
                menuEndTurn = new InputAction(
                    new Buttons[] { Buttons.Start, },
                    new Keys[] { Keys.Enter },
                    true);
                menuBuy = new InputAction(
                    new Buttons[] { Buttons.Y, },
                    new Keys[] { Keys.Y },
                    true);
        }
Exemple #2
0
        public BuyScreen(Game game, Character character)
            : base("Hire a Mercenary")
        {
            cursor = (Cursor)game.Services.GetService(typeof(Cursor));
            playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            charList = (List<Character>)game.Services.GetService(typeof(List<Character>));
            screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
            champion = character;
            this.game = game;

            MenuEntry buyKnight = new MenuEntry("Hire Knight, Cost: 100");
            MenuEntry buyRanger = new MenuEntry("Hire Ranger, Cost: 100");
            MenuEntry buyBarbarian = new MenuEntry("Hire Barbarian, Cost: 100");
            MenuEntry buyMage = new MenuEntry("Hire Mage, Cost: 150");
            MenuEntry buyPriest = new MenuEntry("Hire Spirit Priest, Cost: 150");
            MenuEntry cancel = new MenuEntry("Cancel");
            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));

            gameStateManager.State = GameState.buying;
            // Hook up menu event handlers.
            buyKnight.Selected += buyKnightSelected;
            buyRanger.Selected += buyRangerSelected;
            buyBarbarian.Selected += buyBarbarianSelected;
            buyMage.Selected += buyMageSelected;
            buyPriest.Selected += buyPriestSelected;
            cancel.Selected += cancelSelected;

            // Add entries to the menu.
            MenuEntries.Add(buyKnight);
            MenuEntries.Add(buyRanger);
            MenuEntries.Add(buyBarbarian);
            MenuEntries.Add(buyMage);
            MenuEntries.Add(buyPriest);
            MenuEntries.Add(cancel);

            /*if (aiFlag == true)
            {
                BuyRandom();
            }*/
        }
Exemple #3
0
 public void LoadCursor(Game game)
 {
     cursor = (Cursor)game.Services.GetService(typeof(Cursor));
 }
Exemple #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            grass = Content.Load<Texture2D>("grass");
            dirt = Content.Load<Texture2D>("dirt");
            square = Content.Load<Texture2D>("empty_square");
            buyScreenBackground = Content.Load<Texture2D>("buyBackground");
            background = Content.Load<Texture2D>("empire");
            victoryBackground = Content.Load<Texture2D>("victory");
            victorySong = Content.Load<SoundEffect>("FF7_victory");
            bgm = Content.Load<SoundEffect>("guiles_theme");
            bgmInstance = bgm.CreateInstance();
            bgmInstance.IsLooped = true;
            bgmInstance.Play();

            map = new BattleMap(this, 10,10);
            map.RandomMap();
            Services.AddService(typeof(BattleMap), map);

            MercenaryCamp camp = new MercenaryCamp(this, 6,1);
            MercenaryCamp camp2 = new MercenaryCamp(this, 2, 8);
            Character champ = new ChampionOne(this, 2, 1, 1);
            Character champ2 = new ChampionOne(this, 5, 8, 2);
            Cursor cursor = new Cursor(this);

            Components.Add(camp);
            Components.Add(camp2);
            Components.Add(champ);
            Components.Add(champ2);
            Components.Add(cursor);
            charList.Add(champ);
            charList.Add(champ2);
            charList.Add(camp);
            charList.Add(camp2);

            Services.AddService(typeof(Cursor), cursor);

            /*OpponentAI  ai= new OpponentAI(this);
            Components.Add(ai);
            ai.LoadCursor(this);

            Services.AddService(typeof(OpponentAI), ai);
            PlayerManager tempRef = (PlayerManager)Services.GetService(typeof(PlayerManager));
            tempRef.LoadAI(this);*/

            turnDisplay = new Vector2(map.getWidth() * 60, 50);

            base.LoadContent();
        }