ACE3/addons/interaction/functions/fnc_showMouseHint.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

81 lines
2.8 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Garth de Wet (LH)
* Shows the interaction helper text with the mouse buttons at the bottom middle of the screen.
*
* Arguments:
* 0: Left Click Text <STRING>
* 1: Right Click Text <STRING>
* 2: Scroll Text <STRING> (default: "")
* 2: Extra Icon/Text pairs <ARRAY> (default: [])
*
* Return Value:
* None
*
* Example:
* ["Place Explosive", "Cancel"] call ace_interaction_fnc_showMouseHint
*
* Public: No
*/
#define GUI_GRID_W (0.025)
#define GUI_GRID_H (0.04)
params ["_leftClick", "_rightClick", ["_scroll", ""], ["_extraIconSets", []]];
(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN", 0.5, false];
disableSerialization;
private _display = uiNamespace getVariable ["ACE_Helper_Display", objNull];
if (isNull _display) exitWith {WARNING("Display was null");};
(_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 != "");
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"];
};
{
_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;