ACE3/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf
PiZZAD0X 9e609b3394 Arsenal - Add Ability to Transfer a Loadout from Saved to Default (#6793)
* Added weight override parameter to ace_dragging_fnc_setCarryable/setDraggable

- Additional optional parameter that ignores the `startCarry`/`startDrag` weight checks.
- Minor `==` to `isEqualto` replacements

* `count crew _target isEqualto -1` to `count crew _target isEqualto 0`

* Tab Replacement

- remove \t

* Reverted UAV check, Params formatting, Lazy Eval

* Update addons/dragging/functions/fnc_startCarry.sqf

Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com>

* Update fnc_startDrag.sqf

* Remove beta suggestion extra line additions

* Update addons/dragging/functions/fnc_startDrag.sqf

Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com>

* Added ability to export loadout to defaultloadouts

Shift + LMB on save button can export the selected saved loadout to the mission loadouts. Experimental Test. Warrants a separate button if there is enough demand.

* Update fnc_buttonLoadoutsSave.sqf

* Update addons/arsenal/functions/fnc_buttonLoadoutsSave.sqf

Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com>

* Add usage info to tooltip
2019-02-23 19:35:13 -06:00

83 lines
2.7 KiB
Plaintext

#include "script_component.hpp"
#include "..\defines.hpp"
/*
* Author: Alganthe
* Handles tab changing for the loadouts display.
*
* Arguments:
* 0: Arsenal display <DISPLAY>
* 1: Tab control <CONTROL>
*
* Return Value:
* None
*
* Public: No
*/
params ["_display", "_control"];
if !(ctrlEnabled _control || {GVAR(currentLoadoutsTab) == ctrlIDC _control}) exitWith {};
private _centerBoxTitleCtrl = _display displayCtrl IDC_centerTitle;
private _shareButtonCtrl = _display displayCtrl IDC_buttonShare;
private _saveButtonCtrl = _display displayCtrl IDC_buttonSave;
private _loadButtonCtrl = _display displayCtrl IDC_buttonLoad;
private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete;
private _renameButtonCtrl = _display displayCtrl IDC_buttonRename;
// Update UI visual elements
if (GVAR(currentLoadoutsTab) != -1) then {
private _previousCtrlBackground = _display displayCtrl (GVAR(currentLoadoutsTab) - 1);
_previousCtrlBackground ctrlSetBackgroundColor [0, 0, 0, 0.8];
_previousCtrlBackground ctrlCommit 0;
private _previousCtrl = _display displayCtrl GVAR(currentLoadoutsTab);
_previousCtrl ctrlSetTextColor [1, 1, 1, 1];
_previousCtrl ctrlCommit 0;
};
private _ctrlBackground = _display displayCtrl ((ctrlIDC _control) - 1);
_ctrlBackground ctrlSetBackgroundColor [1, 1, 1, 0.8];
_ctrlBackground ctrlCommit 0;
_control ctrlSetTextColor [0, 0, 0, 1];
_control ctrlCommit 0;
switch (ctrlIDC _control) do {
case IDC_buttonMyLoadouts: {
_centerBoxTitleCtrl ctrlSetText (localize LSTRING(tabMyLoadoutsText));
if (is3den) then { _saveButtonCtrl ctrlSetTooltip format ["%1\n%2", localize LSTRING(buttonSaveTooltip), localize LSTRING(buttonSaveTooltip_shiftClick)]; };
_saveButtonCtrl ctrlEnable true;
_saveButtonCtrl ctrlCommit 0;
};
case IDC_buttonDefaultLoadouts: {
_centerBoxTitleCtrl ctrlSetText (localize LSTRING(tabDefaultLoadoutsText));
if (is3den) then { _saveButtonCtrl ctrlSetTooltip localize LSTRING(buttonSaveTooltip); };
_saveButtonCtrl ctrlEnable (is3DEN);
_saveButtonCtrl ctrlCommit 0;
};
case IDC_buttonSharedLoadouts: {
_centerBoxTitleCtrl ctrlSetText (localize LSTRING(tabSharedLoadoutsText));
if (is3den) then { _saveButtonCtrl ctrlSetTooltip localize LSTRING(buttonSaveTooltip); };
_saveButtonCtrl ctrlEnable false;
_saveButtonCtrl ctrlCommit 0;
};
};
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_shareButtonCtrl, _loadButtonCtrl, _deleteButtonCtrl, _renameButtonCtrl];
GVAR(currentLoadoutsTab) = ctrlIDC _control;
[QGVAR(loadoutsTabChanged), [_display, _control]] call CBA_fnc_localEvent;
[_display, _control] call FUNC(fillLoadoutsList);