Ejemplo n.º 1
0
        public override void initializeGameComponent(ContentManager content)
        {
            enemyHistoryWindow = new UniqueWindow <GameComponent>(content, 6);
            //newHistory = duplicate(moveHistory);
            //newHistory.type = MoveHistory.Type.Previous;
            enemyHistoryWindow.updateObj(moveHistory);
            enemyHistoryWindow.setPos(Game1.windowW / 2, Game1.windowH / 2);
            historyWindow = new UniqueWindow <GameComponent>(content, 6);
            //historyWindow.setPos(Game1.windowW - GraphicsSettings.toResolution(500), 100);
            historyButton = new UniqueButtonPopper <UniqueWindow <GameComponent>, GameComponent>(content, historyWindow);
            historyButton.setSprite(content, "pastMovesButton");
            historyButton.setButtonText("Past Moves");
            historyButton.wantedScale = .5f;
            historyButton.centerText(historyButton.getWidth() / 2 - GraphicsSettings.toResolution(80), historyButton.getHeight() / 2 - GraphicsSettings.toResolution(40));
            historyButton.updateObj(moveHistory);
            historyButton.setPos(Game1.windowW - GraphicsSettings.toResolution(500), 0);

            historyWindow.setPos(Game1.windowW - GraphicsSettings.toResolution(500), 100);
            UpButton upButton = new UpButton();

            upButton.setTexture(UpButton.texture);
            upButton.setOffset(historyWindow.getWidth(), 0);

            DownButton downButton = new DownButton();

            downButton.setTexture(DownButton.texture);
            downButton.setOffset(historyWindow.getWidth(), upButton.getHeight() * 2);

            LeftButton leftButton = new LeftButton();

            leftButton.setTexture(LeftButton.texture);
            leftButton.setOffset(0, historyWindow.getHeight() / 2);

            RightButton rightButton = new RightButton();

            rightButton.setTexture(RightButton.texture);
            rightButton.setOffset(historyWindow.getWidth(), historyWindow.getHeight() / 2);

            upButton.setAction(() => {
                moveHistory.ScrollUp();
            });
            downButton.setAction(() => {
                moveHistory.ScrollDown();
            });
            rightButton.setAction(() => {
                moveHistory.NextTurn();
            });
            leftButton.setAction(() => {
                moveHistory.PreviousTurn();
            });

            historyWindow.addNewComponent(upButton);
            historyWindow.addNewComponent(downButton);
            historyWindow.addNewComponent(rightButton);
            historyWindow.addNewComponent(leftButton);

            castManuever.setPos(Game1.windowW - GraphicsSettings.toResolution(400), GraphicsSettings.toResolution(200));
            endGamePopup.initializeGameComponent(content);
            rowFog.setSprite(content, "rowNotRevealed");
        }
Ejemplo n.º 2
0
            public override void drawSprite(SpriteBatch spriteBatch)
            {
                int adjustToCenter = GraphicsSettings.toResolution(15);

                move.fromCard.drawSprite(spriteBatch);
                switch (state)
                {
                case State.Attack:
                    move.toCard.drawSprite(spriteBatch);
                    attackIcon.drawSprite(spriteBatch);
                    break;

                case State.SoloAbility:
                    if (move.fromCard.playState != PlayState.Hidden && move.fromCard.cardProps.type != CardType.Manuever)
                    {
                        spriteBatch.DrawString(Game1.spritefont, move.ability.exchangeValue.ToString(), new Vector2(move.fromCard.getPosition().X + move.fromCard.getWidth() / 2 - adjustToCenter, move.fromCard.getPosition().Y + move.fromCard.getHeight() / 2 - adjustToCenter), Color.White, 0, new Vector2(0, 0), getScale(), SpriteEffects.None, 0);
                    }
                    castIcon.drawSprite(spriteBatch);
                    break;

                case State.TargetAbility:

                    move.toCard.drawSprite(spriteBatch);
                    if (move.fromCard.cardProps.type != CardType.Manuever)
                    {
                        spriteBatch.DrawString(Game1.spritefont, move.ability.exchangeValue.ToString(), new Vector2(move.fromCard.getPosition().X + move.fromCard.getWidth() / 2 - adjustToCenter, move.fromCard.getPosition().Y + move.fromCard.getHeight() / 2 - adjustToCenter), Color.White, 0, new Vector2(0, 0), getScale(), SpriteEffects.None, 0);
                    }
                    targetIcon.drawSprite(spriteBatch);
                    break;

                case State.PlayCard:
                    playIcon.drawSprite(spriteBatch);
                    break;
                }
            }
Ejemplo n.º 3
0
        public int getWidthOfCardInContainer(Card card)
        {
            int multiplier  = cardsInContainer.IndexOf(card);
            int initialPosX = (int)getPosition().X + GraphicsSettings.toResolution(spacing);
            int finalPosX   = initialPosX + multiplier * card.getWidth() + (card.getWidth() - horizontalSpacing);

            return(finalPosX);
        }
Ejemplo n.º 4
0
        private void setPortraitWidgetPositions()
        {
            int yPos = GraphicsSettings.toResolution(100);
            int xPos = Game1.windowW - board.portraitWidgets[enemy].getWidth();

            board.portraitWidgets[enemy].setPos(xPos, yPos);
            board.portraitWidgets[friendly].setPos(xPos, Game1.windowH - yPos - board.portraitWidgets[enemy].getHeight());
        }
Ejemplo n.º 5
0
        public Vector2 newCardPositionInContainer(Card card)
        {
            int     multiplier  = Count();
            int     initialPosX = (int)getPosition().X + GraphicsSettings.toResolution(spacing);
            int     finalPosX   = initialPosX + multiplier * ((int)trueContainerWidth(card) - horizontalSpacing);
            Vector2 newPos      = new Vector2(finalPosX, getPosition().Y);

            return(newPos);
        }
Ejemplo n.º 6
0
        private void setHandSpacePositions()
        {
            int xPos = GraphicsSettings.toResolution(200);
            int yPos = Game1.windowH - board.handSpace[0].getHeight() / 2;

            board.handSpace[enemy].setPos(xPos, GraphicsSettings.toResolution(-120));
            board.handSpace[enemy].properties.spriteEffects = SpriteEffects.FlipVertically;
            board.handSpace[friendly].setPos(xPos, yPos);
            board.handSpace[friendly].initializeGameComponent();
        }
Ejemplo n.º 7
0
        public Vector2 getPositionOfCardInContainer(Card card)
        {
            int initialPosX = (int)getPosition().X + GraphicsSettings.toResolution(spacing);
            int initialPosY = (int)getPosition().Y + GraphicsSettings.toResolution(spacing);
            int multiplier  = cardsInContainer.IndexOf(card);
            //throw new Exception(multiplier.ToString());
            int finalPosX = initialPosX + multiplier * (card.getWidth() - horizontalSpacing);
            int finalPosY = initialPosY;

            Vector2 returnValue = new Vector2(finalPosX, finalPosY);

            return(returnValue);
        }
Ejemplo n.º 8
0
        public void adjustSettingsOnStartup(GraphicsDeviceManager graphics)
        {
            GraphicsSettings.currentResolution = settings.settings["Resolution"];

            Game1.windowH = graphics.PreferredBackBufferHeight = (int)GraphicsSettings.resolutions[GraphicsSettings.currentResolution].Y;
            Game1.windowW = graphics.PreferredBackBufferWidth = (int)GraphicsSettings.resolutions[GraphicsSettings.currentResolution].X;

            Properties.globalScale = GraphicsSettings.trueGameScale(GraphicsSettings.resolutions[GraphicsSettings.currentResolution]);
            loadFullScreen(graphics);

            GraphicsSettings.correctResolutionForMonitor();
            graphics.HardwareModeSwitch = false;
            graphics.ApplyChanges();
        }
Ejemplo n.º 9
0
        private void initButtons(ContentManager content)
        {
            int offSet = GraphicsSettings.toResolution(100);

            button = new Button(content, new Vector2(Game1.windowW - offSet, Game1.windowH / 2 + offSet), "secondButtonTexture");
            button.setPos(new Vector2(Game1.windowW - offSet - button.getWidth(), Game1.windowH / 2 + offSet));
            button.setButtonText("END");
            button.setAction(() => { friendlySide.boardFunc.PassTurn(); });

            switcherButtons = new List <SwitcherButton>();
            switcherButtons.Add(new SwitcherButton(content, new Vector2(0, 0), "exitImage", 1));
            int switcherButtonPosX = Game1.windowW - switcherButtons[0].getWidth();

            switcherButtons[0].setPos(switcherButtonPosX, 0);
        }
Ejemplo n.º 10
0
        private void setUpCard(Card card)
        {
            boardPosLogic.updateBoard(this);
            Card fromCard = duplicate(card);
            int  xpos     = 50 + GraphicsSettings.toResolution(600);
            int  ypos     = Game1.windowH / 2 - fromCard.getWidth() * 2;

            fromCard.setPos(xpos - fromCard.getWidth(), ypos);
            boardPosLogic.scaleToHand(fromCard);
            fromCard.setRegular();

            showEnemyCard = true;
            returnCardToRegular(card);
            cardFightDrawer.Add(fromCard);
        }
Ejemplo n.º 11
0
        private void setHolderPositions()
        {
            int borderOffset = GraphicsSettings.toResolution(60);
            int yOffset      = borderOffset;
            int xPos         = borderOffset * 2 + board.rows[enemy].getWidth();

            board.deckHolder[enemy].setPos(xPos, yOffset);
            board.deckHolder[friendly].setPos(xPos, Game1.windowH - board.deckHolder[friendly].getHeight() - yOffset);

            int newXPOS = xPos + borderOffset + board.oblivionHolder[0].getWidth();

            //int newYPOS = borderOffset * 4;
            //int newYPOS = board.deckHolder[ene]
            board.oblivionHolder[enemy].setPos(newXPOS, yOffset);
            board.oblivionHolder[friendly].setPos(newXPOS, Game1.windowH - board.deckHolder[friendly].getHeight() - yOffset);
        }
Ejemplo n.º 12
0
        public void adjustPositionsInCollection(List <Section> turns)
        {
            int counter = 0;
            int spacing = GraphicsSettings.toResolution(150);
            int xOffset = GraphicsSettings.toResolution(25);

            foreach (Section section in turns)
            {
                section.setPos((int)getPosition().X + xOffset, (int)getPosition().Y + counter * spacing);
                section.updateGameComponent();
                counter++;
                if (counter > 3)
                {
                    counter = 0;
                }
            }
        }
Ejemplo n.º 13
0
 private void updateAllResolutionValues(GraphicsDeviceManager graphics)
 {
     /*if(!graphics.IsFullScreen)
      * {
      *  GraphicsSettings.currentResolution = GraphicsSettings.highestRes;
      * }
      * else
      * {
      *  GraphicsSettings.currentResolution = settings["Resolution"];
      * }*/
     //Properties.globalScale = GraphicsSettings.trueGameScale(GraphicsSettings.resolutions[GraphicsSettings.currentResolution]);
     //GraphicsSettings.correctResolutionForMonitor();
     graphics.PreferredBackBufferHeight = (int)GraphicsSettings.resolutions[GraphicsSettings.currentResolution].Y;
     graphics.PreferredBackBufferWidth  = (int)GraphicsSettings.resolutions[GraphicsSettings.currentResolution].X;
     Properties.globalScale             = GraphicsSettings.trueGameScale(GraphicsSettings.resolutions[GraphicsSettings.currentResolution]);
     setButtonPositions();
 }
Ejemplo n.º 14
0
        private void setRowPositions()
        {
            int changingYPOS = 0;
            int borderOffset = GraphicsSettings.toResolution(50);
            int staticXPOS   = GraphicsSettings.toResolution(60);

            for (int i = 0; i < 3; i++)
            {
                changingYPOS = borderOffset + i * board.rows[i].getHeight();
                board.rows[i].setPos(staticXPOS, changingYPOS);
            }
            for (int i = 0; i < 3; i++)
            {
                int selector = 3 + i;
                changingYPOS = Game1.windowH - borderOffset - board.rows[selector].getHeight() - i * board.rows[selector].getHeight();
                board.rows[selector].setPos(staticXPOS, changingYPOS);
            }
        }
Ejemplo n.º 15
0
        private void setHandPositions(Side side)
        {
            int counter = 0;
            int spacing = 20;

            side.Hand.resetCardSpacingInHorizontalContainer();
            foreach (Card card in side.Hand.cardsInContainer)
            {
                if (card != SELECTEDCARD && !card.makingAction)
                {
                    scaleToHand(card);
                    card.resetCardSelector();
                    Vector2 newPosition = new Vector2(side.Hand.getPosition().X + GraphicsSettings.toResolution(spacing) + counter * (card.getWidth() - side.Hand.horizontalSpacing), side.Hand.getPosition().Y);
                    card.setPos(newPosition);
                }

                counter++;
            }
        }
Ejemplo n.º 16
0
        private void setTokens(ContentManager content)
        {
            int startingPosX = GraphicsSettings.toResolution(200) + (int)board.rows[5].getPosition().X + board.rows[5].getWidth() + GraphicsSettings.toResolution(50);
            int yPos         = (int)board.rows[5].getPosition().Y - GraphicsSettings.toResolution(40);

            board.unanimousToken.setSprite(content, "unanimousToken");
            board.unanimousToken.setPos(startingPosX, yPos);

            startingPosX += GraphicsSettings.toResolution(100);
            board.elfToken.setSprite(content, "elfToken");
            board.elfToken.setPos(startingPosX, yPos);

            startingPosX += GraphicsSettings.toResolution(100);
            board.orcToken.setSprite(content, "orcToken");
            board.orcToken.setPos(startingPosX, yPos);

            startingPosX += GraphicsSettings.toResolution(100);
            board.humanToken.setSprite(content, "humanToken");
            board.humanToken.setPos(startingPosX, yPos);
        }
Ejemplo n.º 17
0
        public void setButtonPositions()
        {
            Button tempButton      = buttons[0];
            int    counter         = 0;
            int    buttonPositionX = GraphicsSettings.realScreenWidth() / 2 - tempButton.getWidth() / 2;
            int    buttonPositionY = counter * tempButton.getHeight() + tempButton.getHeight() / 3;

            switcherButtons[0].setPos(new Vector2(buttonPositionX, buttonPositionY));
            switcherButtons[0].setButtonText("Main Menu");
            counter++;
            buttonPositionY = counter * tempButton.getHeight() + tempButton.getHeight() / 3;
            buttons[0].setButtonText("Toggle Fullscreen");
            buttons[0].setPos(new Vector2(buttonPositionX, buttonPositionY));
            counter++;
            buttonPositionY = counter * tempButton.getHeight() + tempButton.getHeight() / 3;
            setResolutionText();
            buttons[1].setPos(new Vector2(buttonPositionX, buttonPositionY));

            buttonPositionY = counter * tempButton.getHeight() + tempButton.getHeight() / 3;
            buttons[2].setButtonText("Apply changes on startup");
            buttons[2].setPos(new Vector2(buttonPositionX + tempButton.getWidth(), buttonPositionY));
        }
Ejemplo n.º 18
0
        public virtual void setButtons(ContentManager content)
        {
            string imgSrc          = "menuButton";
            Button tempButton      = new Button(content, new Vector2(0, 0), imgSrc);
            int    counter         = 0;
            int    buttonPositionX = GraphicsSettings.realScreenWidth() / 2 - tempButton.getWidth() / 2;
            int    buttonPositionY = counter * tempButton.getHeight() + tempButton.getHeight() / 3;

            buttons = new List <Button>();

            switcherButtons.Add(new SwitcherButton(content, new Vector2(buttonPositionX, buttonPositionY), imgSrc, 2));
            switcherButtons[0].setButtonText("GAME");
            counter++;
            buttonPositionY = counter * tempButton.getHeight() + tempButton.getHeight() / 3;
            switcherButtons.Add(new SwitcherButton(content, new Vector2(buttonPositionX, buttonPositionY), imgSrc, 0));
            switcherButtons[1].setButtonText("TO SETTINGS");
            counter++;
            buttonPositionY = counter * tempButton.getHeight() + tempButton.getHeight() / 3;
            buttons.Add(new Button(content, new Vector2(buttonPositionX, buttonPositionY), imgSrc));
            buttons[0].setAction();
            buttons[0].setButtonText("Exit");
        }
Ejemplo n.º 19
0
        public override void drawSprite(SpriteBatch spriteBatch)
        {
            int counter = 0;

            for (int i = advancer; i < advancer + correctIterationDown(upDownIterator); i++)
            {
                getCurrentList()[i].drawSprite(spriteBatch);
                counter++;
            }
            if (counter == 0)
            {
                int offset = GraphicsSettings.toResolution(20);
                spriteBatch.DrawString(Game1.spritefont, "0 moves", new Vector2(getPosition().X + offset, getPosition().Y + offset), Color.Black);
            }

            if (type == Type.Current)
            {
                int offset = GraphicsSettings.toResolution(20);
                spriteBatch.DrawString(Game1.spritefont, "Current turn", new Vector2(getPosition().X, getPosition().Y - offset * 5), Color.Black * .5f);
            }
            else
            {
                string whoseTurn = "not loaded";
                if (selector == 0)
                {
                    whoseTurn = "My turn";
                }
                if (selector % 2 == 0)
                {
                    whoseTurn = "My turn";
                }
                else
                {
                    whoseTurn = "Enemy turn";
                }
                int offset = GraphicsSettings.toResolution(20);
                spriteBatch.DrawString(Game1.spritefont, whoseTurn, new Vector2(getPosition().X, getPosition().Y - offset * 5), Color.Black * .5f);
            }
        }
Ejemplo n.º 20
0
        private void setLifeTotalPositions()
        {
            int startingPosX = (int)board.rows[5].getPosition().X + board.rows[5].getWidth() + GraphicsSettings.toResolution(50);
            int yPos         = (int)(board.rows[2].getPosition().Y + board.rows[2].getHeight() - board.lifeTotal[enemy].getHeight());

            board.lifeTotal[enemy].setPos(startingPosX, yPos);
            board.lifeTotal[enemy].properties.spriteEffects = SpriteEffects.FlipVertically;

            int otherYPos = Game1.windowH - board.lifeTotal[friendly].getHeight() - yPos;

            yPos = Game1.windowH - board.lifeTotal[friendly].getHeight();
            board.lifeTotal[friendly].setPos(startingPosX, otherYPos);
        }