diff --git a/addons/arsenal/functions/fnc_buttonLoadoutsShare.sqf b/addons/arsenal/functions/fnc_buttonLoadoutsShare.sqf index f58686b75c..88c6be9cdb 100644 --- a/addons/arsenal/functions/fnc_buttonLoadoutsShare.sqf +++ b/addons/arsenal/functions/fnc_buttonLoadoutsShare.sqf @@ -3,6 +3,28 @@ params ["_display", "_control"]; -systemChat str [_display, _control]; - if !(ctrlEnabled _control) exitWith {}; + +private _contentPanelCtrl = _display displayCtrl IDC_contentPanel; +private _contentPanelCursSel = lnbCurSelRow _contentPanelCtrl; +private _loadoutName = _contentPanelCtrl lnbText [_contentPanelCursSel, 1]; +private _profileName = profileName; // GVAR(center) could be a remote unit +private _loadoutVar = _profileName + _loadoutName; + +private _loadoutIndex = GVAR(sharedLoadoutsVars) find _loadoutVar; +private _loadoutData = _contentPanelCtrl getVariable _loadoutName; + +if (_loadoutIndex > -1) then { + GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true]; + GVAR(sharedLoadoutsVars) = GVAR(sharedLoadoutsVars) - [_loadoutVar]; + + _contentPanelCtrl lnbSetText [[_contentPanelCursSel, 0], ""]; + +} else { + GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, [_profileName ,_loadoutName , _loadoutData], true]; + GVAR(sharedLoadoutsVars) pushBackUnique _loadoutVar; + + _contentPanelCtrl lnbSetText [[_contentPanelCursSel, 0], "X"]; +}; + +publicVariable QGVAR(sharedLoadoutsVars); \ No newline at end of file diff --git a/addons/arsenal/functions/fnc_fillLoadoutsList.sqf b/addons/arsenal/functions/fnc_fillLoadoutsList.sqf index 41f62b67ac..302be8a52b 100644 --- a/addons/arsenal/functions/fnc_fillLoadoutsList.sqf +++ b/addons/arsenal/functions/fnc_fillLoadoutsList.sqf @@ -21,6 +21,13 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then { private _newRow = _contentListCtrl lnbAddRow ["",_loadoutName]; + if (GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts) then { + + _contentListCtrl lnbSetColumnsPos [0, 0, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90]; + } else { + _contentListCtrl lnbSetColumnsPos [0, 0.05, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90]; + }; + _contentListCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadout select 0) select 0) >> "picture")]; _contentListCtrl lnbSetPicture [[_newRow, 3], getText (configFile >> "cfgWeapons" >> ((_loadout select 1) select 0) >> "picture")]; _contentListCtrl lnbSetPicture [[_newRow, 4], getText (configFile >> "cfgWeapons" >> ((_loadout select 2) select 0) >> "picture")]; @@ -41,9 +48,14 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then { }; _contentListCtrl setVariable [_loadoutName, _loadout]; + + if ((profileName + _loadoutName) in GVAR(sharedLoadoutsVars)) then { + _contentListCtrl lnbSetText [[_newRow, 0], "X"]; + }; } foreach ([_data, ([GVAR(defaultLoadoutsList), []] select (isNil QGVAR(defaultLoadoutsList)))] select (ctrlIDC _control == IDC_buttonDefaultLoadouts)); } else { + //TODO }; _contentListCtrl lnbSort [1, false]; \ No newline at end of file diff --git a/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf b/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf index a27e75a1a6..ed3bb6e36c 100644 --- a/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf +++ b/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf @@ -15,14 +15,23 @@ private _renameButtonCtrl = _display displayCtrl IDC_buttonRename; switch (ctrlIDC _control) do { case IDC_buttonMyLoadouts: { _centerBoxTitleCtrl ctrlSetText "My loadouts"; // TBL + + _saveButtonCtrl ctrlEnable true; + _saveButtonCtrl ctrlCommit 0; }; case IDC_buttonDefaultLoadouts: { _centerBoxTitleCtrl ctrlSetText "Default loadouts"; // TBL + + _saveButtonCtrl ctrlEnable false; + _saveButtonCtrl ctrlCommit 0; }; case IDC_buttonSharedLoadouts: { _centerBoxTitleCtrl ctrlSetText "Shared loadouts"; // TBL + + _saveButtonCtrl ctrlEnable false; + _saveButtonCtrl ctrlCommit 0; }; }; @@ -31,6 +40,6 @@ switch (ctrlIDC _control) do { _x ctrlCommit 0; } foreach [_shareButtonCtrl, _loadButtonCtrl, _deleteButtonCtrl, _renameButtonCtrl]; -[_display, _control] call FUNC(fillLoadoutsList); - GVAR(currentLoadoutsTab) = ctrlIDC _control; + +[_display, _control] call FUNC(fillLoadoutsList); diff --git a/addons/arsenal/functions/fnc_onArsenalOpen.sqf b/addons/arsenal/functions/fnc_onArsenalOpen.sqf index c923e1d633..474cd4b559 100644 --- a/addons/arsenal/functions/fnc_onArsenalOpen.sqf +++ b/addons/arsenal/functions/fnc_onArsenalOpen.sqf @@ -14,6 +14,15 @@ if (isNil QGVAR(mode)) then { GVAR(mode) = 1; }; +if (isNil QGVAR(sharedLoadoutsNamespace)) then { + GVAR(sharedLoadoutsNamespace) = true call CBA_fnc_createNamespace; + publicVariable QGVAR(sharedLoadoutsNamespace); +}; + +if (isNil QGVAR(sharedLoadoutsVars)) then { + GVAR(sharedLoadoutsVars) = []; +}; + if (isNil QGVAR(virtualItems)) then { GVAR(virtualItems) = [[[], [], []], [[], [], [], []], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]; };