1
0
forked from 0ad/0ad

Options page dropdown support for per-value hovered tooltips.

Differential Revision: https://code.wildfiregames.com/D2576
Preparation for: D2546
Accepted By: Vladislav
This was SVN commit r23414.
This commit is contained in:
elexis 2020-01-18 20:40:33 +00:00
parent 0550315161
commit 63d8d579d7
5 changed files with 23 additions and 7 deletions

View File

@ -32,7 +32,7 @@
textcolor="255 255 255"
/>
<tooltip name="sliderTooltip"
<tooltip name="tooltipInstant"
anchor="top"
buffer_zone="4"
delay="0"

View File

@ -144,7 +144,7 @@
sprite="ModernSliderButton"
sprite_bar="ModernSliderLine"
button_width="20"
tooltip_style="sliderTooltip"
tooltip_style="tooltipInstant"
/>
<style name="ModernButtonRed"
sprite="ModernButtonRed"

View File

@ -140,7 +140,11 @@ var g_OptionType = {
"initGUI": (option, control) => {
control.list = option.list.map(e => e.label);
control.list_data = option.list.map(e => e.value);
},
control.onHoverChange = () => {
let item = option.list[control.hovered];
control.tooltip = item && item.tooltip || option.tooltip;
};
}
},
"slider":
{

View File

@ -371,9 +371,21 @@
"tooltip": "Automatically assign joining clients to free player slots during the match setup.",
"config": "gui.gamesetup.assignplayers",
"list": [
{ "value": "everyone", "label": "Everyone" },
{ "value": "buddies", "label": "Buddies" },
{ "value": "disabled", "label": "Disabled" }
{
"value": "everyone",
"label": "Everyone",
"tooltip": "Players joining the match will be assigned if there is a free slot."
},
{
"value": "buddies",
"label": "Buddies",
"tooltip": "Players joining the match will only be assigned if they are a buddy of the host and if there is a free slot."
},
{
"value": "disabled",
"label": "Disabled",
"tooltip": "Players only receive a slot when the host assigns them explicitly."
}
]
}
]

View File

@ -32,7 +32,7 @@
<object type="image" size="-39 5 -5 100%-5"/>
</object>
<object name="option_control_number[n]" size="65% 0 100%-8 100%" type="input" style="ModernInput"/>
<object name="option_control_dropdown[n]" size="65% 0 100%-8 100%" type="dropdown" style="ModernDropDown"/>
<object name="option_control_dropdown[n]" size="65% 0 100%-8 100%" type="dropdown" style="ModernDropDown" tooltip_style="tooltipInstant"/>
<object name="option_control_slider[n]" size="65% 0 100%-8 100%" type="slider" style="ModernSlider"/>
</object>
</repeat>