private void drawTime(Vector2 position, string timeString, Color color, float scale = 1f, float alpha = 1f) { PixelFont font = Dialog.Languages["english"].Font; float fontFaceSize = Dialog.Languages["english"].FontFaceSize; float currentScale = scale; float currentX = position.X; float currentY = position.Y; color = color * alpha; Color colorDoubleAlpha = color * alpha; foreach (char c in timeString) { bool flag2 = c == '.'; if (flag2) { currentScale = scale * 0.7f; currentY -= 5f * scale; } Color colorToUse = (c == ':' || c == '.' || currentScale < scale) ? colorDoubleAlpha : color; float advance = (((c == ':' || c == '.') ? spacerWidth : numberWidth) + 4f) * currentScale; font.DrawOutline(fontFaceSize, c.ToString(), new Vector2(currentX + advance / 2, currentY), new Vector2(0.5f, 1f), Vector2.One * currentScale, colorToUse, 2f, Color.Black); currentX += advance; } }
private static void DrawTime(Vector2 position, string timeString, float scale = 1f, bool valid = true, bool finished = false, bool bestTime = false, float alpha = 1f) { float numberWidth = 0f; float spacerWidth = 0f; PixelFontSize pixelFontSize = Dialog.Languages["english"].Font.Get(Dialog.Languages["english"].FontFaceSize); for (int index = 0; index < 10; ++index) { float x1 = pixelFontSize.Measure(index.ToString()).X; if ((double)x1 > numberWidth) { numberWidth = x1; } } spacerWidth = pixelFontSize.Measure('.').X; PixelFont font = Dialog.Languages["english"].Font; float fontFaceSize = Dialog.Languages["english"].FontFaceSize; float num1 = scale; float x = position.X; float y = position.Y; Color color1 = Color.White * alpha; Color color2 = Color.LightGray * alpha; if (!valid) { color1 = Calc.HexToColor("918988") * alpha; color2 = Calc.HexToColor("7a6f6d") * alpha; } else if (bestTime) { color1 = Calc.HexToColor("fad768") * alpha; color2 = Calc.HexToColor("cfa727") * alpha; } else if (finished) { color1 = Calc.HexToColor("6ded87") * alpha; color2 = Calc.HexToColor("43d14c") * alpha; } for (int index = 0; index < timeString.Length; ++index) { char ch = timeString[index]; Color color3 = ch == ':' || ch == '.' || (double)num1 < (double)scale ? color2 : color1; float num2 = (float)((ch == ':' || ch == '.' ? spacerWidth : numberWidth) + 4.0) * num1; font.DrawOutline(fontFaceSize, ch.ToString(), new Vector2(x + num2 / 2f, y), new Vector2(0.5f, 1f), Vector2.One * num1, color3, 2f, Color.Black); x += num2; } }
public static void DrawTime(Vector2 position, string timeString, float scale = 1f, bool valid = true, bool finished = false, bool bestTime = false, float alpha = 1f) { PixelFont font = Dialog.Languages["english"].Font; float fontFaceSize = Dialog.Languages["english"].FontFaceSize; float num = scale; float num2 = position.X; float num3 = position.Y; Color color = Color.White * alpha; Color color2 = Color.LightGray * alpha; if (!valid) { color = Calc.HexToColor("918988") * alpha; color2 = Calc.HexToColor("7a6f6d") * alpha; } else if (bestTime) { color = Calc.HexToColor("fad768") * alpha; color2 = Calc.HexToColor("cfa727") * alpha; } else if (finished) { color = Calc.HexToColor("6ded87") * alpha; color2 = Calc.HexToColor("43d14c") * alpha; } for (int i = 0; i < timeString.Length; i++) { char c = timeString[i]; if (c == '.') { num = scale * 0.7f; num3 -= 5f * scale; } Color color3 = (c == ':' || c == '.' || num < scale) ? color2 : color; float num4 = (((c == ':' || c == '.') ? spacerWidth : numberWidth) + 4f) * num; font.DrawOutline(fontFaceSize, c.ToString(), new Vector2(num2 + num4 / 2f, num3), new Vector2(0.5f, 1f), Vector2.One * num, color3, 2f, Color.Black); num2 += num4; } }
public override void Render() { base.Render(); if (DrawLerp > 0f) { float num = -300f * Ease.CubeIn(1f - DrawLerp); int index = 0; for (int i = 0; i < GameData.Instance.players.Length; i++) { if (GameData.Instance.players[i] != null) { bg.Draw(new Vector2(num, Y + 44 * (index + 1))); PlayerToken token = GameData.Instance.players[i].token; token.textures[(int)token.frame].DrawCentered(new Vector2(num + 60, Y - 8 + 44 * (index + 1.5f)), Color.White, .3f); PixelFont font = Dialog.Languages["english"].Font; float fontFaceSize = Dialog.Languages["english"].FontFaceSize; font.DrawOutline(fontFaceSize, string.Format("{0:F1} M", (GameData.Instance.minigameResults.FirstOrDefault((t) => t.Item1 == i)?.Item2 ?? GameData.Instance.minigameStatus[i]) / 50.0), new Vector2(num + 200, Y + 44f * (index + 2)), new Vector2(0.5f, 1f), Vector2.One * (1f + wiggler.Value * 0.15f), Color.White, 2f, Color.Black); index++; } } } }
public override void Render() { base.Render(); if (DrawLerp > 0f) { float num = -300f * Ease.CubeIn(1f - DrawLerp); int index = 0; for (int i = 0; i < GameData.Instance.players.Length; i++) { if (GameData.Instance.players[i] != null) { scoreBg.Draw(new Vector2(num, Y + 44 * (index + 1))); GFX.Gui[PlayerToken.GetFullPath(BoardController.TokenPaths[i]) + "00"].DrawCentered(new Vector2(num + 40, Y - 8 + 44 * (index + 1.5f)), Color.White, .3f); PixelFont font = Dialog.Languages["english"].Font; float fontFaceSize = Dialog.Languages["english"].FontFaceSize; string text = (GameData.Instance.minigameStatus.ContainsKey(i) ? GameData.Instance.minigameStatus[i].ToString() : "0") + (max > 0 ? "/" + max : ""); font.DrawOutline(fontFaceSize, text, new Vector2(num + 120, Y + 44f * (index + 2)), new Vector2(0.5f, 1f), Vector2.One * (1f + wiggler.Value * 0.15f), Color.White, 2f, Color.Black); index++; } } } }