mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Improve mouse hint (#6652)
This commit is contained in:
parent
328853e36b
commit
4c047702c8
@ -118,14 +118,15 @@ GVAR(TweakedAngle) = 0;
|
|||||||
|
|
||||||
private _virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase);
|
private _virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase);
|
||||||
|
|
||||||
//Update mouse hint:
|
// Update mouse hint
|
||||||
|
private _ctrlTextLMB = (uiNamespace getVariable [QEGVAR(interaction,mouseHint), displayNull]) displayCtrl 2420;
|
||||||
if (_badPosition) then {
|
if (_badPosition) then {
|
||||||
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(BlockedAction);
|
_ctrlTextLMB ctrlSetText localize LSTRING(BlockedAction);
|
||||||
} else {
|
} else {
|
||||||
if (isNull _attachVehicle) then {
|
if (isNull _attachVehicle) then {
|
||||||
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(PlaceAction);
|
_ctrlTextLMB ctrlSetText localize LSTRING(PlaceAction);
|
||||||
} else {
|
} else {
|
||||||
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(AttachAction);
|
_ctrlTextLMB ctrlSetText localize LSTRING(AttachAction);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
|
|
||||||
#define HSPACE 0.5-2.0/16/2
|
|
||||||
#define VSPACE 0.5-0.3/9/2
|
|
||||||
|
|
||||||
class ACE_Interaction_Button_Base {
|
class ACE_Interaction_Button_Base {
|
||||||
tooltip = "";
|
tooltip = "";
|
||||||
//action = "ACE_Interaction_isMousePressed = true;(findDisplay 1713999) closeDisplay 1;_action = ACE_Interaction_Buttons select ACE_Interaction_SelectedButton;ACE_Interaction_SelectedButton = -1; if (call (_action select 2)) then {call (_action select 1)};";
|
//action = "ACE_Interaction_isMousePressed = true;(findDisplay 1713999) closeDisplay 1;_action = ACE_Interaction_Buttons select ACE_Interaction_SelectedButton;ACE_Interaction_SelectedButton = -1; if (call (_action select 2)) then {call (_action select 1)};";
|
||||||
@ -41,9 +37,11 @@ class ACE_Interaction_Button_Base {
|
|||||||
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1};
|
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1};
|
||||||
};
|
};
|
||||||
|
|
||||||
class RscListbox;
|
|
||||||
class IGUIBack;
|
class IGUIBack;
|
||||||
|
class RscListbox;
|
||||||
class RscText;
|
class RscText;
|
||||||
|
class RscPicture;
|
||||||
|
class RscControlsGroupNoScrollbars;
|
||||||
|
|
||||||
#define X_OFFSET 0.2
|
#define X_OFFSET 0.2
|
||||||
|
|
||||||
@ -131,75 +129,78 @@ class RscACE_SelectAnItem {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GUI_GRID_W (0.025)
|
class RscTitles {
|
||||||
#define GUI_GRID_H (0.04)
|
class GVAR(RscMouseHint) {
|
||||||
|
idd = IDD_MOUSEHINT;
|
||||||
class RscPicture;
|
fadeIn = 0;
|
||||||
class RscInteractionIcon: RscPicture {
|
fadeOut = 0;
|
||||||
x = 19.25 * GUI_GRID_W;
|
duration = 999999;
|
||||||
y = 15.75 * GUI_GRID_H;
|
enableSimulation = 1;
|
||||||
w = 2*GUI_GRID_H;
|
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(mouseHint),_this select 0)]);
|
||||||
h = 2*GUI_GRID_H;
|
class controls {
|
||||||
};
|
class IconLMB: RscPicture {
|
||||||
|
idc = IDC_MOUSEHINT_LMB;
|
||||||
class RscInteractionHelperIcon: RscInteractionIcon {
|
text = QPATHTOF(UI\mouse_left_ca.paa);
|
||||||
x = 20 * GUI_GRID_W;
|
x = 20 * GUI_GRID_W + GUI_GRID_CENTER_X;
|
||||||
y = 16 * GUI_GRID_H;
|
y = 17.5 * GUI_GRID_H;
|
||||||
w = GUI_GRID_H;
|
w = GUI_GRID_H;
|
||||||
h = GUI_GRID_H;
|
h = GUI_GRID_H;
|
||||||
};
|
};
|
||||||
|
class TextLMB: RscText {
|
||||||
class RscInteractionText: RscText{
|
idc = IDC_MOUSEHINT_LMB_TEXT;
|
||||||
x = 21 * GUI_GRID_W;
|
text = "";
|
||||||
y = 16 * GUI_GRID_H;
|
x = 21.1 * GUI_GRID_W + GUI_GRID_CENTER_X;
|
||||||
|
y = 17.45 * GUI_GRID_H;
|
||||||
w = 24 * GUI_GRID_W;
|
w = 24 * GUI_GRID_W;
|
||||||
h = 1.5 * GUI_GRID_H;
|
h = GUI_GRID_H;
|
||||||
|
sizeEx = GUI_GRID_H;
|
||||||
};
|
};
|
||||||
class RscInteractionText_right: RscText{
|
class IconMMB: IconLMB {
|
||||||
style = 1; // right aligned text
|
idc = IDC_MOUSEHINT_MMB;
|
||||||
};
|
|
||||||
|
|
||||||
class RscTitles {
|
|
||||||
class GVAR(InteractionHelper) {
|
|
||||||
idd = 9930;
|
|
||||||
enableSimulation = 1;
|
|
||||||
movingEnable = 0;
|
|
||||||
fadeIn=0.5;
|
|
||||||
fadeOut=0.5;
|
|
||||||
duration = 10e10;
|
|
||||||
onLoad = "uiNamespace setVariable ['ACE_Helper_Display', _this select 0];";
|
|
||||||
|
|
||||||
class controls {
|
|
||||||
class SelectIcon: RscInteractionHelperIcon{
|
|
||||||
idc = 1200;
|
|
||||||
text = QPATHTOF(UI\mouse_left_ca.paa);
|
|
||||||
y = 17.5 * GUI_GRID_H;
|
|
||||||
};
|
|
||||||
class SelectText: RscInteractionText{
|
|
||||||
idc = 1000;
|
|
||||||
y = 17 * GUI_GRID_H;
|
|
||||||
text = CSTRING(MakeSelection);
|
|
||||||
};
|
|
||||||
class GoBackIcon: RscInteractionHelperIcon{
|
|
||||||
idc = 1201;
|
|
||||||
text = QPATHTOF(UI\mouse_right_ca.paa);
|
|
||||||
y = 19.5 * GUI_GRID_H;
|
|
||||||
};
|
|
||||||
class GoBackText: RscInteractionText{
|
|
||||||
idc = 1001;
|
|
||||||
y = 19 * GUI_GRID_H;
|
|
||||||
text = CSTRING(Back);
|
|
||||||
};
|
|
||||||
class ScrollIcon: RscInteractionHelperIcon{
|
|
||||||
idc = 1202;
|
|
||||||
text = QPATHTOF(UI\mouse_scroll_ca.paa);
|
text = QPATHTOF(UI\mouse_scroll_ca.paa);
|
||||||
|
y = 18.55 * GUI_GRID_H;
|
||||||
|
};
|
||||||
|
class TextMMB: TextLMB {
|
||||||
|
idc = IDC_MOUSEHINT_MMB_TEXT;
|
||||||
y = 18.5 * GUI_GRID_H;
|
y = 18.5 * GUI_GRID_H;
|
||||||
};
|
};
|
||||||
class ScrollText: RscInteractionText{
|
class IconRMB: IconLMB {
|
||||||
idc = 1002;
|
idc = IDC_MOUSEHINT_RMB;
|
||||||
y = 18 * GUI_GRID_H;
|
text = QPATHTOF(UI\mouse_right_ca.paa);
|
||||||
text = CSTRING(ScrollHint);
|
y = 19.6 * GUI_GRID_H;
|
||||||
|
};
|
||||||
|
class TextRMB: TextLMB {
|
||||||
|
idc = IDC_MOUSEHINT_RMB_TEXT;
|
||||||
|
y = 19.55 * GUI_GRID_H;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class GVAR(RscExtraKey): RscControlsGroupNoScrollbars {
|
||||||
|
idc = IDC_MOUSEHINT_EXTRA;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
w = 40 * GUI_GRID_W;
|
||||||
|
h = GUI_GRID_H;
|
||||||
|
class controls {
|
||||||
|
class Name: RscText {
|
||||||
|
idc = IDC_MOUSEHINT_EXTRA_NAME;
|
||||||
|
style = 1;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
w = 21.5 * GUI_GRID_W + GUI_GRID_CENTER_X;
|
||||||
|
h = GUI_GRID_H;
|
||||||
|
sizeEx = GUI_GRID_H;
|
||||||
|
font = "EtelkaMonospaceProBold";
|
||||||
|
};
|
||||||
|
class Text: RscText {
|
||||||
|
idc = IDC_MOUSEHINT_EXTRA_TEXT;
|
||||||
|
x = 21.1 * GUI_GRID_W + GUI_GRID_CENTER_X;
|
||||||
|
y = 0;
|
||||||
|
w = 24 * GUI_GRID_W;
|
||||||
|
h = GUI_GRID_H;
|
||||||
|
sizeEx = GUI_GRID_H;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Garth de Wet (LH)
|
* Author: Garth de Wet (LH)
|
||||||
* Hides the interaction helper text with the mouse buttons at the bottom middle of the screen
|
* Hides the interaction hint for mouse buttons.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
@ -10,14 +10,12 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ace_interaction_fnc_hideMouseHint
|
* [] call ace_interaction_fnc_hideMouseHint
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (isNull (uiNamespace getVariable ["ACE_Helper_Display", objNull])) exitWith {};
|
(QGVAR(RscMouseHint) call BIS_fnc_rscLayer) cutFadeOut 0.2;
|
||||||
|
|
||||||
(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
|
||||||
|
|
||||||
// Re-enable action menu
|
// Re-enable action menu
|
||||||
inGameUISetEventHandler ["PrevAction", "false"];
|
inGameUISetEventHandler ["PrevAction", "false"];
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Garth de Wet (LH)
|
* Author: Garth de Wet (LH), mharis001
|
||||||
* Shows the interaction helper text with the mouse buttons at the bottom middle of the screen.
|
* Shows an interaction hint for mouse buttons.
|
||||||
|
* Empty strings will hide their respective button.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Left Click Text <STRING>
|
* 0: Left click text <STRING>
|
||||||
* 1: Right Click Text <STRING>
|
* 1: Right click text <STRING>
|
||||||
* 2: Scroll Text <STRING> (default: "")
|
* 2: Scroll text <STRING> (default: "")
|
||||||
* 2: Extra Icon/Text pairs <ARRAY> (default: [])
|
* 2: Extra icon/text pairs <ARRAY> (default: [])
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -18,63 +19,77 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GUI_GRID_W (0.025)
|
params ["_textLMB", "_textRMB", ["_textMMB", ""], ["_extraIconSets", []]];
|
||||||
#define GUI_GRID_H (0.04)
|
|
||||||
|
|
||||||
params ["_leftClick", "_rightClick", ["_scroll", ""], ["_extraIconSets", []]];
|
(QGVAR(RscMouseHint) call BIS_fnc_rscLayer) cutRsc [QGVAR(RscMouseHint), "PLAIN", -1, false];
|
||||||
|
private _display = uiNamespace getVariable [QGVAR(mouseHint), displayNull];
|
||||||
|
|
||||||
(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN", 0.5, false];
|
// Set text for buttons, hide if empty string
|
||||||
|
{
|
||||||
|
_x params ["_buttonText", "_iconIDC", "_textIDC"];
|
||||||
|
|
||||||
disableSerialization;
|
if (_buttonText == "") then {
|
||||||
|
private _ctrlIcon = _display displayCtrl _iconIDC;
|
||||||
private _display = uiNamespace getVariable ["ACE_Helper_Display", objNull];
|
_ctrlIcon ctrlShow false;
|
||||||
|
|
||||||
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 {
|
} else {
|
||||||
_offset = _offset + 1;
|
private _ctrlText = _display displayCtrl _textIDC;
|
||||||
(_display displayCtrl 1002) ctrlSetText _scroll;
|
_ctrlText ctrlSetText _buttonText;
|
||||||
|
};
|
||||||
|
} forEach [
|
||||||
|
[_textLMB, IDC_MOUSEHINT_LMB, IDC_MOUSEHINT_LMB_TEXT],
|
||||||
|
[_textMMB, IDC_MOUSEHINT_MMB, IDC_MOUSEHINT_MMB_TEXT],
|
||||||
|
[_textRMB, IDC_MOUSEHINT_RMB, IDC_MOUSEHINT_RMB_TEXT]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Y offset for extra icon sets
|
||||||
|
private _yOffset = 19.5;
|
||||||
|
|
||||||
|
if (_textMMB == "") then {
|
||||||
|
// Move RMB up if MMB inactive
|
||||||
|
{
|
||||||
|
private _ctrl = _display displayCtrl _x;
|
||||||
|
private _ctrlPos = ctrlPosition _ctrl;
|
||||||
|
_ctrlPos set [1, (_ctrlPos select 1) - 1.05 * GUI_GRID_H];
|
||||||
|
_ctrl ctrlSetPosition _ctrlPos;
|
||||||
|
_ctrl ctrlCommit 0;
|
||||||
|
} forEach [IDC_MOUSEHINT_RMB, IDC_MOUSEHINT_RMB_TEXT];
|
||||||
|
|
||||||
|
} else {
|
||||||
// Disable action menu
|
// Disable action menu
|
||||||
inGameUISetEventHandler ["PrevAction", "true"];
|
inGameUISetEventHandler ["PrevAction", "true"];
|
||||||
inGameUISetEventHandler ["NextAction", "true"];
|
inGameUISetEventHandler ["NextAction", "true"];
|
||||||
inGameUISetEventHandler ["Action", "true"];
|
inGameUISetEventHandler ["Action", "true"];
|
||||||
|
|
||||||
|
// Increase offset since MMB active
|
||||||
|
_yOffset = 20.55;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Create extra icon sets
|
||||||
{
|
{
|
||||||
_x params [["_xKeyName", "", [""]], ["_xText", "", [""]]];
|
_x params [["_keyName", "", [""]], ["_keyText", "", [""]]];
|
||||||
switch (toLower _xKeyName) do {
|
|
||||||
case ("alt"): {_xKeyName = format ["<%1>", toUpper localize "str_dik_alt"];};
|
// Only create extra key if both name and text are valid
|
||||||
case ("control");
|
if (_keyName != "" && {_keyText != ""}) then {
|
||||||
case ("ctrl"): {_xKeyName = format ["<%1>", toUpper localize "str_dik_control"];};
|
// Localize Ctrl, Shift, or Alt keys
|
||||||
case ("shift"): {_xKeyName = format ["<%1>", toUpper localize "str_dik_shift"];};
|
switch (toLower _keyName) do {
|
||||||
|
case "ctrl";
|
||||||
|
case "control": {_keyName = format ["<%1>", toUpper localize "STR_dik_control"]};
|
||||||
|
case "shift": {_keyName = format ["<%1>", toUpper localize "STR_dik_shift"]};
|
||||||
|
case "alt": {_keyName = format ["<%1>", toUpper localize "STR_dik_alt"]};
|
||||||
};
|
};
|
||||||
|
|
||||||
private _keyNameCtrl = _display ctrlCreate ["RscInteractionText_right", -1];
|
// Create extra key group and update position
|
||||||
private _textCtrl = _display ctrlCreate ["RscInteractionText", -1];
|
private _ctrlGroup = _display ctrlCreate [QGVAR(RscExtraKey), IDC_MOUSEHINT_EXTRA];
|
||||||
_keyNameCtrl ctrlSetText _xKeyName;
|
_ctrlGroup ctrlSetPosition [0, _yOffset * GUI_GRID_H];
|
||||||
_textCtrl ctrlSetText _xText;
|
_ctrlGroup ctrlCommit 0;
|
||||||
_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;
|
|
||||||
|
|
||||||
|
// Set name and text
|
||||||
|
private _ctrlName = _ctrlGroup controlsGroupCtrl IDC_MOUSEHINT_EXTRA_NAME;
|
||||||
|
_ctrlName ctrlSetText _keyName;
|
||||||
|
|
||||||
|
private _ctrlText = _ctrlGroup controlsGroupCtrl IDC_MOUSEHINT_EXTRA_TEXT;
|
||||||
|
_ctrlText ctrlSetText _keyText;
|
||||||
|
|
||||||
|
_yOffset = _yOffset + 1;
|
||||||
|
};
|
||||||
|
} forEach _extraIconSets;
|
||||||
|
@ -16,6 +16,20 @@
|
|||||||
|
|
||||||
#include "\z\ace\addons\main\script_macros.hpp"
|
#include "\z\ace\addons\main\script_macros.hpp"
|
||||||
|
|
||||||
|
#include "\a3\ui_f\hpp\defineCommonGrids.inc"
|
||||||
|
|
||||||
|
#define IDD_MOUSEHINT 2400
|
||||||
|
#define IDC_MOUSEHINT_LMB 2410
|
||||||
|
#define IDC_MOUSEHINT_LMB_TEXT 2420
|
||||||
|
#define IDC_MOUSEHINT_MMB 2430
|
||||||
|
#define IDC_MOUSEHINT_MMB_TEXT 2450
|
||||||
|
#define IDC_MOUSEHINT_RMB 2460
|
||||||
|
#define IDC_MOUSEHINT_RMB_TEXT 2470
|
||||||
|
|
||||||
|
#define IDC_MOUSEHINT_EXTRA 2500
|
||||||
|
#define IDC_MOUSEHINT_EXTRA_NAME 2510
|
||||||
|
#define IDC_MOUSEHINT_EXTRA_TEXT 2520
|
||||||
|
|
||||||
#define MACRO_DOOR_REACH_DISTANCE (AGLToASL positionCameraToWorld [0,0,0] vectorDistance AGLToASL (ACE_player modelToWorld (ACE_player selectionPosition "Head"))) + 2
|
#define MACRO_DOOR_REACH_DISTANCE (AGLToASL positionCameraToWorld [0,0,0] vectorDistance AGLToASL (ACE_player modelToWorld (ACE_player selectionPosition "Head"))) + 2
|
||||||
|
|
||||||
#define DISABLED_LAMP_DAMAGE 0.95
|
#define DISABLED_LAMP_DAMAGE 0.95
|
||||||
|
Loading…
Reference in New Issue
Block a user