public void Update(double deltaTime) { if (stopped) { if (Raylib.IsKeyPressed(KeyboardKey.KEY_R)) { Assets.UnloadAll(); Reset(); stopped = false; } return; } try { DisasterAPI.Input.Update(); updateFunction.Call(null, deltaTime); } catch (JavaScriptException e) { if (Assets.LoadPath("fontsmall.png", out string fontPath)) { SoftwareCanvas.LoadFont(fontPath); } string message = $"line:{e.LineNumber} {e.Message}"; Program.LoadingMessage(message, new Color32(255, 50, 0)); Program.LoadingMessage("press R to reload", new Color32(255, 50, 0)); stopped = true; } }
public void Update(double deltaTime) { if (stopped) { if (Raylib.IsKeyPressed(KeyboardKey.KEY_R)) { Assets.UnloadAll(); Assets.assignedDefaultShader = false; ScreenController.instance.ReloadShader(); Reset(); stopped = false; } return; } try { DisasterAPI.Input.Update(); updateFunction.Call(null, deltaTime); } catch (JavaScriptException e) { if (Assets.LoadPath("fontsmall.png", out string fontPath)) { SoftwareCanvas.LoadFont(fontPath); } string message = $"line:{e.LineNumber} {e.Message}\nPress R to restart"; //Program.LoadingMessage(message, new Color32(255, 50, 0)); //Program.LoadingMessage("press R to reload", new Color32(255, 50, 0)); int x = 32; int y = 32; int chars = 32; int lines = ((message.Length / chars) + message.Count(f => f == '\n')) + 2; SoftwareCanvas.FillRect(x - 4, y - 4, chars * SoftwareCanvas.fontWidth + 8, lines * SoftwareCanvas.fontHeight + 8, new Color32(255, 180, 0)); for (int i = x - 4; i < x + chars * SoftwareCanvas.fontWidth + 4; i++) { for (int j = y - 4; j < y + lines * SoftwareCanvas.fontHeight + 4; j++) { if ((i + j) % 6 < 3) { SoftwareCanvas.Pixel(i, j, new Color32(0, 0, 0)); } } } SoftwareCanvas.FillRect(x - 1, y - 1, chars * SoftwareCanvas.fontWidth + 2, lines * SoftwareCanvas.fontHeight + 2, new Color32(12, 12, 12)); SoftwareCanvas.Paragraph(x, y, new Color32(255, 50, 0), message, chars); stopped = true; } }