1 using Microsoft.Xna.Framework;
5 partial class LuaCsLogger
7 private static GUIFrame overlayFrame;
8 private static GUITextBlock textBlock;
9 private static double showTimer = 0;
11 private static void CreateOverlay(
string message)
13 overlayFrame =
new GUIFrame(
new RectTransform(
new Vector2(0.4f, 0.03f),
null),
null,
new Color(50, 50, 50, 100))
18 GUILayoutGroup layout =
new GUILayoutGroup(
new RectTransform(
new Vector2(0.8f, 0.8f), overlayFrame.RectTransform,
Anchor.CenterLeft),
false,
Anchor.Center)
23 textBlock =
new GUITextBlock(
new RectTransform(
new Vector2(1f, 0f), layout.RectTransform), message);
24 overlayFrame.RectTransform.MinSize =
new Point((
int)(textBlock.TextSize.X * 1.2), 0);
31 if (overlayFrame !=
null && Timing.TotalTime <= showTimer)
33 overlayFrame.AddToGUIUpdateList();
37 public static void ShowErrorOverlay(
string message,
float time = 5f,
float duration = 1.5f)
39 if (Timing.TotalTime <= showTimer)
44 CreateOverlay(message);
46 overlayFrame.Flash(Color.Red, duration,
true);
47 showTimer = Timing.TotalTime + time;
static void AddToGUIUpdateList()
static void ShowErrorOverlay(string message, float time=5f, float duration=1.5f)