Interaction Menu - Add ability to change selector color (#6292)

* Add selector color changing

* Setup colors once at init
This commit is contained in:
mharis001 2018-04-28 18:23:44 -04:00 committed by PabstMirror
parent 2454ade07b
commit e9af086454
6 changed files with 25 additions and 12 deletions

View File

@ -1,4 +1,3 @@
//XEH_clientInit.sqf
#include "script_component.hpp"
if (!hasInterface) exitWith {};
@ -10,16 +9,16 @@ GVAR(cachedBuildingActionPairs) = [];
GVAR(ParsedTextCached) = [];
["ace_settingChanged", {
params ["_name"];
if (({_x == _name} count [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) == 1) then {
[] call FUNC(setupTextColors);
};
}] call CBA_fnc_addEventHandler;
["ace_settingsInitialized", {
//Setup text/shadow/size/color settings matrix
// Setup text/shadow/size/color settings matrix
[] call FUNC(setupTextColors);
// Setting changed added here so color setup happens once at init
["ace_settingChanged", {
params ["_name"];
if (_name in [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) then {
[] call FUNC(setupTextColors);
};
}] call CBA_fnc_addEventHandler;
// Install the render EH on the main display
addMissionEventHandler ["Draw3D", {call FUNC(render)}];
}] call CBA_fnc_addEventHandler;

View File

@ -6,6 +6,8 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
GVAR(ActNamespace) = [] call CBA_fnc_createNamespace;
GVAR(ActSelfNamespace) = [] call CBA_fnc_createNamespace;

View File

@ -28,7 +28,7 @@ if (GVAR(openedMenuType) >= 0) then {
// Render all available nearby interactions
call FUNC(renderActionPoints);
// Draw the red selector only when there's no cursor
// Draw the selector only when there's no cursor
if !(uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then {
[[0.5,0.5], "\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa"] call FUNC(renderSelector);
};

View File

@ -30,10 +30,10 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
private _ctrl = GVAR(iconCtrls) select GVAR(iconCount);
private _pos = if (GVAR(UseListMenu)) then {
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='%2' size='1.6'/>", _icon, GVAR(selectorColorHex)]] call FUNC(ctrlSetParsedTextCached);
[(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW]
} else {
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6' align='center'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='%2' size='1.6' align='center'/>", _icon, GVAR(selectorColorHex)]] call FUNC(ctrlSetParsedTextCached);
[(_sPos select 0)-(0.050*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW]
};

View File

@ -0,0 +1,9 @@
[
QGVAR(selectorColor),
"COLOR",
localize LSTRING(SelectorColor),
format ["ACE %1", localize LSTRING(Category_InteractionMenu)],
[1, 0, 0],
false,
{GVAR(selectorColorHex) = _this call BIS_fnc_colorRGBtoHTML} // Stored in Hex to avoid constant conversion
] call CBA_settings_fnc_init;

View File

@ -446,5 +446,8 @@
<Chinese>使選單的動畫速度更快,並減少子選項顯現出來的時間</Chinese>
<Korean>상호 작용을 표시하기 위해 메뉴 애니메이션을 빠르게 만들고 마우스를 가져 오는 데 필요한 시간을 줄입니다.</Korean>
</Key>
<Key ID="STR_ACE_Interact_Menu_SelectorColor">
<English>Selector Color</English>
</Key>
</Package>
</Project>