2015-02-22 13:54:54 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
*
|
|
|
|
* Draw progress bar and execute given function if succesful.
|
2015-05-14 22:12:40 +00:00
|
|
|
* Finish/Failure/Conditional are all passed [args, elapsedTime, totalTime, errorCode]
|
2015-02-22 13:54:54 +00:00
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* 0: icon ID <STRING>
|
|
|
|
* 1: show <BOOL>
|
|
|
|
* 2: Icon Path <STRING>
|
|
|
|
* 3: Icon color <ARRAY>
|
|
|
|
* 4: timeAlive. -1 = forever <NUMBER> <OPTIONAL>
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1], 0] call ace_gui_fnc_displayIcon;
|
|
|
|
*/
|
|
|
|
|
2015-02-14 19:06:55 +00:00
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
// positions for the icon UI
|
|
|
|
#define RIGHT_SIDE (safezoneW + safezoneX)
|
|
|
|
#define LEFT_SIDE safezoneX
|
|
|
|
#define TOP_SIDE safeZoneY
|
|
|
|
#define BOTTOM_SIDE (safeZoneH + safezoneY)
|
|
|
|
#define ICON_WIDTH (2 * (((safezoneW / safezoneH) min 1.2) / 40))
|
|
|
|
#define X_POS_ICONS (RIGHT_SIDE - (1.5 * ICON_WIDTH))
|
|
|
|
#define Y_POS_ICONS (TOP_SIDE + (2.5 * ICON_WIDTH))
|
|
|
|
#define DIFFERENCE_ICONS (1.1 * ICON_WIDTH)
|
|
|
|
#define X_POS_ICONS_SECOND (RIGHT_SIDE - (4.4 * ICON_WIDTH))
|
|
|
|
#define Y_POS_ICONS_SECOND (TOP_SIDE + (1.1 * ICON_WIDTH))
|
|
|
|
|
|
|
|
// setting values
|
2015-04-06 16:22:43 +00:00
|
|
|
#define TOP_RIGHT_DOWN 1
|
|
|
|
#define TOP_RIGHT_LEFT 2
|
|
|
|
#define TOP_LEFT_DOWN 3
|
|
|
|
#define TOP_LEFT_RIGHT 4
|
2015-02-14 19:06:55 +00:00
|
|
|
|
|
|
|
// other constants
|
2015-04-06 16:22:43 +00:00
|
|
|
#define DEFAULT_TIME 6
|
2015-02-14 19:06:55 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
private ["_allControls", "_refresh", "_timeAlive", "_list"];
|
|
|
|
|
|
|
|
PARAMS_4(_iconId,_show,_icon,_color);
|
|
|
|
|
2015-02-14 19:06:55 +00:00
|
|
|
_timeAlive = if (count _this > 4) then {_this select 4} else {DEFAULT_TIME};
|
|
|
|
|
|
|
|
disableSerialization;
|
|
|
|
_list = missionNamespace getvariable [QGVAR(displayIconList),[]];
|
|
|
|
|
|
|
|
_refresh = {
|
2015-04-06 16:22:43 +00:00
|
|
|
private ["_allControls"];
|
|
|
|
// Refreshing of all icons..
|
|
|
|
_allControls = missionNamespace getvariable [QGVAR(displayIconListControls), []];
|
|
|
|
{
|
|
|
|
ctrlDelete _x;
|
|
|
|
}foreach _allControls;
|
2015-02-14 19:06:55 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
_allControls = [];
|
2015-02-14 19:06:55 +00:00
|
|
|
|
2015-05-14 22:12:40 +00:00
|
|
|
private ["_ctrl", "_setting", "_position"];
|
2015-04-06 16:22:43 +00:00
|
|
|
_setting = missionNamespace getvariable[QGVAR(settingFeedbackIcons), 0];
|
|
|
|
if (_setting > 0) then {
|
|
|
|
{
|
|
|
|
// +19000 because we want to make certain we are using free IDCs..
|
|
|
|
_ctrl = ((findDisplay 46) ctrlCreate ["RscPicture", _foreachIndex + 19000]);
|
|
|
|
_position = switch (_setting) do {
|
|
|
|
case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
|
|
|
|
case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]};
|
|
|
|
case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
|
|
|
|
case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]};
|
|
|
|
default {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
|
|
|
|
};
|
|
|
|
_ctrl ctrlSetPosition _position;
|
|
|
|
_ctrl ctrlsetText (_x select 1);
|
|
|
|
_ctrl ctrlSetTextColor (_x select 2);
|
|
|
|
_ctrl ctrlCommit 0;
|
|
|
|
_allControls pushback _ctrl;
|
|
|
|
}foreach (missionNamespace getvariable [QGVAR(displayIconList),[]]);
|
|
|
|
};
|
|
|
|
missionNamespace setvariable [QGVAR(displayIconListControls), _allControls];
|
2015-02-14 19:06:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_show) then {
|
2015-04-06 16:22:43 +00:00
|
|
|
if ({(_x select 0 == _iconId)} count _list == 0) then {
|
2015-05-21 16:42:44 +00:00
|
|
|
_list pushback [_iconId, _icon, _color, ACE_time];
|
2015-04-06 16:22:43 +00:00
|
|
|
} else {
|
|
|
|
{
|
|
|
|
if (_x select 0 == _iconId) exitwith {
|
2015-05-21 16:42:44 +00:00
|
|
|
_list set [_foreachIndex, [_iconId, _icon, _color, ACE_time]];
|
2015-04-06 16:22:43 +00:00
|
|
|
};
|
2015-05-14 18:06:06 +00:00
|
|
|
} forEach _list;
|
2015-04-06 16:22:43 +00:00
|
|
|
};
|
|
|
|
missionNamespace setvariable [QGVAR(displayIconList), _list];
|
|
|
|
call _refresh;
|
2015-02-14 19:06:55 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
if (_timeAlive >= 0) then {
|
|
|
|
[{
|
2015-02-14 19:06:55 +00:00
|
|
|
[_this select 0, false, "", [0,0,0], 0] call FUNC(displayIcon);
|
|
|
|
}, [_iconId], _timeAlive, _timeAlive] call EFUNC(common,waitAndExecute);
|
2015-04-06 16:22:43 +00:00
|
|
|
};
|
2015-02-14 19:06:55 +00:00
|
|
|
|
|
|
|
} else {
|
2015-04-06 16:22:43 +00:00
|
|
|
if ({(_x select 0 == _iconId)} count _list == 1) then {
|
|
|
|
private "_newList";
|
|
|
|
_newList = [];
|
|
|
|
{
|
|
|
|
if (_x select 0 != _iconId) then {
|
|
|
|
_newList pushback _x;
|
|
|
|
};
|
2015-05-14 18:06:06 +00:00
|
|
|
} forEach _list;
|
2015-02-14 19:06:55 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
missionNamespace setvariable [QGVAR(displayIconList), _newList];
|
|
|
|
call _refresh;
|
|
|
|
};
|
2015-02-14 19:06:55 +00:00
|
|
|
};
|