protected virtual bool IsStateValid(CellState state, DrawMode mode) { if (mode == DrawMode.None) { return(false); } if (mode == DrawMode.All) { return(true); } if ((state.HasFlag(CellState.Walkable) || state.HasFlag(CellState.NonWalkable)) && mode.HasFlag(DrawMode.Movements)) { return(true); } if ((state.HasFlag(CellState.BluePlacement) || state.HasFlag(CellState.RedPlacement)) && mode.HasFlag(DrawMode.Fights)) { return(true); } if (state.HasFlag(CellState.Trigger) && mode.HasFlag(DrawMode.Triggers)) { return(true); } if (state.HasFlag(CellState.Road) && mode.HasFlag(DrawMode.Others)) { return(true); } return(false); }
public static void Draw(DrawMode drawMode, SpriteBatch spriteBatch, Vector2 position, float baseScale) { bool coop = RetroGame.NUM_PLAYERS == 2; spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, TITLE_TEXT, position, Color.Black, 0, Vector2.Zero, TITLE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += 42; if (drawMode.HasFlag(DrawMode.Solo)) { spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, SOLO_TEXT, position, Color.Black, 0, Vector2.Zero, SUBTITLE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += SUBTITLE_GAP; spriteBatch.Draw(RetroGame.PIXEL, new Rectangle((int)position.X, (int)position.Y, (int)(CHART_WIDTH * baseScale), (int)(CHART_LINE_HEIGHT * baseScale)), Color.Black); position.Y += GAP_BEFORE_SOLO * baseScale; for (int i = 0; i < HIGHSCORE_COUNT; i++) { spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresSolo[i].id.ToString("0000") + " " + highscoresSolo[i].name, position, highscoresSolo[i].color.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, 0.75f * baseScale, SpriteEffects.None, 0); string scoreString = highscoresSolo[i].score.ToString(SCORE_FORMAT); Vector2 scoreDims = RetroGame.FONT_PIXEL_SMALL.MeasureString(scoreString); Color scoreColor = (!coop && currentHighscorePosition == i) ? currentHighscoreColor : Color.Black; spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, highscoresSolo[i].score.ToString(SCORE_FORMAT), new Vector2(position.X + (CHART_WIDTH * baseScale), position.Y), scoreColor, 0, scoreDims * new Vector2(1, 0.5f), SCORE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += SCORE_GAP; } position.Y -= SCORE_GAP; position.Y += GAP_TO_COOP * baseScale; } if (drawMode.HasFlag(DrawMode.Coop)) { spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, COOP_TEXT, position, Color.Black, 0, Vector2.Zero, SUBTITLE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += SUBTITLE_GAP; spriteBatch.Draw(RetroGame.PIXEL, new Rectangle((int)position.X, (int)position.Y, (int)(CHART_WIDTH * baseScale), (int)(CHART_LINE_HEIGHT * baseScale)), Color.Black); position.Y += GAP_BEFORE_COOP * baseScale; for (int i = 0; i < HIGHSCORE_COUNT; i++) { spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresCoop[i].id1.ToString("0000") + " " + highscoresCoop[i].name1, position + (OFFSET_P1 * baseScale), highscoresCoop[i].color1.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, NAME_SCALE_COOP * baseScale, SpriteEffects.None, 0); spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresCoop[i].id2.ToString("0000") + " " + highscoresCoop[i].name2, position + (OFFSET_P2 * baseScale), highscoresCoop[i].color2.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, NAME_SCALE_COOP * baseScale, SpriteEffects.None, 0); string scoreString = highscoresCoop[i].score.ToString(SCORE_FORMAT); Vector2 scoreDims = RetroGame.FONT_PIXEL_SMALL.MeasureString(scoreString); Color scoreColor = (coop && currentHighscorePosition == i) ? currentHighscoreColor : Color.Black; spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, highscoresCoop[i].score.ToString(SCORE_FORMAT), new Vector2(position.X + (CHART_WIDTH * baseScale), position.Y), scoreColor, 0, scoreDims * new Vector2(1, 0.5f), SCORE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += SCORE_GAP; } } }
public static void Draw(DrawMode drawMode, SpriteBatch spriteBatch, Vector2 position, float baseScale) { bool coop = RetroGame.NUM_PLAYERS == 2; spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, TITLE_TEXT, position, Color.Black, 0, Vector2.Zero, TITLE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += 42; if (drawMode.HasFlag(DrawMode.Solo)) { spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, SOLO_TEXT, position, Color.Black, 0, Vector2.Zero, SUBTITLE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += SUBTITLE_GAP; spriteBatch.Draw(RetroGame.PIXEL, new Rectangle((int)position.X, (int)position.Y, (int)(CHART_WIDTH * baseScale), (int)(CHART_LINE_HEIGHT * baseScale)), Color.Black); position.Y += GAP_BEFORE_SOLO * baseScale; for (int i = 0; i < HIGHSCORE_COUNT; i++) { spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresSolo[i].id.ToString("0000") + " " + highscoresSolo[i].name, position, highscoresSolo[i].color.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, 0.75f * baseScale, SpriteEffects.None, 0); string scoreString = highscoresSolo[i].score.ToString(SCORE_FORMAT); Vector2 scoreDims = RetroGame.FONT_PIXEL_SMALL.MeasureString(scoreString); Color scoreColor = (!coop && currentHighscorePosition == i) ? currentHighscoreColor : Color.Black; spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, highscoresSolo[i].score.ToString(SCORE_FORMAT), new Vector2(position.X + (CHART_WIDTH * baseScale), position.Y), scoreColor, 0, scoreDims * new Vector2(1, 0.5f), SCORE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += SCORE_GAP; } position.Y -= SCORE_GAP; position.Y += GAP_TO_COOP * baseScale; } if (drawMode.HasFlag(DrawMode.Coop)) { spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, COOP_TEXT, position, Color.Black, 0, Vector2.Zero, SUBTITLE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += SUBTITLE_GAP; spriteBatch.Draw(RetroGame.PIXEL, new Rectangle((int)position.X, (int)position.Y, (int)(CHART_WIDTH * baseScale), (int)(CHART_LINE_HEIGHT * baseScale)), Color.Black); position.Y += GAP_BEFORE_COOP * baseScale; for (int i = 0; i < HIGHSCORE_COUNT; i++) { spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresCoop[i].id1.ToString("0000") + " " + highscoresCoop[i].name1, position + (OFFSET_P1 * baseScale), highscoresCoop[i].color1.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, NAME_SCALE_COOP * baseScale, SpriteEffects.None, 0); spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresCoop[i].id2.ToString("0000") + " " + highscoresCoop[i].name2, position + (OFFSET_P2 * baseScale), highscoresCoop[i].color2.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, NAME_SCALE_COOP * baseScale, SpriteEffects.None, 0); string scoreString = highscoresCoop[i].score.ToString(SCORE_FORMAT); Vector2 scoreDims = RetroGame.FONT_PIXEL_SMALL.MeasureString(scoreString); Color scoreColor = (coop && currentHighscorePosition == i) ? currentHighscoreColor : Color.Black; spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, highscoresCoop[i].score.ToString(SCORE_FORMAT), new Vector2(position.X + (CHART_WIDTH * baseScale), position.Y), scoreColor, 0, scoreDims * new Vector2(1, 0.5f), SCORE_SCALE * baseScale, SpriteEffects.None, 0); position.Y += SCORE_GAP; } } }
public static bool MixColor(this DrawMode mode) => mode.HasFlag(DrawMode.MixColor);
public static bool IntersectExclude(this DrawMode mode) => mode.HasFlag(DrawMode.IntersectExclude);
public static bool Mask(this DrawMode mode) => mode.HasFlag(DrawMode.Mask);
public static bool FloodFill(this DrawMode mode) => mode.HasFlag(DrawMode.FloodFill);
public static bool ColorKeyIgnore(this DrawMode mode) => mode.HasFlag(DrawMode.ColorKeyIgnore);
public static bool Animation(this DrawMode mode) => mode.HasFlag(DrawMode.Animation);
public static bool Back(this DrawMode mode) => mode.HasFlag(DrawMode.Back);
public static bool Front(this DrawMode mode) => mode.HasFlag(DrawMode.Front);