2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 19:32:51 +00:00
|
|
|
/*
|
2015-05-09 02:47:15 +00:00
|
|
|
* Author: Garth de Wet (LH)
|
2017-09-22 15:33:08 +00:00
|
|
|
* Shows the interaction helper text with the mouse buttons at the bottom middle of the screen.
|
2015-05-09 02:47:15 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Left Click Text <STRING>
|
|
|
|
* 1: Right Click Text <STRING>
|
2017-09-22 15:33:08 +00:00
|
|
|
* 2: Scroll Text <STRING> (default: "")
|
|
|
|
* 2: Extra Icon/Text pairs <ARRAY> (default: [])
|
2015-05-09 02:47:15 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-05-09 02:47:15 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* ["Place Explosive", "Cancel"] call ace_interaction_fnc_showMouseHint
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-11 23:13:47 +00:00
|
|
|
|
2015-01-11 19:32:51 +00:00
|
|
|
#define GUI_GRID_W (0.025)
|
|
|
|
#define GUI_GRID_H (0.04)
|
2015-05-09 20:14:00 +00:00
|
|
|
|
2017-09-19 19:00:22 +00:00
|
|
|
params ["_leftClick", "_rightClick", ["_scroll", ""], ["_extraIconSets", []]];
|
2015-05-09 20:14:00 +00:00
|
|
|
|
2015-09-26 01:16:55 +00:00
|
|
|
(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN", 0.5, false];
|
2015-01-11 19:32:51 +00:00
|
|
|
|
|
|
|
disableSerialization;
|
2015-09-26 01:16:55 +00:00
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
private _display = uiNamespace getVariable ["ACE_Helper_Display", objNull];
|
2015-09-26 01:16:55 +00:00
|
|
|
|
2017-09-19 19:00:22 +00:00
|
|
|
if (isNull _display) exitWith {WARNING("Display was null");};
|
2015-01-11 19:32:51 +00:00
|
|
|
|
|
|
|
(_display displayCtrl 1000) ctrlSetText _leftClick;
|
|
|
|
(_display displayCtrl 1001) ctrlSetText _rightClick;
|
|
|
|
|
|
|
|
(_display displayCtrl 1000) ctrlShow (_leftClick != "");
|
|
|
|
(_display displayCtrl 1200) ctrlShow (_leftClick != "");
|
|
|
|
(_display displayCtrl 1001) ctrlShow (_rightClick != "");
|
|
|
|
(_display displayCtrl 1201) ctrlShow (_rightClick != "");
|
|
|
|
|
2017-09-19 19:00:22 +00:00
|
|
|
private _offset = 19;
|
|
|
|
|
|
|
|
if (_scroll == "") then {
|
2015-04-06 16:22:43 +00:00
|
|
|
(_display displayCtrl 1002) ctrlShow false;
|
|
|
|
(_display displayCtrl 1202) ctrlShow false;
|
2015-09-26 01:16:55 +00:00
|
|
|
(_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];
|
2015-04-06 16:22:43 +00:00
|
|
|
(_display displayCtrl 1001) ctrlCommit 0;
|
|
|
|
(_display displayCtrl 1201) ctrlCommit 0;
|
2017-09-19 19:00:22 +00:00
|
|
|
} else {
|
|
|
|
_offset = _offset + 1;
|
|
|
|
(_display displayCtrl 1002) ctrlSetText _scroll;
|
|
|
|
|
|
|
|
// Disable action menu
|
|
|
|
inGameUISetEventHandler ["PrevAction", "true"];
|
|
|
|
inGameUISetEventHandler ["NextAction", "true"];
|
|
|
|
inGameUISetEventHandler ["Action", "true"];
|
2015-01-11 19:32:51 +00:00
|
|
|
};
|
2015-09-26 01:16:55 +00:00
|
|
|
|
2017-09-19 19:00:22 +00:00
|
|
|
{
|
|
|
|
_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;
|
2015-09-26 01:16:55 +00:00
|
|
|
|