showMouseHint - Allow adding additional icon/text lines (#5524)

* showMouseHint - Allow adding additional icon/text

* Remove icons, just use localized text
This commit is contained in:
PabstMirror 2017-09-19 14:00:22 -05:00 committed by GitHub
parent 7fe932803b
commit db36ee4581
3 changed files with 37 additions and 9 deletions

View File

@ -155,6 +155,9 @@ class RscInteractionText: RscText{
w = 24 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
};
class RscInteractionText_right: RscText{
style = 1; // right aligned text
};
class RscTitles {
class GVAR(InteractionHelper) {

View File

@ -19,7 +19,7 @@ if (isNull (uiNamespace getVariable ["ACE_Helper_Display", objNull])) exitWith {
(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
// Disable action menu, showHud also disables all scripted UI (such as drawIcon3D)
// Re-enable action menu
inGameUISetEventHandler ["PrevAction", "false"];
inGameUISetEventHandler ["NextAction", "false"];
inGameUISetEventHandler ["Action", "false"];

View File

@ -6,6 +6,7 @@
* 0: Left Click Text <STRING>
* 1: Right Click Text <STRING>
* 2: Scroll Text <STRING> (Optional)
* 2: Extra Icon/Text pairs <OPTIONAL><ARRAY>
*
* Return Value:
* None
@ -20,7 +21,7 @@
#define GUI_GRID_W (0.025)
#define GUI_GRID_H (0.04)
params ["_leftClick", "_rightClick", ["_scroll", ""]];
params ["_leftClick", "_rightClick", ["_scroll", ""], ["_extraIconSets", []]];
(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN", 0.5, false];
@ -28,7 +29,7 @@ disableSerialization;
private _display = uiNamespace getVariable ["ACE_Helper_Display", objNull];
if (isNull _display) exitWith {};
if (isNull _display) exitWith {WARNING("Display was null");};
(_display displayCtrl 1000) ctrlSetText _leftClick;
(_display displayCtrl 1001) ctrlSetText _rightClick;
@ -38,18 +39,42 @@ if (isNull _display) exitWith {};
(_display displayCtrl 1001) ctrlShow (_rightClick != "");
(_display displayCtrl 1201) ctrlShow (_rightClick != "");
if (_scroll == "") exitWith {
private _offset = 19;
if (_scroll == "") then {
(_display displayCtrl 1002) ctrlShow false;
(_display displayCtrl 1202) ctrlShow false;
(_display displayCtrl 1001) ctrlSetPosition [21 * GUI_GRID_W, 18 * GUI_GRID_H, 24 * GUI_GRID_W, 1.5 * GUI_GRID_H];
(_display displayCtrl 1201) ctrlSetPosition [20 * GUI_GRID_W, 18.5 * GUI_GRID_H, 1.5 * GUI_GRID_W, 1 * GUI_GRID_H];
(_display displayCtrl 1001) ctrlCommit 0;
(_display displayCtrl 1201) ctrlCommit 0;
} else {
_offset = _offset + 1;
(_display displayCtrl 1002) ctrlSetText _scroll;
// Disable action menu
inGameUISetEventHandler ["PrevAction", "true"];
inGameUISetEventHandler ["NextAction", "true"];
inGameUISetEventHandler ["Action", "true"];
};
(_display displayCtrl 1002) ctrlSetText _scroll;
{
_x params [["_xKeyName", "", [""]], ["_xText", "", [""]]];
switch (toLower _xKeyName) do {
case ("alt"): {_xKeyName = format ["<%1>", toUpper localize "str_dik_alt"];};
case ("control");
case ("ctrl"): {_xKeyName = format ["<%1>", toUpper localize "str_dik_control"];};
case ("shift"): {_xKeyName = format ["<%1>", toUpper localize "str_dik_shift"];};
};
private _keyNameCtrl = _display ctrlCreate ["RscInteractionText_right", -1];
private _textCtrl = _display ctrlCreate ["RscInteractionText", -1];
_keyNameCtrl ctrlSetText _xKeyName;
_textCtrl ctrlSetText _xText;
_keyNameCtrl ctrlSetPosition [0 * GUI_GRID_W, _offset * GUI_GRID_H, 21.4 * GUI_GRID_W, 1.5 * GUI_GRID_H];
_textCtrl ctrlSetPosition [21 * GUI_GRID_W, _offset * GUI_GRID_H, 24 * GUI_GRID_W, 1.5 * GUI_GRID_H];
_keyNameCtrl ctrlCommit 0;
_textCtrl ctrlCommit 0;
_offset = _offset + 1;
} forEach _extraIconSets;
// Enable action menu
inGameUISetEventHandler ["PrevAction", "true"];
inGameUISetEventHandler ["NextAction", "true"];
inGameUISetEventHandler ["Action", "true"];