Нужна помощь в Panorama

almazist1

Продвинутый
не появляются мои PNG картинки только крестик.
JavaScript:
(function () {
    InitializeUI()
})();

function InitializeUI() {
    CustomNetTables.SubscribeNetTableListener("player_cards", OnPlayerCardsChanged);
}

function OnPlayerCardsChanged(table, key, data) {
    var key_parts = key.split("_")
    var player_id = key_parts[1];
    if ( player_id == Game.GetLocalPlayerID() ) {
        RefreshPlayerCards(data);
    }
}

function RefreshPlayerCards(data) {
    if ( data[1] == "blank" ) {
        $("#CardPanel1").style.visibility = 'collapse';
    } else {
        var panel = $("#CardPanel1");
        panel.SetPanelEvent("onmouseover", function () {
            $.DispatchEvent("DOTAShowAbilityTooltip", panel, "card_" + data[1]);
            $("#DiscardButton1").style.visibility = 'visible';
        })
        panel.SetPanelEvent("onmouseout", function () {
            $.DispatchEvent("DOTAHideAbilityTooltip", panel);
            $("#DiscardButton1").style.visibility = 'collapse';
        })
        panel.style.visibility = 'visible';
        $("#CardButton1").SetImage("file://{images}cards/" + data[1] + ".png");
    }

    if ( data[2] == "blank" ) {
        $("#CardPanel2").style.visibility = 'collapse';
    } else {
        var panel = $("#CardPanel2");
        panel.SetPanelEvent("onmouseover", function () {
            $.DispatchEvent("DOTAShowAbilityTooltip", panel, "card_" + data[2]);
            $("#DiscardButton2").style.visibility = 'visible';
        })
        panel.SetPanelEvent("onmouseout", function () {
            $.DispatchEvent("DOTAHideAbilityTooltip", panel);
            $("#DiscardButton2").style.visibility = 'collapse';
        })
        panel.style.visibility = 'visible';
        $("#CardButton2").SetImage("file://{images}cards/" + data[2] + ".png");
    }

    if ( data[3] == "blank" ) {
        $("#CardPanel3").style.visibility = 'collapse';
    } else {
        var panel = $("#CardPanel3");
        panel.SetPanelEvent("onmouseover", function () {
            $.DispatchEvent("DOTAShowAbilityTooltip", panel, "card_" + data[3]);
            $("#DiscardButton3").style.visibility = 'visible';
        })
        panel.SetPanelEvent("onmouseout", function () {
            $.DispatchEvent("DOTAHideAbilityTooltip", panel);
            $("#DiscardButton3").style.visibility = 'collapse';
        })
        panel.style.visibility = 'visible';
        $("#CardButton3").SetImage("file://{images}cards/" + data[3] + ".png");
    }

    if ( data[4] == "blank" ) {
        $("#CardPanel4").style.visibility = 'collapse';
    } else {
        var panel = $("#CardPanel4");
        panel.SetPanelEvent("onmouseover", function () {
            $.DispatchEvent("DOTAShowAbilityTooltip", panel, "card_" + data[4]);
            $("#DiscardButton4").style.visibility = 'visible';
        })
        panel.SetPanelEvent("onmouseout", function () {
            $.DispatchEvent("DOTAHideAbilityTooltip", panel);
            $("#DiscardButton4").style.visibility = 'collapse';
        })
        panel.style.visibility = 'visible';
        $("#CardButton4").SetImage("file://{images}cards/" + data[4] + ".png");
    }

    if ( data[5] == "blank" ) {
        $("#CardPanel5").style.visibility = 'collapse';
    } else {
        var panel = $("#CardPanel5");
        panel.SetPanelEvent("onmouseover", function () {
            $.DispatchEvent("DOTAShowAbilityTooltip", panel, "card_" + data[5]);
            $("#DiscardButton5").style.visibility = 'visible';
        })
        panel.SetPanelEvent("onmouseout", function () {
            $.DispatchEvent("DOTAHideAbilityTooltip", panel);
            $("#DiscardButton5").style.visibility = 'collapse';
        })
        panel.style.visibility = 'visible';
        $("#CardButton5").SetImage("file://{images}cards/" + data[5] + ".png");
    }
}

function UseCard(slot) {
    var player_cards = CustomNetTables.GetTableValue("player_cards", "player_" + Game.GetLocalPlayerID() + "_cards")
    if ( player_cards[slot] !== "blank" ) {
        var hero_index = Players.GetPlayerHeroEntityIndex(Game.GetLocalPlayerID())
        var ability_index = Entities.GetAbilityByName(hero_index, "card_" + player_cards[slot])
        if (GameUI.IsAltDown() == true) {
            Abilities.PingAbility(ability_index)
        } else {
            Abilities.ExecuteAbility(ability_index, hero_index, false)
        }
    }
}

function DiscardCard(slot) {
    GameEvents.SendCustomGameEventToServer("player_discarded_card", {player_id: Players.GetLocalPlayer(), card_slot: slot})
}

// Utility functions
function FindDotaHudElement (id) {
    return GetDotaHud().FindChildTraverse(id);
}

function GetDotaHud () {
    var p = $.GetContextPanel();
    while (p !== null && p.id !== 'Hud') {
        p = p.GetParent();
    }
    if (p === null) {
        throw new HudNotFoundException('Could not find Hud root as parent of panel with id: ' + $.GetContextPanel().id);
    } else {
        return p;
    }
}

// Checks if the local player has local privileges
function CheckForHostPrivileges() {
    var player_info = Game.GetLocalPlayerInfo();
    if ( !player_info ) {
        return undefined;
    } else {
        return player_info.player_has_host_privileges;
    }
}
CSS:
#CardsContainer
{
    width: 220px;
    height: 800px;
    margin-left: 15px;
    margin-top: 100px;
    margin-bottom: 245px;
    flow-children: down;
}

.CardPanel
{
    width: 100%;
    height: fill-parent-flow(1);
    max-height: 200px;
    margin-top: 5px;
    margin-bottom: 5px;
    background-size: 100% 100%;
    horizontal-align: center;
    border-radius: 10px;
    visibility: collapse;
}

.CardButton
{
    margin-top: 2px;
    margin-bottom: 2px;
    horizontal-align: center;
    tooltip-position: right;
    tooltip-body-position: 50% 100%;
    box-shadow: fill #000000df -6px -6px 8px 12px;
}

.CardButton:hover
{
    background-color: #ffffff20;
    saturation: 1.2;
}

.DiscardButton
{
    margin-top: 6px;
    margin-left: 10px;
    horizontal-align: left;
    vertical-align: top;
    height: 25px;
    width: 25px;
    visibility: collapse;
}
XML:
<root>
<styles>
        <include src="s2r://panorama/styles/custom_game/cards.css" />
    </styles>

    <scripts>
        <include src="s2r://panorama/scripts/custom_game/cards.js" />
    </scripts>

    <Panel hittest="false">
        <Panel id="CardsContainer">
            <Panel class="CardPanel" id="CardPanel1" onmouseout="DOTAHideAbilityTooltip()">
                <Image class="CardButton" id="CardButton1" scaling="stretch-to-fit-y-preserve-aspect" onactivate="UseCard('1')" />
                <Image class="DiscardButton" id="DiscardButton1" src="file://{images}control_icons/x_close.png" onactivate="DiscardCard('1')" />
            </Panel>
            <Panel class="CardPanel" id="CardPanel2" onmouseout="DOTAHideAbilityTooltip()">
                <Image class="CardButton" id="CardButton2" scaling="stretch-to-fit-y-preserve-aspect" onactivate="UseCard('2')" />
                <Image class="DiscardButton" id="DiscardButton2" src="file://{images}control_icons/x_close.png" onactivate="DiscardCard('2')" />
            </Panel>
            <Panel class="CardPanel" id="CardPanel3" onmouseout="DOTAHideAbilityTooltip()">
                <Image class="CardButton" id="CardButton3" scaling="stretch-to-fit-y-preserve-aspect" onactivate="UseCard('3')" />
                <Image class="DiscardButton" id="DiscardButton3" src="file://{images}control_icons/x_close.png" onactivate="DiscardCard('3')" />
            </Panel>
            <Panel class="CardPanel" id="CardPanel4" onmouseout="DOTAHideAbilityTooltip()">
                <Image class="CardButton" id="CardButton4" scaling="stretch-to-fit-y-preserve-aspect" onactivate="UseCard('4')" />
                <Image class="DiscardButton" id="DiscardButton4" src="file://{images}control_icons/x_close.png" onactivate="DiscardCard('4')" />
            </Panel>
            <Panel class="CardPanel" id="CardPanel5" onmouseout="DOTAHideAbilityTooltip()">
                <Image class="CardButton" id="CardButton5" scaling="stretch-to-fit-y-preserve-aspect" onactivate="UseCard('5')" />
                <Image class="DiscardButton" id="DiscardButton5" src="s2r://panorama/images/cards/crystal_maiden_png.vtex" onactivate="DiscardCard('5')" />
            </Panel>
        </Panel>
    </Panel>
</root>
1569689296353.png
 
Реклама: