decompiled panorama scripts, lets try it out

This commit is contained in:
2021-11-10 00:28:27 -05:00
parent 23e8061588
commit 9ee7e31bde
25 changed files with 3725 additions and 1 deletions

View File

@@ -0,0 +1,53 @@
// steamid至accountidDota2数字账户的转换字符串
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);
})();