예제 #1
0
        public override void Initialize()
        {
            /* TODO: (low) Implement proper initializer for all the cards/decks
             * Init the background
             * Init two decks (Load an XML file with data on each card from folders "Decks\Player1" and "Decks\Player2")
             * Init controls (buttons, etc)
             * Init Labels (damage counters, energy card symbols, card zones, etc)
             * Init starting gameplayStage
             */

            interfaceSpriteBatch = new SpriteBatch(currentGame.GraphicsDevice);
            finalSpriteBatch     = new SpriteBatch(currentGame.GraphicsDevice);

            Player1 = new NPlayer(1, currentGame);
            Player2 = new NPlayer(2, currentGame);

            // Build the players' decks
            DeckBuilder builder = new DeckBuilder(GameConstants.PATH_PLAYER1DECK, currentGame);

            builder.ImportDeck();
            Player1.PlayerDeck          = builder.ToDeck();
            Player1.PlayerDeck.Position = new Vector2(1489, 607);
            Player1.PlayerDeck.Shuffle();

            builder.DeckPath = GameConstants.PATH_PLAYER2DECK;
            builder.ImportDeck();
            Player2.PlayerDeck          = builder.ToDeck();
            Player2.PlayerDeck.Position = new Vector2(30, 178);
            Player2.PlayerDeck.Shuffle();

            // Init the players' hands
            Player1.PlayerHand.Position = new Vector2(15, 650);
            Player2.PlayerHand.Position = new Vector2(850, 30);

            // Init buttons
            drawCardButtonP1 = new Button("DrawButton", new Vector2(1355, 632), true, currentGame);
            chatBox          = new TextBoxMulti("Enter chat", new Vector2((int)(GameConstants.SCREEN_WIDTH - (GameConstants.SCREEN_WIDTH * 0.005) - 450),
                                                                          (int)(GameConstants.SCREEN_HEIGHT / 2) - 61), currentGame);

            // Populate the OnScreenElements list
            OnScreenElements = new List <IClickable>();
            OnScreenElements.Add(drawCardButtonP1);
            OnScreenElements.Add(chatBox);
            foreach (Card c in Player1.PlayerDeck)
            {
                OnScreenElements.Add(c);
            }
            foreach (Card c in Player2.PlayerDeck)
            {
                OnScreenElements.Add(c);
            }

            currentInputEvent = InputEvent.None;
            keyboardHandler   = new KeyboardHandler(currentGame);
        }