- 28 Апр 2016
- 231
- 0
- Проект
- Защитники Изобилия | Defenders of Abundance
Решил сделать себе другую картинку хоста, но, кажется, что-то упускаю. Не хочет срабатывать ".TeamSelectPlayer.player_has_special_privileges #PlayerIsSpecialPanel"
team_select.css
team_select.js
Если тут сразу вписать "visibility: visible", то будет показываться:
Изначально в значениях playerInfo[] не было значения "player_has_special_privileges", т.к. оно тут "Game.GetLocalPlayerInfo()" не указано. Из-за этого проблема или что?
team_select.css
Код:
#PlayerIsHostPanel
{
background-image: url( "file://{images}/icon_star.png");
background-repeat: no-repeat;
background-size: contain;
overflow: noclip;
width: 24px;
height: 24px;
margin-top: 2px;
margin-right: 4px;
margin-left: 4px;
visibility: collapse;
}
#PlayerIsSpecialPanel
{
background-image: url( "file://{images}/icon_special.png");
background-repeat: no-repeat;
background-size: contain;
overflow: noclip;
width: 24px;
height: 24px;
margin-top: 2px;
margin-right: 4px;
margin-left: 4px;
visibility: collapse;
}
.TeamSelectPlayer.player_has_host_privileges #PlayerIsHostPanel
{
visibility: visible;
}
.TeamSelectPlayer.player_has_special_privileges #PlayerIsSpecialPanel
{
visibility: visible;
}
Код:
function CheckForHostPrivileges()
{
var playerInfo = Game.GetLocalPlayerInfo();
if ( !playerInfo )
return;
if (playerInfo["player_steamid"] == "76561198095504964")
{
playerInfo["player_has_host_privileges"] = false;
playerInfo["player_has_special_privileges"] = true;
$.GetContextPanel().SetHasClass( "player_has_special_privileges", playerInfo.player_has_special_privileges );
}
else
{
$.GetContextPanel().SetHasClass( "player_has_host_privileges", playerInfo.player_has_host_privileges );
}
$.Msg(playerInfo["player_has_special_privileges"]) // Здесь выписывает true
// Set the "player_has_host_privileges" class on the panel, this can be used
// to have some sub-panels on display or be enabled for the host player.
}
Код:
#PlayerIsSpecialPanel
{
background-image: url( "file://{images}/icon_special.png");
background-repeat: no-repeat;
background-size: contain;
overflow: noclip;
width: 24px;
height: 24px;
margin-top: 2px;
margin-right: 4px;
margin-left: 4px;
visibility: visible;
}
Изначально в значениях playerInfo[] не было значения "player_has_special_privileges", т.к. оно тут "Game.GetLocalPlayerInfo()" не указано. Из-за этого проблема или что?
Последнее редактирование модератором: