2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-22 10:19:32 +00:00
|
|
|
* Author: commy2, Glowbal
|
2015-01-11 16:42:31 +00:00
|
|
|
* Display a structured text.
|
|
|
|
*
|
2015-09-20 20:16:51 +00:00
|
|
|
* Arguments:
|
2015-02-22 10:19:32 +00:00
|
|
|
* 0: Text <ANY>
|
2015-09-20 20:16:51 +00:00
|
|
|
* 1: Size of the textbox (default: 1.5) <NUMBER>
|
|
|
|
* 2: Target Unit. Will only display if target is the player controlled object (default: ACE_player) <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-20 20:16:51 +00:00
|
|
|
* Public: Yes
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-09-20 20:16:51 +00:00
|
|
|
params ["_text", ["_size", 1.5], ["_target", ACE_player]];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-24 17:02:41 +00:00
|
|
|
if (_target != ACE_player) exitWith {};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (typeName _text != "TEXT") then {
|
2015-02-24 17:02:41 +00:00
|
|
|
if (typeName _text == "ARRAY") then {
|
|
|
|
if (count _text > 0) then {
|
|
|
|
{
|
|
|
|
if (typeName _x == "STRING" && {isLocalized _x}) then {
|
|
|
|
_text set [_foreachIndex, localize _x];
|
|
|
|
};
|
|
|
|
}foreach _text;
|
|
|
|
_text = format _text;
|
|
|
|
};
|
|
|
|
};
|
2015-02-19 20:38:51 +00:00
|
|
|
if (typeName _text == "STRING" && {isLocalized _text}) then {
|
|
|
|
_text = localize _text;
|
|
|
|
};
|
|
|
|
_text = composeText [lineBreak, parseText format ["<t align='center'>%1</t>", _text]];
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-09-20 20:16:51 +00:00
|
|
|
private ["_isShown", "_ctrlHint", "_xPos", "_yPos", "_wPos", "_hPos", "_position"];
|
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
_isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
("ACE_RscHint" call BIS_fnc_rscLayer) cutRsc ["ACE_RscHint", "PLAIN", 0, true];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
disableSerialization;
|
2015-01-12 04:02:33 +00:00
|
|
|
_ctrlHint = uiNamespace getVariable "ACE_ctrlHint";
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-19 20:38:51 +00:00
|
|
|
_ctrlHint ctrlSetBackgroundColor GVAR(displayTextColor);
|
2015-02-22 12:35:05 +00:00
|
|
|
_ctrlHint ctrlSetTextColor GVAR(displayTextFontColor);
|
2015-02-22 10:19:32 +00:00
|
|
|
/*
|
|
|
|
// This does not function at the moment. Has been disabled until it fixed.
|
|
|
|
_xPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))];
|
2015-02-19 20:38:51 +00:00
|
|
|
_yPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH];
|
2015-02-22 10:19:32 +00:00
|
|
|
_wPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))];
|
|
|
|
_hPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))];
|
|
|
|
*/
|
|
|
|
|
|
|
|
_xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40));
|
|
|
|
_yPos = safeZoneY + 0.175 * safezoneH;
|
|
|
|
_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40));
|
|
|
|
_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
|
2015-02-24 18:40:22 +00:00
|
|
|
|
2015-09-20 20:16:51 +00:00
|
|
|
// Zeus Interface Open and Display would be under the "CREATE" list
|
|
|
|
if (!isNull curatorCamera) then {
|
2015-02-24 18:40:22 +00:00
|
|
|
_xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos);
|
|
|
|
};
|
|
|
|
|
2015-02-19 20:38:51 +00:00
|
|
|
_position = [_xPos, _yPos, _wPos, _size * _hPos];
|
|
|
|
|
|
|
|
_ctrlHint ctrlSetPosition _position;
|
2015-01-11 16:42:31 +00:00
|
|
|
_ctrlHint ctrlCommit 0;
|
|
|
|
|
|
|
|
_ctrlHint ctrlSetStructuredText _text;
|
2015-02-19 20:38:51 +00:00
|
|
|
_ctrlHint ctrlSetPosition _position;
|
2015-02-22 10:19:32 +00:00
|
|
|
_ctrlHint ctrlCommit ([0.5, 0] select _isShown);
|