public void hardResetSelection(BoardFunctionality boardFunc) { boardFunc.state = State.Regular; selection = new List <Action <MouseState> >(); resetSelectedCard(boardFunc); boardFunc.boardPosLogic.updateBoard(boardFunc); MouseTransformer.Set(MouseTransformer.State.Reg); }
public override void fieldLogic(MouseState mouseState, FunctionalRow row, Card card, BoardFunctionality boardFunc) { if (clickedInCardBox) { if (!row.isWithinModifiedPosition(mouseState, card)) { if (selectAction.TargetEnemyCard(mouseState, boardFunc, false) != null) { MouseTransformer.Set(MouseTransformer.State.Reg); if (selectAction.TargetEnemyCard(mouseState, boardFunc, false).correctRow(boardFunc.enemySide).revealed) { switch (selectAction.TargetEnemyCard(mouseState, boardFunc, false).correctRow(boardFunc.enemySide).type) { case CardType.FieldUnit: boardFunc.Fight(card, selectAction.TargetEnemyCard(mouseState, boardFunc, false)); break; case CardType.Army: if (boardFunc.enemySide.Rows[Side.FieldUnit].isEmpty()) { boardFunc.Fight(card, selectAction.TargetEnemyCard(mouseState, boardFunc, false)); } else if (!boardFunc.enemySide.Rows[Side.FieldUnit].isEmpty()) { boardFunc.BOARDMESSAGE.addMessage("Cannot fight an Army if a FieldUnit is present on the board!"); } break; case CardType.General: boardFunc.BOARDMESSAGE.addMessage("A FieldUnit cannot target a General!"); break; } } } else { MouseTransformer.Set(MouseTransformer.State.Atk); resetIfNoSelection(mouseState, row, card, boardFunc); } } if (mouseState.LeftButton == ButtonState.Released && boardFunc.enemySide.Life.isWithinBox(mouseState)) { if (boardFunc.enemySide.Rows[Side.FieldUnit].isEmpty() && boardFunc.enemySide.Rows[Side.Armies].isEmpty() && boardFunc.enemySide.Rows[Side.Armies].revealed) { boardFunc.LifeDamage(card); } else { boardFunc.BOARDMESSAGE.addMessage("---> or Fog"); boardFunc.BOARDMESSAGE.addMessage("---> an Enemy Army"); boardFunc.BOARDMESSAGE.addMessage("---> an Enemy FieldUnit"); boardFunc.BOARDMESSAGE.addMessage("Cannot deal damage to a player if there's:"); } resetIfNoSelection(mouseState, row, card, boardFunc); } resetIfNoSelection(mouseState, row, card, boardFunc); } }
public override void drawSprite(SpriteBatch spriteBatch) { primaryComponent[controller].drawSprite(spriteBatch); drawSwitcherButtons(spriteBatch); if (fadeScreen.blackScreen.getLoadedTexture() != null) { fadeScreen.drawSprite(spriteBatch); } MouseTransformer.drawMouseTransformer(spriteBatch); }
public virtual void resetIfNoSelection(MouseState mouseState, HorizontalContainer container, Card card, BoardFunctionality boardFunc) { if (!boardFunc.boardActions.isActive() && mouseState.LeftButton == ButtonState.Released && clickedInCardBox && !container.isWithinModifiedPosition(mouseState, card)) { clickedInCardBox = false; card.setRegular(); card.resetCardSelector(); boardFunc.SELECTEDCARD = null; boardFunc.ENEMYSELECTEDCARD = null; boardFunc.boardPosLogic.updateBoard(boardFunc); MouseTransformer.Set(MouseTransformer.State.Reg); } }
//changed from int selector to ability, should work fine. If not can revert back this code to 4/7/2020 on github public void assignAbilityToNextSelection(Card card, Ability ability, BoardFunctionality boardFunc) { Action <MouseState> setSelection = (MouseState mouseState) => { ability.setTarget(); ability.activateAbilityOnSelection(mouseState, boardFunc); if (mouseState.RightButton == ButtonState.Pressed) { MouseTransformer.Set(MouseTransformer.State.Reg); boardFunc.cardViewer.NextSelection(); } }; boardFunc.cardViewer.setSelectionState(setSelection, card, boardFunc); }
public void setSelectionState(Action <MouseState> action, Card card, BoardFunctionality boardFunc) { if (selection == null) { selection = new List <Action <MouseState> >(); } MouseTransformer.Set(MouseTransformer.State.Tgt); boardFunc.state = State.Selection; createButtonsOnView = false; selection.Add(action); //resetSelectedCard(boardFunc); //card.setRegular(); //boardFunc.boardPosLogic.updateBoard(boardFunc); abilityButtons = new List <Button>(); }
public void viewLogic(MouseState mouseState, FunctionalRow row, Card card, BoardFunctionality boardFunc) { if (mouseState.LeftButton == ButtonState.Pressed && row.isWithinModifiedPosition(mouseState, card)) { //card.setPos(mouseState.X - card.getWidth() / 2, mouseState.Y - card.getHeight() / 2); clickedInCardBox = true; } if (mouseState.LeftButton == ButtonState.Released && clickedInCardBox) { if (row.isWithinModifiedPosition(mouseState, card)) { clickedInCardBox = false; boardFunc.state = BoardFunctionality.State.CardView; } clickedInCardBox = false; MouseTransformer.Set(MouseTransformer.State.Reg); } }
public virtual void setTarget() { MouseTransformer.Set(MouseTransformer.State.Tgt); }
public void resetAllCards(BoardFunctionality boardFunc) { resetSide(boardFunc.enemySide); resetSide(boardFunc.friendlySide); MouseTransformer.Set(MouseTransformer.State.Reg); }
public void movementLogic(CardContainer startingContainer, CardContainer endingContainer, Card card, BoardFunctionality boardFunc) { card.makingAction = true; Vector2 newPosition = endingContainer.getEntrancePosition(card); if (newPosition.X > Game1.windowW || newPosition.X < -100) { throw new Exception(endingContainer.getPosition().ToString()); } if (newPosition.Y > Game1.windowH || newPosition.Y < -200) { throw new Exception(endingContainer.getPosition().ToString()); } int timeUntilArrival = 3; int speedX = (int)GameComponent.ToAbsolute((newPosition.X - card.getPosition().X)) / timeUntilArrival; if (speedX < 1) { speedX = 1; } int speedY = (int)GameComponent.ToAbsolute((newPosition.Y - card.getPosition().Y)) / timeUntilArrival; if (speedY < 1) { speedY = 1; } Vector2 adjustingPosition; bool xAxisFinished = false; bool yAxisFinished = false; if (card.getPosition().X < newPosition.X) { adjustingPosition = new Vector2(card.getPosition().X + speedX, card.getPosition().Y); card.setPos(adjustingPosition); } else if (card.getPosition().X > newPosition.X) { adjustingPosition = new Vector2(card.getPosition().X - speedX, card.getPosition().Y); card.setPos(adjustingPosition); } else { xAxisFinished = true; } if (card.getPosition().Y < newPosition.Y) { adjustingPosition = new Vector2(card.getPosition().X, card.getPosition().Y + speedY); card.setPos(adjustingPosition); } else if (card.getPosition().Y > newPosition.Y) { adjustingPosition = new Vector2(card.getPosition().X, card.getPosition().Y - speedY); card.setPos(adjustingPosition); } else { yAxisFinished = true; } if (xAxisFinished && yAxisFinished) { try { startingContainer.moveCard(endingContainer, card); } catch (Exception e) { Console.WriteLine(e); } card.makingAction = false; boardFunc.boardPosLogic.updateBoard(boardFunc); MouseTransformer.Set(MouseTransformer.State.Reg); boardFunc.boardActions.nextAction(); } }
public override void mouseStateLogic(MouseState mouseState, ContentManager content) { primaryComponent[controller].mouseStateLogic(mouseState, content); updateSwitcherMouseLogic(mouseState, content); MouseTransformer.updateMouseTransformerPosition(mouseState); }
public override void initializeGameComponent(ContentManager content) { MouseTransformer.initTextures(content); fadeScreen = new Transition(content); initializePrimaryComponent(content, controller); }