-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScriptGlobals.InformationManager.cs
More file actions
26 lines (23 loc) · 1 KB
/
ScriptGlobals.InformationManager.cs
File metadata and controls
26 lines (23 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System.IO;
using System.Runtime.CompilerServices;
using TaleWorlds.Core;
using TaleWorlds.Library;
namespace Int19h.Bannerlord.CSharp.Scripting {
partial class ScriptGlobals {
public static void Print(string line) {
var message = new InformationMessage(line);
InformationManager.DisplayMessage(message);
}
public static void MessageBox(string text, string title, bool pause = false) {
var inquiry = new InquiryData(title, text, true, false, "OK", null, null, null);
InformationManager.ShowInquiry(inquiry, pause);
}
public static void MessageBox(string text, bool pause = false, [CallerFilePath] string? callerFilePath = null, [CallerLineNumber] int? callerLineNumber = null) {
var title =
string.IsNullOrEmpty(callerFilePath) ?
"csx.eval" :
$"{Path.GetFileName(callerFilePath)}({callerLineNumber})";
MessageBox(text, title, pause);
}
}
}