Finish button logic, start adding filling and button funcs

This commit is contained in:
Josuan Albin
2017-10-24 02:11:56 +02:00
parent e8feca9876
commit e0bcc7023b
13 changed files with 158 additions and 57 deletions

View File

@ -5,9 +5,9 @@ PREP(buttonClearAll);
PREP(buttonExport);
PREP(buttonHide);
PREP(buttonImport);
PREP(buttonLoadoutsDelete);
PREP(buttonLoadoutsLoad);
PREP(buttonLoadoutsSave);
PREP(buttonLoadoutsSaveAs);
PREP(buttonLoadoutsShare);
PREP(clearSearchbar);
PREP(fillLeftPanel);

View File

@ -99,9 +99,9 @@
#define IDC_centerTitle 301
#define IDC_contentPanel 302
#define IDC_buttonSave 303
#define IDC_buttonSaveAs 304
#define IDC_buttonLoad 305
#define IDC_buttonShare 306
#define IDC_buttonLoad 304
#define IDC_buttonShare 305
#define IDC_buttonDelete 306
#define IDC_buttonMyLoadouts 401
#define IDC_buttonDefaultLoadouts 402
#define IDC_buttonSharedLoadouts 403
@ -261,3 +261,4 @@
[hmd GVAR(center)],\
[binocular GVAR(center)]\
]

View File

@ -0,0 +1,4 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];

View File

@ -6,3 +6,4 @@ params ["_display", "_control"];
systemChat str [_display, _control];
if !(ctrlEnabled _control) exitWith {};

View File

@ -6,3 +6,9 @@ params ["_display", "_control"];
systemChat str [_display, _control];
if !(ctrlEnabled _control) exitWith {};
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
private _contentPanelRow = lnbCurSelRow _contentPanelCtrl;
private _loadoutName = _contentPanelCtrl lnbText [_contentPanelRow, 1];
profileNamespace setVariable [QGVAR(saved_loadouts), [_loadoutName, getUnitLoadout GVAR(center)]];

View File

@ -1,8 +0,0 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
systemChat str [_display, _control];
if !(ctrlEnabled _control) exitWith {};

View File

@ -1,2 +1,38 @@
#include "script_component.hpp"
#include "..\defines.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
private _contentListCtrl = _display displayCtrl IDC_contentPanel;
_contentListCtrl lnbSetCurSelRow -1;
lnbClear _contentListCtrl;
private _data = profileNamespace getvariable [QGVAR(saved_loadouts),[]];
if (ctrlIDC _control == IDC_buttonMyLoadouts) then {
{
_x params ["_loadoutName", "_loadoutData"];
private _newRow = _contentListCtrl lnbAddRow ["",_loadoutName];
_contentListCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 0) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 3], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 1) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 4], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 2) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 5], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 3) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 4) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadoutData select 5) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadoutData select 6) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadoutData select 7) >> "picture")];
if (false) then {
_contentListCtrl lnbSetColor [[_newRow, 0], [1, 1, 1, 0.25]];
_contentListCtrl lbSetValue [_newRow, -1];
};
_contentListCtrl lnbSort [1, false];
} foreach _data;
} else {
};

View File

@ -5,48 +5,33 @@ params ["_display", "_control"];
systemChat str [_display, _control];
if !(ctrlEnabled _control) exitWith {};
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 _saveAsButtonCtrl = _display displayCtrl IDC_buttonSaveAs;
private _loadButtonCtrl = _display displayCtrl IDC_buttonLoad;
private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete;
switch (ctrlIDC _control) do {
case IDC_buttonMyLoadouts: {
_centerBoxTitleCtrl ctrlSetText "My loadouts"; // TBL
_shareButtonCtrl ctrlEnable ([false, true] select (GVAR(allowSharedLoadouts)));
_saveButtonCtrl ctrlEnable true;
_shareButtonCtrl ctrlCommit 0;
_saveButtonCtrl ctrlCommit 0;
// Call filling func
};
case IDC_buttonDefaultLoadouts: {
_centerBoxTitleCtrl ctrlSetText "Default loadouts"; // TBL
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_shareButtonCtrl, _saveButtonCtrl];
// Call filling func
};
case IDC_buttonSharedLoadouts: {
_centerBoxTitleCtrl ctrlSetText "Shared loadouts"; // TBL
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_shareButtonCtrl, _saveButtonCtrl];
// Call filling func
};
};
};
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_saveButtonCtrl, _shareButtonCtrl, _loadButtonCtrl, _deleteButtonCtrl];
[_display, _control] call FUNC(fillLoadoutsList);
GVAR(currentLoadoutsTab) = ctrlIDC _control;

View File

@ -5,6 +5,8 @@
params ["", "_args"];
_args params ["_display", "_keyPressed", "_shiftState", "_ctrlState", "_altState"];
if !((findDisplay IDD_loadouts_display) isEqualTo displayNull) exitWith {};
GVAR(shiftState) = _shiftState;
private _return = true;

View File

@ -2,4 +2,14 @@
#include "..\defines.hpp"
params ["", "_args"];
_args params ["_display"];
_args params ["_display"];
GVAR(currentLoadoutsTab) = nil;
private _arsenalDisplay = findDisplay IDD_ace_arsenal;
private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock;
_mouseBlockCtrl ctrlEnable false;
_mouseBlockCtrl ctrlCommit 0;
[_arsenalDisplay] call FUNC(buttonHide);

View File

@ -4,7 +4,19 @@
params ["", "_args"];
_args params ["_display"];
systemChat str _display;
private _arsenalDisplay = findDisplay IDD_ace_arsenal;
private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock;
_mouseBlockCtrl ctrlEnable true;
_mouseBlockCtrl ctrlCommit 0;
[_arsenalDisplay] call FUNC(buttonHide);
GVAR(currentLoadoutsTab) = -1;
private _panelContentCtrl = _display displayCtrl IDC_contentPanel;
_panelContentCtrl ctrlSetFontHeight (GVAR(fontHeight) * GRID_H);
_panelContentCtrl ctrlCommit 0;
if !(GVAR(allowDefaultLoadouts)) then {
private _buttonDefaultLoadoutsCtrl = _display displayCtrl IDC_buttonDefaultLoadouts;

View File

@ -1,2 +1,54 @@
#include "script_component.hpp"
#include "..\defines.hpp"
#include "..\defines.hpp"
params ["_display", "_control", "_curSel"];
systemChat str _curSel;
private _shareButtonCtrl = _display displayCtrl IDC_buttonShare;
private _saveButtonCtrl = _display displayCtrl IDC_buttonSave;
private _loadButtonCtrl = _display displayCtrl IDC_buttonLoad;
private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete;
switch (GVAR(currentLoadoutsTab)) do {
case IDC_buttonMyLoadouts: {
_loadButtonCtrl ctrlEnable ([false, true] select ((_control lbValue _curSel) >= 0));
_loadButtonCtrl ctrlCommit 0;
_shareButtonCtrl ctrlEnable ([false, true] select (GVAR(allowSharedLoadouts)));
_shareButtonCtrl ctrlCommit 0;
_saveButtonCtrl ctrlEnable true;
_saveButtonCtrl ctrlCommit 0;
{
_x ctrlEnable (_curSel >= 0);
_x ctrlCommit 0;
} foreach [_saveButtonCtrl, _deleteButtonCtrl];
};
case IDC_buttonDefaultLoadouts: {
_loadButtonCtrl ctrlEnable ([false, true] select ((_control lbValue _curSel) >= 0));
_loadButtonCtrl ctrlCommit 0;
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_shareButtonCtrl, _saveButtonCtrl, _deleteButtonCtrl];
};
case IDC_buttonSharedLoadouts: {
_loadButtonCtrl ctrlEnable ([false, true] select ((_control lbValue _curSel) >= 0));
_loadButtonCtrl ctrlCommit 0;
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_shareButtonCtrl, _saveButtonCtrl, _deleteButtonCtrl];
};
};

View File

@ -173,7 +173,7 @@ class GVAR(display) {
x = QUOTE(25 * GRID_W);
text="Loadouts"; // TBL
tooltip="Displays loadouts screen"; // TBL
onButtonClick = QUOTE(ctrlparent (_this select 0) createDisplay QQGVAR(loadoutsDisplay));
onButtonClick = QUOTE(createDialog QQGVAR(loadoutsDisplay));
};
class buttonExport: buttonHide {
idc = -1;
@ -747,7 +747,7 @@ class GVAR(loadoutsDisplay) {
h = QUOTE(5 * GRID_H);
};
class contentPanel: RscListnBox {
idc = IDC_contentPanel
idc = IDC_contentPanel;
colorBackground[]={0,0,0,0};
colorSelectBackground[]={1,1,1,0.5};
colorSelectBackground2[]={1,1,1,0.5};
@ -755,10 +755,10 @@ class GVAR(loadoutsDisplay) {
colorSelect[]={1,1,1,1};
colorSelect2[]={1,1,1,1};
colorPictureRightSelected[]={1,1,1,1};
columns[]={0.10, 0.20, 0.75};
columns[]={0, 0.10, 0.45, 0.55, 0.65, 0.75, 0.80, 0.85, 0.90, 0.95};
drawSideArrows=0;
disableOverflow=1;
onLBSelChanged = QUOTE(_this call FUNC(onSelChangedLoadouts));
onLBSelChanged = QUOTE([ARR_3(ctrlParent (_this select 0), _this select 0, _this select 1)] call FUNC(onSelChangedLoadouts));
x = QUOTE(0);
y = QUOTE(5 * GRID_H);
w = QUOTE(160 * GRID_W);
@ -776,27 +776,27 @@ class GVAR(loadoutsDisplay) {
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsSave));
colorBackground[] = {0,0,0,0.8};
};
class buttonSaveAs: buttonSave {
idc = IDC_buttonSaveAs;
x = QUOTE(45 * GRID_W);
text="Save as"; // TBL
tooltip="Save loadout as"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsSaveAs));
};
class buttonLoad: buttonSave {
idc = IDC_buttonLoad;
x = QUOTE(85 * GRID_W);
x = QUOTE(45 * GRID_W);
text="Load"; // TBL
tooltip="Load selected loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsLoad));
};
class buttonShare: buttonSave {
idc = IDC_buttonShare;
x = QUOTE(125 * GRID_W);
x = QUOTE(85 * GRID_W);
text="Share"; // TBL
tooltip="Share selected loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsShare));
};
class buttonDelete: buttonSave {
idc = IDC_buttonDelete;
x = QUOTE(125 * GRID_W);
text="Delete"; // TBL
tooltip="Delete loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsDelete));
};
};
};
class buttonBar: ctrlControlsGroupNoScrollbars {