mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Arsenal - Cleanup action UI code (#9784)
* Arsenal - Cleanup action UI code * derp
This commit is contained in:
parent
a47ae27080
commit
95ec6eb765
@ -489,3 +489,6 @@ if (!isNil QGVAR(customRightPanelButtons)) then {\
|
|||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "CfgVehicles" >> (_loadout select IDX_LOADOUT_BACKPACK) select 0 >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "CfgVehicles" >> (_loadout select IDX_LOADOUT_BACKPACK) select 0 >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (_cfgWeapons >> _loadout select IDX_LOADOUT_HEADGEAR >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (_cfgWeapons >> _loadout select IDX_LOADOUT_HEADGEAR >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "CfgGlasses" >> _loadout select IDX_LOADOUT_GOGGLES >> "picture")];
|
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "CfgGlasses" >> _loadout select IDX_LOADOUT_GOGGLES >> "picture")];
|
||||||
|
|
||||||
|
#define ACTION_TYPE_TEXT 0
|
||||||
|
#define ACTION_TYPE_BUTTON 1
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: johnb43
|
* Author: johnb43
|
||||||
* Adds custom action buttons.
|
* Adds custom action buttons.
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Brett Mayson
|
* Author: Brett Mayson
|
||||||
* Create the internal actions arrays when needed for the first time.
|
* Create the internal actions arrays when needed for the first time.
|
||||||
|
@ -47,7 +47,7 @@ private _groups = (GVAR(actionList) select _panel) select {
|
|||||||
private _show = _groups isNotEqualTo [];
|
private _show = _groups isNotEqualTo [];
|
||||||
private _actionsBoxCtrl = _display displayCtrl IDC_actionsBox;
|
private _actionsBoxCtrl = _display displayCtrl IDC_actionsBox;
|
||||||
_actionsBoxCtrl ctrlShow _show;
|
_actionsBoxCtrl ctrlShow _show;
|
||||||
_actionsBoxCtrl ctrlCommit 0.15;
|
_actionsBoxCtrl ctrlCommit FADE_DELAY;
|
||||||
|
|
||||||
if (!_show) exitWith {};
|
if (!_show) exitWith {};
|
||||||
|
|
||||||
@ -77,7 +77,6 @@ private _items = _group select 3 select {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_actionsCurrentPageCtrl ctrlSetText (_group select 1);
|
_actionsCurrentPageCtrl ctrlSetText (_group select 1);
|
||||||
_actionsCurrentPageCtrl ctrlSetFade 0;
|
|
||||||
_actionsCurrentPageCtrl ctrlShow true;
|
_actionsCurrentPageCtrl ctrlShow true;
|
||||||
_actionsCurrentPageCtrl ctrlCommit 0;
|
_actionsCurrentPageCtrl ctrlCommit 0;
|
||||||
|
|
||||||
@ -85,36 +84,22 @@ private _activeCtrls = [];
|
|||||||
{
|
{
|
||||||
_x params ["", "_type", "_label", "_statement"];
|
_x params ["", "_type", "_label", "_statement"];
|
||||||
|
|
||||||
private _idc = IDC_actionsText1 + _forEachIndex * 2;
|
private _idc = IDC_actionsText1 + _type + _forEachIndex * 2;
|
||||||
private _actionTextCtrl = _display displayCtrl _idc;
|
private _actionCtrl = _display displayCtrl _idc;
|
||||||
private _actionButtonCtrl = _display displayCtrl (_idc + 1);
|
|
||||||
|
|
||||||
switch (_type) do {
|
switch (_type) do {
|
||||||
case ACTION_TYPE_BUTTON: {
|
case ACTION_TYPE_BUTTON: {
|
||||||
_actionButtonCtrl ctrlRemoveAllEventHandlers "ButtonClick";
|
_actionCtrl ctrlRemoveAllEventHandlers "ButtonClick";
|
||||||
_actionButtonCtrl ctrlAddEventHandler ["ButtonClick", {
|
_actionCtrl ctrlAddEventHandler ["ButtonClick", {
|
||||||
if (is3DEN) exitWith {[true] call FUNC(refresh)};
|
if (is3DEN) exitWith {[true] call FUNC(refresh)};
|
||||||
[{
|
[{
|
||||||
[true] call FUNC(refresh);
|
[true] call FUNC(refresh);
|
||||||
}] call CBA_fnc_execNextFrame;
|
}] call CBA_fnc_execNextFrame;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if (_activeCtrls isNotEqualTo []) then {
|
_actionCtrl ctrlAddEventHandler ["ButtonClick", _statement];
|
||||||
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
|
_actionCtrl ctrlSetText _label;
|
||||||
_actionButtonCtrl ctrlSetPositionY (_lastPosY + _lastPosH + GRID_H);
|
_actionCtrl ctrlEnable true;
|
||||||
} else {
|
|
||||||
_actionButtonCtrl ctrlSetPositionY (6 * GRID_H);
|
|
||||||
};
|
|
||||||
|
|
||||||
_actionButtonCtrl ctrlAddEventHandler ["ButtonClick", _statement];
|
|
||||||
_actionButtonCtrl ctrlSetText _label;
|
|
||||||
_actionButtonCtrl ctrlSetFade 0;
|
|
||||||
_actionButtonCtrl ctrlEnable true;
|
|
||||||
_actionButtonCtrl ctrlCommit 0;
|
|
||||||
_actionTextCtrl ctrlSetFade 1;
|
|
||||||
_actionTextCtrl ctrlEnable false;
|
|
||||||
_actionTextCtrl ctrlCommit 0;
|
|
||||||
_activeCtrls pushBack _actionButtonCtrl;
|
|
||||||
};
|
};
|
||||||
case ACTION_TYPE_TEXT: {
|
case ACTION_TYPE_TEXT: {
|
||||||
private _text = call _statement;
|
private _text = call _statement;
|
||||||
@ -125,47 +110,35 @@ private _activeCtrls = [];
|
|||||||
if (_text isEqualType []) then {
|
if (_text isEqualType []) then {
|
||||||
_text = _text joinString endl;
|
_text = _text joinString endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_actionCtrl ctrlSetText _text;
|
||||||
|
_actionCtrl ctrlSetPositionH (ctrlTextHeight _actionCtrl);
|
||||||
|
_actionCtrl ctrlEnable false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
if (_activeCtrls isNotEqualTo []) then {
|
if (_activeCtrls isNotEqualTo []) then {
|
||||||
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
|
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
|
||||||
_actionTextCtrl ctrlSetPositionY (_lastPosY + _lastPosH + GRID_H);
|
_actionCtrl ctrlSetPositionY (_lastPosY + _lastPosH + GRID_H);
|
||||||
} else {
|
} else {
|
||||||
_actionTextCtrl ctrlSetPositionY (5 * GRID_H);
|
_actionCtrl ctrlSetPositionY ((5 + _type) * GRID_H);
|
||||||
};
|
};
|
||||||
|
|
||||||
_actionTextCtrl ctrlSetText _text;
|
_actionCtrl ctrlShow true;
|
||||||
_actionTextCtrl ctrlSetPositionH (ctrlTextHeight _actionTextCtrl);
|
_actionCtrl ctrlCommit 0;
|
||||||
_actionTextCtrl ctrlSetFade 0;
|
_activeCtrls pushBack _actionCtrl;
|
||||||
_actionTextCtrl ctrlEnable false;
|
|
||||||
_actionTextCtrl ctrlCommit 0;
|
|
||||||
_actionButtonCtrl ctrlSetFade 1;
|
|
||||||
_actionButtonCtrl ctrlEnable false;
|
|
||||||
_actionButtonCtrl ctrlCommit 0;
|
|
||||||
_activeCtrls pushBack _actionTextCtrl;
|
|
||||||
};
|
|
||||||
default {
|
|
||||||
_actionTextCtrl ctrlSetFade 1;
|
|
||||||
_actionTextCtrl ctrlCommit 0;
|
|
||||||
_actionButtonCtrl ctrlSetFade 1;
|
|
||||||
_actionButtonCtrl ctrlEnable false;
|
|
||||||
_actionButtonCtrl ctrlCommit 0;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach _items;
|
} forEach _items;
|
||||||
|
|
||||||
private _actionCount = count _items;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
private _idc = IDC_actionsText1 + _x * 2;
|
private _idc = ctrlIDC _x;
|
||||||
private _actionTextCtrl = _display displayCtrl _idc;
|
if (_idc < IDC_actionsText1 || _idc > IDC_actionsButton5) then {continue};
|
||||||
private _actionButtonCtrl = _display displayCtrl (_idc + 1);
|
|
||||||
|
|
||||||
_actionTextCtrl ctrlSetFade 1;
|
_x ctrlShow false;
|
||||||
_actionTextCtrl ctrlCommit 0;
|
_x ctrlEnable false;
|
||||||
_actionButtonCtrl ctrlSetFade 1;
|
_x ctrlSetPositionY 0;
|
||||||
_actionButtonCtrl ctrlCommit 0;
|
_x ctrlCommit 0;
|
||||||
} forEach ([0, 1, 2, 3, 4] select [_actionCount, 5]);
|
} forEach ((allControls _actionsBoxCtrl) select {!(_x in _activeCtrls)});
|
||||||
|
|
||||||
private _pos = ctrlPosition _actionsBoxCtrl;
|
|
||||||
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
|
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
|
||||||
private _actionsBoxHeight = _lastPosY + _lastPosH + GRID_H;
|
private _actionsBoxHeight = _lastPosY + _lastPosH + GRID_H;
|
||||||
_actionsBoxCtrl ctrlSetPositionH _actionsBoxHeight;
|
_actionsBoxCtrl ctrlSetPositionH _actionsBoxHeight;
|
||||||
|
@ -15,6 +15,3 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "\z\ace\addons\main\script_macros.hpp"
|
#include "\z\ace\addons\main\script_macros.hpp"
|
||||||
|
|
||||||
#define ACTION_TYPE_BUTTON 0
|
|
||||||
#define ACTION_TYPE_TEXT 1
|
|
||||||
|
@ -467,7 +467,6 @@ class GVAR(display) {
|
|||||||
};
|
};
|
||||||
class actionsText1: RscTextMulti {
|
class actionsText1: RscTextMulti {
|
||||||
idc = IDC_actionsText1;
|
idc = IDC_actionsText1;
|
||||||
fade = 1;
|
|
||||||
x = QUOTE(0 * GRID_W);
|
x = QUOTE(0 * GRID_W);
|
||||||
y = QUOTE(5 * GRID_H);
|
y = QUOTE(5 * GRID_H);
|
||||||
w = QUOTE(45 * GRID_W);
|
w = QUOTE(45 * GRID_W);
|
||||||
@ -479,8 +478,6 @@ class GVAR(display) {
|
|||||||
};
|
};
|
||||||
class actionsButton1: ctrlButton {
|
class actionsButton1: ctrlButton {
|
||||||
idc = IDC_actionsButton1;
|
idc = IDC_actionsButton1;
|
||||||
onMouseEnter = QUOTE(ctrlSetFocus (_this select 0));
|
|
||||||
fade = 1;
|
|
||||||
text = "";
|
text = "";
|
||||||
x = QUOTE(1 * GRID_W);
|
x = QUOTE(1 * GRID_W);
|
||||||
y = QUOTE(6 * GRID_H);
|
y = QUOTE(6 * GRID_H);
|
||||||
|
Loading…
Reference in New Issue
Block a user