На загрузочный экран ставишь кучу кнопочек и чего угодно, и посылаешь на сервак инфу о выбранных настройках.Как сделать панель настроек игры во время загрузки игроков, во время пика и во время игры с нуля? К примеру:
ставишь кнопку которая перемещает панель?Она ещё выезжала сбоку, а по нажатию кнопки снова заезжала влево
<CustomUIElement type="GameSetup" layoutfile="file://{resources}/layout/custom_game/my_custom_game_setup.xml" />
https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Custom_Game_EventsКнопку сделал, а вот как изменить что-либо в игре по её нажатии - не знаю, в JS API такого, как SetHealth(), нет
<root>
<Panel>
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/test.xml" />
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/test2.xml" />
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/test3.xml" />
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/test4.xml" />
</Panel>
</root>
<root>
<styles>
<include src="file://{resources}/styles/custom_game/test.css" />
</styles>
<scripts>
<include src="file://{resources}/scripts/custom_game/test.js" />
</scripts>
<Panel class="Main" >
<Button id="btnTest" onactivate="onBtnTestClick('myArgument')" />
</Panel>
</root>
<root>
<styles>
<include src="file://{resources}/styles/custom_game/test2.css" />
</styles>
<scripts>
<include src="file://{resources}/scripts/custom_game/test2.js" />
</scripts>
<Panel class="Main2" >
<RadioButton checked="checked" group="Demo" id="Demo1" text="Radio button 1" onactivate="onTest2Click('myArgument')"/>
</Panel>
</root>
<root>
<styles>
<include src="file://{resources}/styles/custom_game/test3.css" />
</styles>
<scripts>
<include src="file://{resources}/scripts/custom_game/test3.js" />
</scripts>
<Panel class="Main3" >
<RadioButton group="Demo" id="Demo2" text="Radio button 2" onactivate="onTest3Click('myArgument')"/>
</Panel>
</root>
<root>
<styles>
<include src="file://{resources}/styles/custom_game/test4.css" />
</styles>
<scripts>
<include src="file://{resources}/scripts/custom_game/test4.js" />
</scripts>
<Panel class="Main4" >
<RadioButton group="Demo" id="Demo3" text="Radio button 3" onactivate="onTest4Click('myArgument')"/>
</Panel>
</root>
.Main {
vertical-align: center; /* выравнивание по центру */
horizontal-align: center;
}
#btnTest { /* Обычное состояние */
background-color: #ec4; /* Цвет фона */
width: 200px; /* Ширина и ниже - высота */
height: 200px;
}
#btnTest:hover { /* При наведении */
width: 205px;
height: 205px;
}
#btnTest:active { /* При нажатии */
border: 4px solid #fff; /* Рамка в 4 пикселя шириной и с белым цветом */
}
.Main2 {
vertical-align: center; /* выравнивание по центру */
horizontal-align: center;
}
#Demo1 { /* Обычное состояние */
background-color: #ec4; /* Цвет фона */
width: 200px; /* Ширина и ниже - высота */
height: 150px;
}
.Main3 {
vertical-align: center; /* выравнивание по центру */
horizontal-align: center;
}
#Demo2 { /* Обычное состояние */
background-color: #ec4; /* Цвет фона */
width: 150px; /* Ширина и ниже - высота */
height: 200px;
}
#Demo2:hover { /* При наведении */
width: 205px;
height: 205px;
}
#Demo2:active { /* При нажатии */
border: 4px solid #fff; /* Рамка в 4 пикселя шириной и с белым цветом */
}
.Main4 {
vertical-align: center; /* выравнивание по центру */
horizontal-align: center;
}
#Demo3{ /* Обычное состояние */
background-color: #ec4; /* Цвет фона */
width: 220px; /* Ширина и ниже - высота */
height: 220px;
}
#Demo3:hover { /* При наведении */
width: 205px;
height: 205px;
}
#Demo3:active { /* При нажатии */
border: 4px solid #fff; /* Рамка в 4 пикселя шириной и с белым цветом */
}
function onBtnTestClick(event){
$.Msg("Ti pidr") // вывод в консоль
GameUI.SetCameraTarget( Players.GetPlayerHeroEntityIndex( -1 ) )
var plyID = Game.GetLocalPlayerID(); // Game - глобальна¤ штука, смотри API JS
Game.SetPlayerMuted( plyID, 0 )
$.Msg(plyID)
var data = { // ќбьект дл¤ передачи в Ћуа
playerID: plyID,
msg: event // аргумен, который указывали в хмл onactivate="onBtnTestClick('myArgument')
}
// кладем "придуманное_им¤_событи¤" и наш обьект
GameEvents.SendCustomGameEventToServer( "event_test", data );
}
function onTest2Click(event){
$.Msg("Ti pidr") // вывод в консоль
GameUI.SetCameraTarget( Players.GetPlayerHeroEntityIndex( -1 ) )
var plyID = Game.GetLocalPlayerID(); // Game - глобальна¤ штука, смотри API JS
Game.SetPlayerMuted( plyID, 0 )
$.Msg(plyID)
var data = { // ќбьект дл¤ передачи в Ћуа
playerID: plyID,
msg: event // аргумен, который указывали в хмл onactivate="onBtnTestClick('myArgument')
}
// кладем "придуманное_им¤_событи¤" и наш обьект
GameEvents.SendCustomGameEventToServer( "event_test", data );
}
function onTest3Click(event){
$.Msg("Ti pidr") // вывод в консоль
GameUI.SetCameraTarget( Players.GetPlayerHeroEntityIndex( -1 ) )
var plyID = Game.GetLocalPlayerID(); // Game - глобальна¤ штука, смотри API JS
Game.SetPlayerMuted( plyID, 0 )
$.Msg(plyID)
var data = { // ќбьект дл¤ передачи в Ћуа
playerID: plyID,
msg: event // аргумен, который указывали в хмл onactivate="onBtnTestClick('myArgument')
}
// кладем "придуманное_им¤_событи¤" и наш обьект
GameEvents.SendCustomGameEventToServer( "event_test", data );
}
[b]function onTest4Click(event){
$.Msg("Ti pidr") // вывод в консоль
GameUI.SetCameraTarget( Players.GetPlayerHeroEntityIndex( -1 ) )
var plyID = Game.GetLocalPlayerID(); // Game - глобальна¤ штука, смотри API JS
Game.SetPlayerMuted( plyID, 0 )
$.Msg(plyID)
var data = { // ќбьект дл¤ передачи в Ћуа
playerID: plyID,
msg: event // аргумен, который указывали в хмл onactivate="onBtnTestClick('myArgument')
}
// кладем "придуманное_им¤_событи¤" и наш обьект
GameEvents.SendCustomGameEventToServer( "event_test", data );
}
Я не вижу на быстрый взгляд косяков, сделай один файл с одним радиобаттоном, и потом попробуй и выложи код, так будет проще.Что я сделал не так и как укомпановать все файлы в один? Нужен ли мне vtex формат для создания целой панели с кнопками?
Ну ты меня понялНу, кнопка у меня есть, а вот наложить на неё нормальную текстуру и поменять шрифт текста я не могу
Ну а сама кнопка так же и выглядит, я не знаю, как сделать текстуру, которая была бы похожа на RadioButton
background-image: url("file://{images}/custom_game/ui_timer.png");
.Main2 {
vertical-align: center; /* выравнивание по центру */
background-image: url("s2r://panorama/images/custom_game/buttons/asdf.png");
background-repeat: no-repeat;
horizontal-align: left;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 18px;
text-align: right;
color: #F9F2E3;
}
.Main2 > Label{
vertical-align: center; /* выравнивание по центру */
background-image: url("s2r://panorama/images/custom_game/buttons/asdf.png");
background-repeat: no-repeat;
horizontal-align: left;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 18px;
text-align: right;
color: #F9F2E3;
}
//
// Radio Button
//
RadioButton
{
background-color: none;
flow-children: right;
// padding: 4px 4px;
color: white;
transition-property: background-color, box-shadow, color, brightness;
transition-duration: 0.25s;
transition-timing-function: ease-in-out;
}
RadioButton > .RadioBox
{
min-width: 20px;
min-height: 20px;
border-radius: 50%;
background-color: gradient( radial, 50% 50%, 0% 0%, 10% 10%, from( #000000 ), to( #000000 ) );
border: 2px solid #5e686966;
box-shadow: #00000055 -2px -2px 1px 4px;
transition-property: background-color, box-shadow, color, border;
transition-duration: 0.20s;
transition-timing-function: ease-in-out;
}
RadioButton:selected > .RadioBox
{
background-color: gradient( radial, 50% 50%, 0% 0%, 50% 50%, from( #e7f6f5 ), to( #333399 ) );
border: 3px solid #000000;
box-shadow: #5b62bf77 -3px -3px 6px 6px;
transition-property: background-color;
transition-duration: 0.5s;
transition-timing-function: ease-in-out;
}
RadioButton:enabled:hover > .RadioBox
{
border: 2px solid #697879;
}
RadioButton:enabled:selected:hover > .RadioBox
{
border: 3px solid #000000;
}
RadioButton > Label
{
color: baseText;
margin-left: 8px;
font-size: 16px;
transition-property: color;
transition-duration: 0.2s;
transition-timing-function: linear;
}
DOTASettingsEnum RadioButton > Label
{
font-size: 18px;
color: #7d8688;
}
RadioButton:selected > Label
{
color: white;
transition-property: color, text-shadow;
transition-duration: 0.2s;
transition-timing-function: linear;
}
RadioButton:enabled:hover > Label
{
color: white;
transition-property: color;
transition-duration: 0.2s;
transition-timing-function: linear;
}
RadioButton:disabled > .RadioBox
{
color: transparent;
box-shadow: #33333377 -4px -4px 8px 8px;
background-color: #00000000;
}
RadioButton:disabled:selected > .RadioBox
{
background-color: gradient( radial, 50% 50%, 0% 0%, 50% 50%, from( #e7f6f533 ), to( #33339933 ) );
}
RadioButton:disabled > Label
{
color: #333333;
}