Change stringToColoredText to accept a hex string (#6241)

This commit is contained in:
Dedmen Miller 2018-04-09 17:20:03 +02:00 committed by SilentSpike
parent d41779dc74
commit 50abe911a5
3 changed files with 13 additions and 11 deletions

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Text <ANY>
* 1: Color <ARRAY>
* 1: Color <ARRAY, STRING>
*
* Return Value:
* Text <STRING>
@ -20,12 +20,14 @@ params ["_string", "_color"];
_string = format ["%1", _string];
_color = (
[255 * (_color select 0), 2] call FUNC(toHex)
) + (
[255 * (_color select 1), 2] call FUNC(toHex)
) + (
[255 * (_color select 2), 2] call FUNC(toHex)
);
if (_color isEqualType []) then {
_color = "#" + (
[255 * (_color select 0), 2] call FUNC(toHex)
) + (
[255 * (_color select 1), 2] call FUNC(toHex)
) + (
[255 * (_color select 2), 2] call FUNC(toHex)
);
};
parseText format ["<t align='center' color='#%2' >%1</t>", _string, _color]
parseText format ["<t align='center' color='%1' >%2</t>", _color, _string]

View File

@ -45,7 +45,7 @@ for "_a" from (_count + 1) to 12 do {
TRACE_3("",_temperature,_color,_string);
_text = composeText [_text, [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)];
_text = composeText [_text, [_string, "#808080"] call EFUNC(common,stringToColoredText)];
private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");

View File

@ -95,7 +95,7 @@ private _ammoBarsStructuredText = if (_showNumber) then {
_string = _string + "|";
};
composeText [_text, [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)];
composeText [_text, [_string, "#808080"] call EFUNC(common,stringToColoredText)];
};