mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Arsenal - 3DEN Attribute (#6257)
* Initial commit * Add/remove items and switching between categories * Add ability to change mode * Save attribute and clear button * Search bar and double click to toggle * Add export button * Add attribute init function * Fix multiple selection with different items * Correct bad code and remove unneeded include * Update stringtable.xml From common pbo whitelist (modified) and a3 stringtables * Disable attribute on humans * Move includes to top ref #6407
This commit is contained in:
parent
8a81e3b675
commit
0b19a8d527
188
addons/arsenal/Cfg3DEN.hpp
Normal file
188
addons/arsenal/Cfg3DEN.hpp
Normal file
@ -0,0 +1,188 @@
|
||||
class Cfg3DEN {
|
||||
class Mission {
|
||||
class GVAR(DummyCategory) {
|
||||
displayName = "Dummy attribute, should never show up";
|
||||
class AttributeCategories {
|
||||
class ACE3_Arsenal {
|
||||
class Attributes {
|
||||
class GVAR(DefaultLoadoutsListAttribute) {
|
||||
property = QGVAR(DefaultLoadoutsListAttribute);
|
||||
value = 0;
|
||||
expression = "if !(is3DEN) then {ace_arsenal_defaultLoadoutsList = _value};";
|
||||
defaultValue = "[]";
|
||||
validate = "none";
|
||||
wikiType = "[[Array]]";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
class Attributes {
|
||||
class GVAR(attribute): ctrlControlsGroupNoScrollbars {
|
||||
idc = -1;
|
||||
// onLoad fixes attributeLoad not happening on multiple selection with different attribute
|
||||
onLoad = QUOTE(private _objects = get3DENSelected 'object'; if (count _objects > 1) then {[ARR_2(_this select 0,((_objects select 0) get3DENAttribute QQGVAR(attribute)) select 0)] call FUNC(attributeLoad)});
|
||||
x = QUOTE(0);
|
||||
y = QUOTE(0);
|
||||
w = QUOTE(130 * ATTRIBUTE_W);
|
||||
h = QUOTE(106.83 * ATTRIBUTE_H);
|
||||
attributeLoad = QUOTE([ARR_2(_this,+_value)] call FUNC(attributeLoad));
|
||||
attributeSave = QUOTE(uiNamespace getVariable [ARR_2(QQGVAR(attributeValue),[ARR_2([], 0)])]);
|
||||
class controls {
|
||||
class ModeTitle: ctrlStatic {
|
||||
idc = -1;
|
||||
text = CSTRING(Mode);
|
||||
x = QUOTE(5 * ATTRIBUTE_W);
|
||||
y = QUOTE(0);
|
||||
w = QUOTE(125 * ATTRIBUTE_W);
|
||||
h = QUOTE(5 * ATTRIBUTE_H);
|
||||
};
|
||||
class Mode: ctrlToolbox {
|
||||
idc = IDC_ATTRIBUTE_MODE;
|
||||
onToolBoxSelChanged = QUOTE([ARR_2(ctrlParentControlsGroup (_this select 0), _this select 1)] call FUNC(attributeMode));
|
||||
x = QUOTE(5 * ATTRIBUTE_W);
|
||||
y = QUOTE(5 * ATTRIBUTE_H);
|
||||
w = QUOTE(125 * ATTRIBUTE_W);
|
||||
h = QUOTE(5 * ATTRIBUTE_H);
|
||||
rows = 1;
|
||||
columns = 2;
|
||||
strings[] = {CSTRING(Whitelist), CSTRING(Blacklist)};
|
||||
};
|
||||
class ItemsTitle: ModeTitle {
|
||||
text = CSTRING(Items);
|
||||
y = QUOTE(10 * ATTRIBUTE_H);
|
||||
};
|
||||
class Category: ctrlToolboxPictureKeepAspect {
|
||||
idc = IDC_ATTRIBUTE_CATEGORY;
|
||||
onToolBoxSelChanged = QUOTE([ctrlParentControlsGroup (_this select 0)] call FUNC(attributeAddItems));
|
||||
x = QUOTE(5 * ATTRIBUTE_W);
|
||||
y = QUOTE(15 * ATTRIBUTE_H);
|
||||
w = QUOTE(125 * ATTRIBUTE_W);
|
||||
h = QUOTE(20.83 * ATTRIBUTE_H);
|
||||
rows = 2;
|
||||
columns = 12;
|
||||
strings[] = {
|
||||
"\a3\Ui_F_Curator\Data\RscCommon\RscAttributeInventory\filter_0_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\PrimaryWeapon_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\SecondaryWeapon_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Handgun_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemOptic_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemAcc_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemMuzzle_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemBipod_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoMagAll_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Headgear_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Uniform_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Vest_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Backpack_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Goggles_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\NVGs_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Binoculars_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Map_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Compass_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Radio_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Watch_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\GPS_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoThrow_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoPut_ca.paa",
|
||||
"\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoMisc_ca.paa"
|
||||
};
|
||||
};
|
||||
class ListBackground: ctrlStatic {
|
||||
idc = -1;
|
||||
x = QUOTE(5 * ATTRIBUTE_W);
|
||||
y = QUOTE(35.83 * ATTRIBUTE_H);
|
||||
w = QUOTE(125 * ATTRIBUTE_W);
|
||||
h = QUOTE(65 * ATTRIBUTE_H);
|
||||
colorBackground[] = {1, 1, 1, 0.1};
|
||||
};
|
||||
class List: ctrlListNBox {
|
||||
idc = IDC_ATTRIBUTE_LIST;
|
||||
idcLeft = IDC_ATTRIBUTE_LIST_LEFT;
|
||||
idcRight = IDC_ATTRIBUTE_LIST_RIGHT;
|
||||
onLBDblClick = QUOTE(_this call FUNC(attributeDblClick));
|
||||
x = QUOTE(5 * ATTRIBUTE_W);
|
||||
y = QUOTE(35.83 * ATTRIBUTE_H);
|
||||
w = QUOTE(125 * ATTRIBUTE_W);
|
||||
h = QUOTE(65 * ATTRIBUTE_H);
|
||||
drawSideArrows = 1;
|
||||
disableOverflow = 1;
|
||||
columns[] = {0.05, 0.15, 0.85};
|
||||
};
|
||||
class ArrowLeft: ctrlButton {
|
||||
idc = IDC_ATTRIBUTE_LIST_LEFT;
|
||||
onButtonClick = QUOTE([ARR_2(ctrlParentControlsGroup (_this select 0),false)] call FUNC(attributeSelect));
|
||||
text = SYMBOL_ITEM_NONE;
|
||||
font = "RobotoCondensedBold";
|
||||
x = QUOTE(-1);
|
||||
y = QUOTE(-1);
|
||||
w = QUOTE(5 * ATTRIBUTE_W);
|
||||
H = QUOTE(5 * ATTRIBUTE_H);
|
||||
};
|
||||
class ArrowRight: ArrowLeft {
|
||||
idc = IDC_ATTRIBUTE_LIST_RIGHT;
|
||||
onButtonClick = QUOTE([ARR_2(ctrlParentControlsGroup (_this select 0),true)] call FUNC(attributeSelect));
|
||||
text = SYMBOL_ITEM_VIRTUAL;
|
||||
};
|
||||
class SearchButton: ctrlButtonPicture {
|
||||
idc = IDC_ATTRIBUTE_SEARCH_BUTTON;
|
||||
onButtonClick = QUOTE(((ctrlParentControlsGroup (_this select 0)) controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR) ctrlSetText ''; [ctrlParentControlsGroup (_this select 0)] call FUNC(attributeAddItems));
|
||||
text = "\a3\Ui_f\data\GUI\RscCommon\RscButtonSearch\search_start_ca.paa";
|
||||
x = QUOTE(5 * ATTRIBUTE_W);
|
||||
y = QUOTE(101.83 * ATTRIBUTE_H);
|
||||
w = QUOTE(5 * ATTRIBUTE_W);
|
||||
h = QUOTE(5 * ATTRIBUTE_H);
|
||||
colorBackground[] = {0, 0, 0, 0.5};
|
||||
};
|
||||
class SearchBar: ctrlEdit {
|
||||
idc = IDC_ATTRIBUTE_SEARCHBAR;
|
||||
onKeyUp = QUOTE([ctrlParentControlsGroup (_this select 0)] call FUNC(attributeAddItems));
|
||||
x = QUOTE(11 * ATTRIBUTE_W);
|
||||
y = QUOTE(101.83 * ATTRIBUTE_H);
|
||||
w = QUOTE(55 * ATTRIBUTE_W);
|
||||
h = QUOTE(5 * ATTRIBUTE_H);
|
||||
};
|
||||
class ClearButton: ctrlButton {
|
||||
idc = IDC_ATTRIBUTE_CLEAR_BUTTON;
|
||||
onButtonClick = QUOTE([ctrlParentControlsGroup (_this select 0)] call FUNC(attributeClear));
|
||||
text = "$STR_disp_arcmap_clear";
|
||||
x = QUOTE(105 * ATTRIBUTE_W);
|
||||
y = QUOTE(101.83 * ATTRIBUTE_H);
|
||||
w = QUOTE(25 * ATTRIBUTE_W);
|
||||
h = QUOTE(5 * ATTRIBUTE_H);
|
||||
colorBackground[] = {0, 0, 0, 0.6};
|
||||
};
|
||||
class ExportButton: ClearButton {
|
||||
idc = IDC_ATTRIBUTE_EXPORT_BUTTON;
|
||||
onButtonClick = QUOTE(copyToClipboard str ((uiNamespace getVariable [ARR_2(QQGVAR(attributeValue),[ARR_2([],0)])]) select 0));
|
||||
text = CSTRING(buttonExportText);
|
||||
tooltip = CSTRING(AttributeExport_Tooltip);
|
||||
x = QUOTE(79 * ATTRIBUTE_W);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
class Object {
|
||||
class AttributeCategories {
|
||||
class ADDON {
|
||||
displayName = CSTRING(Mission);
|
||||
collapsed = 1;
|
||||
class Attributes {
|
||||
class ADDON {
|
||||
property = QGVAR(attribute);
|
||||
control = QGVAR(attribute);
|
||||
displayName = CSTRING(Mission);
|
||||
tooltip = "";
|
||||
expression = QUOTE(if (!is3DEN) then {[ARR_2(_this,+_value)] call FUNC(attributeInit)});
|
||||
defaultValue = "[[], 0]";
|
||||
condition = "1 - objectControllable";
|
||||
wikiType = "[[Array]]";
|
||||
validate = "none";
|
||||
value = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -1,6 +1,13 @@
|
||||
PREP(addListBoxItem);
|
||||
PREP(addStat);
|
||||
PREP(addVirtualItems);
|
||||
PREP(attributeAddItems);
|
||||
PREP(attributeClear);
|
||||
PREP(attributeDblClick);
|
||||
PREP(attributeInit);
|
||||
PREP(attributeLoad);
|
||||
PREP(attributeMode);
|
||||
PREP(attributeSelect);
|
||||
PREP(buttonCargo);
|
||||
PREP(buttonClearAll);
|
||||
PREP(buttonExport);
|
||||
|
@ -8,35 +8,14 @@ class CfgPatches {
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author = ECSTRING(common,ACETeam);
|
||||
authors[] = {"alganthe"};
|
||||
authors[] = {"alganthe", "mharis001"};
|
||||
url = ECSTRING(main,URL);
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
class Cfg3DEN {
|
||||
class Mission {
|
||||
class GVAR(DummyCategory) {
|
||||
displayName="Dummy attribute, should never show up";
|
||||
class AttributeCategories {
|
||||
class ACE3_Arsenal {
|
||||
class Attributes {
|
||||
class GVAR(DefaultLoadoutsListAttribute) {
|
||||
property = QGVAR(DefaultLoadoutsListAttribute);
|
||||
value=0;
|
||||
expression="if !(is3DEN) then {ace_arsenal_defaultLoadoutsList = _value};";
|
||||
defaultValue="[]";
|
||||
validate="none";
|
||||
wikiType="[[Array]]";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#include "ui\RscAttributes.hpp"
|
||||
#include "Cfg3DEN.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "RscDisplayMain.hpp"
|
||||
#include "ACE_Arsenal_Stats.hpp"
|
||||
|
@ -149,6 +149,24 @@
|
||||
#define IDC_buttonSharedLoadoutsBackground 405
|
||||
#define IDC_buttonSharedLoadouts 406
|
||||
|
||||
// 3DEN Attribute
|
||||
#define ATTRIBUTE_W (pixelW * pixelGrid * 0.5)
|
||||
#define ATTRIBUTE_H (pixelH * pixelGrid * 0.5)
|
||||
|
||||
#define IDC_ATTRIBUTE_MODE 8100
|
||||
#define IDC_ATTRIBUTE_CATEGORY 8101
|
||||
#define IDC_ATTRIBUTE_LIST 8102
|
||||
#define IDC_ATTRIBUTE_LIST_LEFT 8103
|
||||
#define IDC_ATTRIBUTE_LIST_RIGHT 8104
|
||||
#define IDC_ATTRIBUTE_SEARCH_BUTTON 8105
|
||||
#define IDC_ATTRIBUTE_SEARCHBAR 8106
|
||||
#define IDC_ATTRIBUTE_CLEAR_BUTTON 8107
|
||||
#define IDC_ATTRIBUTE_EXPORT_BUTTON 8108
|
||||
|
||||
#define SYMBOL_ITEM_NONE "−"
|
||||
#define SYMBOL_ITEM_REMOVE "×"
|
||||
#define SYMBOL_ITEM_VIRTUAL "∞"
|
||||
|
||||
#define FADE_DELAY 0.15
|
||||
#define CAM_DIS_MAX 5
|
||||
|
||||
|
122
addons/arsenal/functions/fnc_attributeAddItems.sqf
Normal file
122
addons/arsenal/functions/fnc_attributeAddItems.sqf
Normal file
@ -0,0 +1,122 @@
|
||||
#include "script_component.hpp"
|
||||
#include "..\defines.hpp"
|
||||
/*
|
||||
* Author: mharis001
|
||||
* Populates 3DEN attribute listbox with items of given category.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Attribute controls group <CONTROL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [CONTROL, 0] call ace_arsenal_fnc_attributeAddItems
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_controlsGroup"];
|
||||
|
||||
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY) - 1;
|
||||
private _filter = toLower ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR);
|
||||
private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]);
|
||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||
TRACE_3("Populating list",_category,_filter,_attributeValue);
|
||||
|
||||
_attributeValue params ["_attributeItems", "_attributeMode"];
|
||||
private _modeSymbol = [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode;
|
||||
|
||||
// Clear listbox
|
||||
private _listbox = _controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST;
|
||||
lnbClear _listbox;
|
||||
|
||||
// Exit with current items (no specific category)
|
||||
if (_category == -1) exitWith {
|
||||
{
|
||||
// Get appropriate config for each item (different since items can be from any category)
|
||||
private _config = switch (true) do {
|
||||
case (_x in (_configItems select 2));
|
||||
case (_x in (_configItems select 15));
|
||||
case (_x in (_configItems select 16)): {
|
||||
configFile >> "CfgMagazines" >> _x;
|
||||
};
|
||||
case (_x in (_configItems select 6)): {
|
||||
configFile >> "CfgVehicles" >> _x;
|
||||
};
|
||||
case (_x in (_configItems select 7)): {
|
||||
configFile >> "CfgGlasses" >> _x;
|
||||
};
|
||||
default {
|
||||
configFile >> "CfgWeapons" >> _x;
|
||||
};
|
||||
};
|
||||
|
||||
// Add item if not filtered
|
||||
private _displayName = getText (_config >> "displayName");
|
||||
if (toLower _displayName find _filter > -1) then {
|
||||
private _picture = getText (_config >> "picture");
|
||||
private _index = _listbox lnbAddRow ["", _displayName, _modeSymbol];
|
||||
_listbox lnbSetData [[_index, 1], _x];
|
||||
_listbox lnbSetPicture [[_index, 0], _picture];
|
||||
_listbox lbSetTooltip [_index * (count lnbGetColumnsPosition _listbox), _x];
|
||||
};
|
||||
} forEach _attributeItems;
|
||||
|
||||
_listbox lnbSort [1];
|
||||
};
|
||||
|
||||
// Get list of category items
|
||||
private _categoryItems = switch (true) do {
|
||||
case (_category < 3): {
|
||||
_configItems select 0 select _category;
|
||||
};
|
||||
case (_category < 7): {
|
||||
_configItems select 1 select (_category - 3);
|
||||
};
|
||||
default {
|
||||
_configItems select (_category - 5);
|
||||
};
|
||||
};
|
||||
|
||||
// Get config for current category
|
||||
private _config = switch (true) do {
|
||||
case (_category in [7, 20, 21]): {
|
||||
configFile >> "CfgMagazines";
|
||||
};
|
||||
case (_category == 11): {
|
||||
configFile >> "CfgVehicles";
|
||||
};
|
||||
case (_category == 12): {
|
||||
configFile >> "CfgGlasses";
|
||||
};
|
||||
default {
|
||||
configFile >> "CfgWeapons";
|
||||
};
|
||||
};
|
||||
|
||||
// Populate listbox with category items
|
||||
{
|
||||
// Add item if not filtered
|
||||
private _displayName = getText (_config >> _x >> "displayName");
|
||||
if (toLower _displayName find _filter > -1) then {
|
||||
private _picture = getText (_config >> _x >> "picture");
|
||||
private _symbol = SYMBOL_ITEM_NONE;
|
||||
private _alpha = 0.5;
|
||||
|
||||
// Change symbol and alpha if item already selected
|
||||
if (_x in _attributeItems) then {
|
||||
_symbol = _modeSymbol;
|
||||
_alpha = 1;
|
||||
};
|
||||
|
||||
private _index = _listbox lnbAddRow ["", _displayName, _symbol];
|
||||
_listbox lnbSetData [[_index, 1], _x];
|
||||
_listbox lnbSetPicture [[_index, 0], _picture];
|
||||
_listbox lbSetTooltip [_index * (count lnbGetColumnsPosition _listbox), _x];
|
||||
_listbox lnbSetColor [[_index, 1], [1, 1, 1, _alpha]];
|
||||
_listbox lnbSetColor [[_index, 2], [1, 1, 1, _alpha]];
|
||||
};
|
||||
} forEach _categoryItems;
|
||||
|
||||
_listbox lnbSort [1];
|
46
addons/arsenal/functions/fnc_attributeClear.sqf
Normal file
46
addons/arsenal/functions/fnc_attributeClear.sqf
Normal file
@ -0,0 +1,46 @@
|
||||
#include "script_component.hpp"
|
||||
#include "..\defines.hpp"
|
||||
/*
|
||||
* Author: mharis001
|
||||
* Clears all items from current category in 3DEN attribute.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Attribute controls group <CONTROL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [CONTROL] call ace_arsenal_fnc_attributeClear
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_controlsGroup"];
|
||||
|
||||
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY) - 1;
|
||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||
TRACE_1("Handling clear button",_category);
|
||||
|
||||
// Remove all if no specific category
|
||||
if (_category == -1) then {
|
||||
_attributeValue set [0, []];
|
||||
} else {
|
||||
// Find category items and remove from list
|
||||
private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]);
|
||||
private _categoryItems = switch (true) do {
|
||||
case (_category < 3): {
|
||||
_configItems select 0 select _category;
|
||||
};
|
||||
case (_category < 7): {
|
||||
_configItems select 1 select (_category - 3);
|
||||
};
|
||||
default {
|
||||
_configItems select (_category - 5);
|
||||
};
|
||||
};
|
||||
_attributeValue set [0, (_attributeValue select 0) - _categoryItems];
|
||||
};
|
||||
|
||||
// Refresh the list after clear
|
||||
[_controlsGroup] call FUNC(attributeAddItems);
|
26
addons/arsenal/functions/fnc_attributeDblClick.sqf
Normal file
26
addons/arsenal/functions/fnc_attributeDblClick.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: mharis001
|
||||
* Handles double clicking a row in 3DEN attribute listbox.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Listbox <CONTROL>
|
||||
* 1: Row index <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [CONTROL, 0] call ace_arsenal_fnc_attributeDblClick
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_listbox", "_currentRow"];
|
||||
TRACE_1("Double click toggle",_currentRow);
|
||||
|
||||
// Get toggle mode (add or remove item)
|
||||
private _itemClassname = _listbox lnbData [_currentRow, 1];
|
||||
private _addItem = !(_itemClassname in ((uiNamespace getVariable [QGVAR(attributeValue), [[], 0]]) select 0));
|
||||
|
||||
[ctrlParentControlsGroup _listbox, _addItem] call FUNC(attributeSelect);
|
33
addons/arsenal/functions/fnc_attributeInit.sqf
Normal file
33
addons/arsenal/functions/fnc_attributeInit.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: mharis001
|
||||
* Initializes the objects 3DEN attribute at scenario start.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Attribute target <OBJECT>
|
||||
* 1: Attribute value <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [box, [[], 1]] call ace_arsenal_fnc_attributeInit
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_object", "_value"];
|
||||
_value params ["_items", "_mode"];
|
||||
TRACE_2("Initializing object with attribute",_object,_value);
|
||||
|
||||
if (_mode > 0) then {
|
||||
// Blacklist: all full arsenal and take items away
|
||||
[_object, true, true] call FUNC(initBox);
|
||||
[_object, _items, true] call FUNC(removeVirtualItems);
|
||||
} else {
|
||||
// Exit on whitelist mode with no items
|
||||
if (_items isEqualTo []) exitWith {};
|
||||
|
||||
// Whitelist: add only selected items
|
||||
[_object, _items, true] call FUNC(initBox);
|
||||
};
|
32
addons/arsenal/functions/fnc_attributeLoad.sqf
Normal file
32
addons/arsenal/functions/fnc_attributeLoad.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
#include "script_component.hpp"
|
||||
#include "..\defines.hpp"
|
||||
/*
|
||||
* Author: mharis001
|
||||
* Initializes the 3DEN attribute.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Attribute controls group <CONTROL>
|
||||
* 1: Attribute value <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [CONTROL, [[], 0]] call ace_arsenal_fnc_attributeLoad
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_controlsGroup", "_value"];
|
||||
TRACE_1("Initializing 3DEN attribute",_value);
|
||||
|
||||
// Store working attribute value
|
||||
uiNamespace setVariable [QGVAR(attributeValue), _value];
|
||||
|
||||
// Handle selected mode
|
||||
if (_value select 1 > 0) then {
|
||||
(_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_MODE) lbSetCurSel 1;
|
||||
(_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST_RIGHT) ctrlSetText SYMBOL_ITEM_REMOVE;
|
||||
};
|
||||
|
||||
[_controlsGroup] call FUNC(attributeAddItems);
|
29
addons/arsenal/functions/fnc_attributeMode.sqf
Normal file
29
addons/arsenal/functions/fnc_attributeMode.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
#include "script_component.hpp"
|
||||
#include "..\defines.hpp"
|
||||
/*
|
||||
* Author: mharis001
|
||||
* Handles changing the mode in 3DEN attribute.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Attribute controls group <CONTROL>
|
||||
* 1: Mode <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [CONTROL, 0] call ace_arsenal_fnc_attributeMode
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_controlsGroup", "_mode"];
|
||||
TRACE_1("Changing attribute mode",_mode);
|
||||
|
||||
// Store mode change
|
||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||
_attributeValue set [1, _mode];
|
||||
|
||||
// Change right list button and refresh list items with new mode
|
||||
(_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST_RIGHT) ctrlSetText ([SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _mode);
|
||||
[_controlsGroup] call FUNC(attributeAddItems);
|
49
addons/arsenal/functions/fnc_attributeSelect.sqf
Normal file
49
addons/arsenal/functions/fnc_attributeSelect.sqf
Normal file
@ -0,0 +1,49 @@
|
||||
#include "script_component.hpp"
|
||||
#include "..\defines.hpp"
|
||||
/*
|
||||
* Author: mharis001
|
||||
* Handles adding/removing an item from 3DEN attribute list.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Attribute controls group <CONTROL>
|
||||
* 1: Add (true) or remove (false) item <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [CONTROL, true] call ace_arsenal_fnc_attributeSelect
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_controlsGroup", "_addItem"];
|
||||
|
||||
// Get item class from listbox
|
||||
private _listbox = _controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST;
|
||||
private _currentRow = lnbCurSelRow _listbox;
|
||||
private _itemClassname = _listbox lnbData [_currentRow, 1];
|
||||
TRACE_2("Handling item selection",_itemClassname,_addItem);
|
||||
|
||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||
_attributeValue params ["_attributeItems", "_attributeMode"];
|
||||
|
||||
private _findItem = _attributeItems find _itemClassname;
|
||||
|
||||
// Add item if not already in list
|
||||
if (_addItem && {_findItem < 0}) exitWith {
|
||||
_attributeItems pushBack _itemClassname;
|
||||
// Change symbol and increase alpha
|
||||
_listbox lnbSetText [[_currentRow, 2], [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode];
|
||||
_listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 1]];
|
||||
_listbox lnbSetColor [[_currentRow, 2], [1, 1, 1, 1]];
|
||||
};
|
||||
|
||||
// Remove item if in list
|
||||
if (!_addItem && {_findItem > -1}) exitWith {
|
||||
_attributeItems deleteAt _findItem;
|
||||
// Change symbol and reduce alpha
|
||||
_listbox lnbSetText [[_currentRow, 2], SYMBOL_ITEM_NONE];
|
||||
_listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 0.5]];
|
||||
_listbox lnbSetColor [[_currentRow, 2], [1, 1, 1, 0.5]];
|
||||
};
|
@ -751,5 +751,59 @@
|
||||
<Chinese>輸出 class name 到剪貼簿上</Chinese>
|
||||
<Italian>Copiato il nome della classe negli appunti</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_Mode">
|
||||
<English>Mode</English>
|
||||
<Chinese>模式</Chinese>
|
||||
<French>Mode</French>
|
||||
<Spanish>Modo</Spanish>
|
||||
<Italian>Modalità</Italian>
|
||||
<Polish>Tryb</Polish>
|
||||
<Russian>Режим</Russian>
|
||||
<German>Modus</German>
|
||||
<Czech>Režim</Czech>
|
||||
<Portuguese>Modo</Portuguese>
|
||||
<Korean>모드</Korean>
|
||||
<Chinesesimp>模式</Chinesesimp>
|
||||
<Japanese>モード</Japanese>
|
||||
<Turkish>Mod</Turkish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_Whitelist">
|
||||
<English>Whitelist</English>
|
||||
<Polish>Biała lista</Polish>
|
||||
<Spanish>Lista blanca</Spanish>
|
||||
<German>Whitelist</German>
|
||||
<Czech>Seznam povolených</Czech>
|
||||
<Portuguese>Lista branca</Portuguese>
|
||||
<French>Liste blanche</French>
|
||||
<Hungarian>Fehérlista</Hungarian>
|
||||
<Russian>Вайтлист</Russian>
|
||||
<Italian>Lista Bianca</Italian>
|
||||
<Japanese>許可制</Japanese>
|
||||
<Korean>화이트리스트</Korean>
|
||||
<Chinese>白名單</Chinese>
|
||||
<Chinesesimp>白名单</Chinesesimp>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_Blacklist">
|
||||
<English>Blacklist</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_Items">
|
||||
<English>Items</English>
|
||||
<Chinese>物品</Chinese>
|
||||
<French>Objets</French>
|
||||
<Spanish>Objetos</Spanish>
|
||||
<Italian>Oggetti</Italian>
|
||||
<Polish>Przedmioty</Polish>
|
||||
<Russian>Предметы</Russian>
|
||||
<German>Gegenstände</German>
|
||||
<Czech>Předměty</Czech>
|
||||
<Portuguese>Itens</Portuguese>
|
||||
<Korean>물품</Korean>
|
||||
<Chinesesimp>物品</Chinesesimp>
|
||||
<Japanese>アイテム</Japanese>
|
||||
<Turkish>Eşyalar</Turkish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_AttributeExport_Tooltip">
|
||||
<English>Export current items list as an array for use in scripts</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user