mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
d33a158e2e
* improve page handling * drop MAX_STATS_PER_PAGE for now * hide stats box when empty * improve hiding * improve _fnc_hideUnused * condition * prevent page overflow Co-authored-by: PabstMirror <pabstmirror@gmail.com> * favorites var * function prep * favorites only * improve favorites adding, add include * fix stupid * fix color setting (todo: lnb color) * add button, finalize * setting tooltip * stringtable again * fix setting overwrite, improve tooltip * fix losing weapon items * fix macro * fix setting to intended overwrite * remove unnecessary private * docs * more docs * is * improve button text * docs * fix tooltip not showing unless menuBar was clicked * improve weapon accessory lookup * empty line * update refresh calls * fix left panel * cleanup currentCargo * use BI string for favorites * BI strings again * no favorites for face/voice/insignia * stringtable again * add missing setColorRight * Add comment for favorites setup --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com>
61 lines
2.0 KiB
Plaintext
61 lines
2.0 KiB
Plaintext
#include "script_component.hpp"
|
|
#include "..\defines.hpp"
|
|
/*
|
|
* Author: Alganthe, johnb43
|
|
* Update the right panel (listnbox).
|
|
*
|
|
* Arguments:
|
|
* 0: Right panel control <CONTROL>
|
|
* 1: Container <OBJECT>
|
|
* 2: If container has items <BOOL>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_control", "_container", "_hasItems"];
|
|
|
|
private _loadRemaining = maxLoad _container - loadAbs _container;
|
|
private _rightPanelCache = uiNamespace getVariable [QGVAR(rightPanelCache), createHashMap];
|
|
|
|
private _mass = -1;
|
|
private _color = [];
|
|
private _alpha = 1;
|
|
|
|
// Grey out items that are too big to fit in remaining space of the container
|
|
for "_row" from 0 to (lnbSize _control select 0) - 1 do {
|
|
_mass = _rightPanelCache getOrDefault [_control lnbData [_row, 0], 0];
|
|
_color = _control lnbColor [_row, 1];
|
|
|
|
// Lower alpha on color for items that can't fit
|
|
_alpha = [0.25, 1] select (_mass <= _loadRemaining);
|
|
_color set [3, _alpha];
|
|
_control lnbSetColor [[_row, 1], _color];
|
|
_control lnbSetColor [[_row, 2], [1, 1, 1, _alpha]];
|
|
};
|
|
|
|
private _display = ctrlParent _control;
|
|
|
|
// If there are items inside container, show "remove all" button
|
|
private _removeAllCtrl = _display displayCtrl IDC_buttonRemoveAll;
|
|
|
|
// A separate "_hasItems" argument is needed, because items can have no mass
|
|
_removeAllCtrl ctrlSetFade 0;
|
|
_removeAllCtrl ctrlShow _hasItems;
|
|
_removeAllCtrl ctrlEnable _hasItems;
|
|
_removeAllCtrl ctrlCommit FADE_DELAY;
|
|
|
|
// Update weight display
|
|
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", GVAR(center) call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);
|
|
|
|
private _curSel = lnbCurSelRow _control;
|
|
|
|
// Disable '+' button if item is unique or too big to fit in remaining space
|
|
if (_curSel != -1) then {
|
|
private _plusButtonCtrl = _display displayCtrl IDC_arrowPlus;
|
|
_plusButtonCtrl ctrlEnable !((_control lnbValue [_curSel, 2]) == 1 || {(_rightPanelCache getOrDefault [_control lnbData [_curSel, 0], 0]) > _loadRemaining});
|
|
_plusButtonCtrl ctrlCommit FADE_DELAY;
|
|
};
|