2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
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
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-08-10 21:07:47 +00:00
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
disableSerialization;
|
|
|
|
|
2015-08-16 20:41:35 +00:00
|
|
|
params ["_display"];
|
|
|
|
|
|
|
|
uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2016-08-27 08:14:54 +00:00
|
|
|
if (GVAR(interactionParadrop)) then {
|
|
|
|
(_display displayCtrl 12) ctrlSetText (localize LSTRING(paradropButton));
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2017-11-10 14:28:12 +00:00
|
|
|
if (isNull GVAR(interactionVehicle) || {(([ACE_player, GVAR(interactionVehicle)] call EFUNC(interaction,getInteractionDistance)) >= MAX_LOAD_DISTANCE) && {(vehicle ACE_player) != GVAR(interactionVehicle)}}) 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};
|
2021-10-12 22:42:38 +00:00
|
|
|
private _displayName = [_x, true] call FUNC(getNameItem);
|
2017-05-05 19:02:59 +00:00
|
|
|
if (GVAR(interactionParadrop)) then {
|
|
|
|
_ctrl lbAdd format ["%1 (%2s)", _displayName, GVAR(paradropTimeCoefficent) * ([_class] call FUNC(getSizeItem))];
|
|
|
|
} else {
|
|
|
|
_ctrl lbAdd _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;
|