restructure
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
.MessageRoot{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#Content {
|
||||
margin: 300px 100px;
|
||||
vertical-align: bottom;
|
||||
flow-children: down;
|
||||
}
|
||||
|
||||
.Message {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.Message Label {
|
||||
color: #fff;
|
||||
width: 500px;
|
||||
text-shadow: #000 0px 0px 2px 2.0;
|
||||
font-size: 20px;
|
||||
}
|
||||
@@ -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);
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
<root>
|
||||
<styles>
|
||||
<include src="s2r://panorama/styles/dotastyles.vcss_c" />
|
||||
<include src="s2r://panorama/layout/custom_game/frames/message/message.vcss_c" />
|
||||
</styles>
|
||||
<scripts>
|
||||
<include src="s2r://panorama/layout/custom_game/frames/message/message.vjs_c" />
|
||||
</scripts>
|
||||
<Panel hittest="false" hittestchildren="false" class="MessageRoot" >
|
||||
<Panel id="Content" />
|
||||
</Panel>
|
||||
</root>
|
||||
Reference in New Issue
Block a user