ACE3/addons/interaction/functions/fnc_openSelectMenu.sqf

50 lines
1.5 KiB
Plaintext
Raw Normal View History

2015-01-11 19:32:51 +00:00
/*
* Author: Garth de Wet (LH)
* Opens the select menu UI and sets up the UI
*
* Arguments:
* 0: Items <ARRAY>
* 0: Text <STRING>
* 1: Statement to execute <CODE>
* 2: Condition before execute <CODE>
* 3: showDisabled <BOOL>
* 4: Priority <NUMBER>
* 5: Icon <STRING>
* 6: Extra variables passed to the code <ARRAY>
* 1: Select Action <CODE>
* 2: Cancel Action <CODE>
*
* Return value:
* None
*
* Example:
* [["text", {statement}, {condition}, showDisabled, priority, "icon", [variables]], {selectAction}, {cancelAction}] call ace_interaction_fnc_openSelectMenu
*
* Public: No
*/
2015-01-11 23:13:47 +00:00
#include "script_component.hpp"
2015-05-01 23:12:24 +00:00
private["_action", "_count", "_customActions", "_i"];
2015-01-11 23:13:47 +00:00
if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) then {
GVAR(SelectAccept) = _this select 1;
GVAR(SelectCancel) = _this select 2;
2015-05-09 20:14:00 +00:00
buttonSetAction [8855, QUOTE( call GVAR(SelectCancel); )]; // Cancel
buttonSetAction [8860, QUOTE( (call compile (lbData [ARR_2(8866, lbCurSel 8866)])) call GVAR(SelectAccept); )]; // Accept
lbSetCurSel [8866, 0];
2015-01-11 19:32:51 +00:00
}else{
2015-05-09 20:14:00 +00:00
PARAMS_1(_customActions);
private ["_count", "_action"];
_count = count _customActions;
if (_count == 0) exitWith {};
_customActions call FUNC(sortOptionsByPriority);
for "_i" from 0 to _count -1 do {
_action = _customActions select _i;
_action set [1, (_this select 1)];
};
GVAR(Buttons) = _customActions;
[(_this select 2), true, true, false, ACE_player] call FUNC(initialiseInteraction);
2015-01-11 19:32:51 +00:00
};