This commit is contained in:
2021-11-10 01:04:06 -05:00
parent 9ee7e31bde
commit f2d8b29206
34 changed files with 4498 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
"use strict";
function ShowMessage(msg, duration, params, color) {
color = color || "#fff";
var msgPanel = $.CreatePanel("Panel", $("#Content"), "");
msgPanel.AddClass("Message");
var label = $.CreatePanel("Label", msgPanel, "");
if (params) {
for(var i in params) {
var v = params[i];
if (typeof v === 'number') {
label.SetDialogVariableInt(i, v);
} else {
label.SetDialogVariable(i, $.Localize(String(v)));
}
}
}
label.html = true;
label.text = $.Localize(msg, label).replace(/%%/g,"%");
label.style.color = color;
msgPanel.DeleteAsync(duration);
}
GameEvents.Subscribe("show_message", function (data) {
ShowMessage(data.msg, data.duration || 5, data.params, data.color);
})