decompiled panorama scripts, lets try it out
This commit is contained in:
53
panorama/scripts/custom_game/display_error.js
Normal file
53
panorama/scripts/custom_game/display_error.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// steamid至accountid(Dota2数字账户)的转换,字符串
|
||||
function GetAccountID () {
|
||||
var playerInfo = Game.GetPlayerInfo(Game.GetLocalPlayerID());
|
||||
var steamID64 = playerInfo.player_steamid,
|
||||
steamIDPart = Number(steamID64.substring(3)),
|
||||
steamID32 = String(steamIDPart - 61197960265728);
|
||||
return steamID32;
|
||||
}
|
||||
|
||||
// 只能使用kv本地化文件中定义的标签
|
||||
function Errors(data)
|
||||
{
|
||||
GameEvents.SendEventClientSide("dota_hud_error_message", {
|
||||
"splitscreenplayer": 0,
|
||||
"reason": 80,
|
||||
"message": data.msg
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 在聊天频道显示,队友可见
|
||||
function Chat(data)
|
||||
{
|
||||
// 注意 $.Localize 首次使用时必须带第二个参数,之后不需要。
|
||||
// var text = $.Localize(, $.GetContextPanel());
|
||||
var params = data.params;
|
||||
|
||||
var msgPanel = $.CreatePanel("Panel", $.GetContextPanel(), "");
|
||||
msgPanel.visible = false;
|
||||
|
||||
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.text = $.Localize(data.msg, label).replace(/%%/g,"%");
|
||||
GameEvents.SendCustomGameEventToServer("custom_game_chat_msg", {'msg':label.text});
|
||||
msgPanel.DeleteAsync(0);
|
||||
}
|
||||
|
||||
(function()
|
||||
{
|
||||
GameEvents.Subscribe("display_custom_error", Errors);
|
||||
GameEvents.Subscribe("display_chat_msg", Chat);
|
||||
})();
|
||||
Reference in New Issue
Block a user