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; } }
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"); }
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()); }
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); }
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); }
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(); }
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); }
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); }
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); }
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); }
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; } } }
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); } }
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++; } }
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); }
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); } }
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); }