public void Draw(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, Rectangle clientBounds) { graphicsDevice.SetRenderTarget(renderTarget); graphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin( transformMatrix: camera.GetViewMatrix(), samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend, sortMode: SpriteSortMode.Immediate); mapRenderer.Draw(camera.GetViewMatrix()); spriteBatch.End(); if (IsMyTurn) { spriteBatch.Begin( transformMatrix: camera.GetViewMatrix(), samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend, sortMode: SpriteSortMode.Texture); if (selectedCharacter != null && selectedCard == null && movingPoint == null) { data.Characters.SingleOrDefault(character => character == selectedCharacter && character.HasRemainingMoves && character.OwnerPlayerId == data.GetPlayerId())?.DrawMovementRange(spriteBatch); } else if (selectedCard != null && targetingPoint == null) { selectedCard.DrawEffectRange(spriteBatch); } else if (movingPoint != null) { var movingPointScreen = movingPoint.GetScreenPosition(); var distanceOverlay = content.DistanceOverlay; spriteBatch.Draw(distanceOverlay, new Rectangle((int)movingPointScreen.X - MapPoint.TileWidth_Half, (int)movingPointScreen.Y, distanceOverlay.Width, distanceOverlay.Height), Color.DarkGreen * 0.5f); } else if (targetingPoint != null) { var targetingPointScreen = targetingPoint.GetScreenPosition(); var distanceOverlay = content.DistanceOverlay; spriteBatch.Draw(distanceOverlay, new Rectangle((int)targetingPointScreen.X - MapPoint.TileWidth_Half, (int)targetingPointScreen.Y, distanceOverlay.Width, distanceOverlay.Height), Color.DarkBlue * 0.5f); } spriteBatch.End(); } Effect effectForDrawable(IDrawable drawable) { return(!(drawable is Character character) ? null : character == selectedCharacter ? content.Highlight : character.ActivatedThisRound ? content.Shade : null); } Effect currentEffect = null; var startedSpriteBatch = false; foreach (var drawable in entities.Drawables) { var characterEffect = effectForDrawable(drawable); if (!startedSpriteBatch || currentEffect != characterEffect) { if (startedSpriteBatch) { spriteBatch.End(); } spriteBatch.Begin( transformMatrix: camera.GetViewMatrix(), samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend, effect: characterEffect); currentEffect = characterEffect; startedSpriteBatch = true; } if (drawable == lockedInCharacter) { lockedInCharacter.DrawLock(spriteBatch); } drawable.DrawWithEffect(spriteBatch); } spriteBatch.End(); spriteBatch.Begin( transformMatrix: camera.GetViewMatrix(), samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend, sortMode: SpriteSortMode.Texture); foreach (var drawable in entities.Drawables) { drawable.DrawWithoutEffect(spriteBatch); } spriteBatch.End(); // Draw a characters hand of cards if player is playing that side if (selectedCharacter != null && selectedCharacter.OwnerPlayerId == data.GetPlayerId()) { handOfCards.Draw(spriteBatch, clientBounds, selectedCharacter.CurrentHand, selectedCard); } // Draw UI spriteBatch.Begin(); if (IsMyTurn) { endTurnButton.X = playerSidePanel.Width + (2 * gridSpacing); endTurnButton.Draw(spriteBatch); } statusPanel.X = graphicsDevice.PresentationParameters.BackBufferWidth - statusPanel.MeasureContent().X - (2 * gridSpacing); statusPanel.Draw(spriteBatch); playerSidePanel.Draw(spriteBatch); if (data.IsTestMode) { winGameNowButton.X = endTurnButton.Width + playerSidePanel.Width + (3 * gridSpacing); winGameNowButton.Draw(spriteBatch); } gameLogPanel.Y = endTurnButton.Height + (2 * gridSpacing); gameLogPanel.Draw(spriteBatch); if (selectedCharacter != null) { selectedPlayerStatsPanel.X = gameLogPanel.Width + (2 * gridSpacing); selectedPlayerStatsPanel.Y = endTurnButton.Height + (2 * gridSpacing); selectedPlayerStatsPanel.Draw(spriteBatch); } if (showGameLogEntryPanel) { heldGameLogEntryPanel.Draw(spriteBatch); } if (showAppliedConditionDetailsPanel) { appliedConditionDetailsPanel.Draw(spriteBatch); } spriteBatch.End(); graphicsDevice.SetRenderTarget(null); spriteBatch.Begin(); spriteBatch.Draw(renderTarget, Vector2.Zero, Color.White); spriteBatch.End(); }
public void Draw(int amount) { hand.Draw(amount, deck); }