ACE3/addons/interaction/functions/fnc_applyButtons.sqf

54 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-01-11 19:32:51 +00:00
// by commy2
2015-01-11 23:13:47 +00:00
#include "script_component.hpp"
2015-05-01 23:12:24 +00:00
private ["_object", "_actions", "_dlgInteractionDialog", "_ctrlInteractionDialog", "_index", "_ctrlInteractionDialogIcon", "_a", "_action", "_count"];
2015-01-11 19:32:51 +00:00
2015-01-11 23:13:47 +00:00
_object = GVAR(Target);
_actions = GVAR(Buttons);
2015-01-11 19:32:51 +00:00
disableSerialization;
2015-01-11 23:13:47 +00:00
_dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog);
2015-01-11 19:32:51 +00:00
/*
for "_a" from 0 to (_count - 1) do {
_action = GVAR(Buttons) select _a;
2015-01-11 19:32:51 +00:00
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _a);
_ctrlInteractionDialog ctrlShow true;
_ctrlInteractionDialog ctrlSetText (_action select 0);
_ctrlInteractionDialog ctrlEnable (call (_action select 2));
2015-01-11 19:32:51 +00:00
};
*/
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3;
2015-01-11 23:13:47 +00:00
GVAR(MainButton) = "(findDisplay 1713999) closeDisplay 1;";
2015-01-11 19:32:51 +00:00
if (_object isKindOf "Man") then {
_ctrlInteractionDialog ctrlSetText (if (alive _object) then {name _object} else {_object getVariable ["ACE_Name", "Unknown"]});
2015-01-11 19:32:51 +00:00
} else {
_ctrlInteractionDialog ctrlSetText (getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName"));
2015-01-11 19:32:51 +00:00
};
for "_index" from 0 to 9 do {
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _index);
_ctrlInteractionDialog ctrlShow true;
2015-01-11 19:32:51 +00:00
_ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _index);
2015-01-11 19:32:51 +00:00
if (_index < _count) then {
_action = GVAR(Buttons) select _index;
_ctrlInteractionDialog ctrlSetText (_action select 0);
_ctrlInteractionDialog ctrlEnable (call (_action select 2));
2015-01-11 19:32:51 +00:00
_ctrlInteractionDialogIcon ctrlSetText (_action select 5);
} else {
_ctrlInteractionDialog ctrlSetText "";
_ctrlInteractionDialog ctrlEnable false;
2015-01-11 19:32:51 +00:00
_ctrlInteractionDialogIcon ctrlSetText "";
};
2015-01-11 19:32:51 +00:00
};