private void DrawRatingStars() { var rating = _activeLevel.CurrentSentenceRating; if (rating == 0) { const float ratingStarYOffset = 0.3f; const float ratingStarSize = 0.1f; const float ratingStarSpacing = 0.02f; var totalWidth = ratingStarSize * rating + (rating - 1) * ratingStarSpacing; var currentX = (VirtualCoords.RELATIVE_MAX.X - totalWidth) * 0.5f; for (int i = 0; i < rating; ++i) { currentX += ratingStarSize * 0.5f; _spriteBatch.Draw(StyleSheet.StarTexture, destinationRectangle: VirtualCoords.ComputePixelRect_Centered(new Vector2(currentX, ratingStarYOffset), ratingStarSize), Color.LightYellow); currentX += ratingStarSize * 0.5f + ratingStarSpacing; } } var text = rating switch { 0 => "Are you sure? Try again!", 1 => "Better than before, but not good enough!", 2 => "Pretty good, on to the next level", 3 => "Excellent", _ => "" }; var centerPos = new Vector2(0.8f, 0.8f); _spriteBatch.DrawString(StyleSheet.DefaultFont, text: text, position: VirtualCoords.ComputePixelPosition(centerPos), color: Color.White, rotation: 0.0f, origin: StyleSheet.DefaultFont.MeasureString(text) * 0.5f, scale: VirtualCoords.ComputePixelScale(StyleSheet.ScalingFontToWorld), effects: SpriteEffects.None, layerDepth: 0.0f); }
public void Draw(SpriteBatch spriteBatch, float swipeErrorAllowedPercentage, bool showPlayButton) { var area = DrawArea(); for (var index = 0; index < Math.Min(sparcles.Count, sparcles.Count * swipeErrorAllowedPercentage + 0.5f); index++) { var sparcle = sparcles[index]; spriteBatch.Draw(StyleSheet.DotTexture, VirtualCoords.ComputePixelRect_Centered(sparcle.Position, sparcle.Size), sparcle.Color); } //spriteBatch.Draw(StyleSheet.ShootingTailTexture, area, Color.White * swipeErrorAllowedPercentage); spriteBatch.Draw(StyleSheet.ShootingStarTexture, destinationRectangle: area, Color.White); if (showPlayButton && swipeErrorAllowedPercentage > 0.0f) { spriteBatch.Draw(StyleSheet.ShootingButtonTexture, destinationRectangle: area, Color.DarkGreen); } }