2015-08-10 21:07:47 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2015-08-16 20:41:35 +00:00
|
|
|
* Handle the UI data display.
|
2015-08-10 21:07:47 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-16 20:41:35 +00:00
|
|
|
* 0: Display <DISPLAY>
|
2015-08-10 21:07:47 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* None
|
|
|
|
*
|
2015-08-16 20:41:35 +00:00
|
|
|
* Example:
|
|
|
|
* [display] call ace_cargo_fnc_onMenuOpen
|
|
|
|
*
|
2015-08-10 21:07:47 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
disableSerialization;
|
|
|
|
|
2015-08-16 20:41:35 +00:00
|
|
|
params ["_display"];
|
|
|
|
|
|
|
|
uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
2015-08-10 21:07:47 +00:00
|
|
|
|
|
|
|
[{
|
|
|
|
disableSerialization;
|
2016-01-19 03:53:48 +00:00
|
|
|
private _display = uiNamespace getVariable QGVAR(menuDisplay);
|
2015-08-16 20:41:35 +00:00
|
|
|
if (isnil "_display") exitWith {
|
2015-08-10 21:07:47 +00:00
|
|
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
|
|
|
};
|
|
|
|
|
2016-01-19 03:53:48 +00:00
|
|
|
if (isNull GVAR(interactionVehicle) || {ACE_player distance GVAR(interactionVehicle) >= 10}) exitWith {
|
2015-08-10 21:07:47 +00:00
|
|
|
closeDialog 0;
|
|
|
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
|
|
|
};
|
|
|
|
|
2016-01-19 03:53:48 +00:00
|
|
|
private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
|
|
|
|
private _ctrl = _display displayCtrl 100;
|
|
|
|
private _label = _display displayCtrl 2;
|
2015-08-10 21:07:47 +00:00
|
|
|
|
|
|
|
lbClear _ctrl;
|
|
|
|
{
|
2016-01-19 03:53:48 +00:00
|
|
|
private _class = if (_x isEqualType "") then {_x} else {typeOf _x};
|
2015-09-27 16:19:40 +00:00
|
|
|
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName"));
|
2015-08-14 16:07:31 +00:00
|
|
|
true
|
|
|
|
} count _loaded;
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2015-08-14 20:46:51 +00:00
|
|
|
_label ctrlSetText format[localize LSTRING(labelSpace), [GVAR(interactionVehicle)] call DFUNC(getCargoSpaceLeft)];
|
2015-08-10 21:07:47 +00:00
|
|
|
}, 0, []] call CBA_fnc_addPerFrameHandler;
|