Merge pull request #161 from KoffeinFlummi/displayTextRemoteClients

Improvements for displayText
This commit is contained in:
Glowbal 2015-02-25 14:35:55 +01:00
commit 3721e14561
3 changed files with 41 additions and 7 deletions

View File

@ -158,3 +158,6 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
PARAMS_2(_vehicle,_fuelLevel);
_vehicle setFuel _fuelLevel;
}] call FUNC(addEventhandler);
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);
["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler);

View File

@ -7,6 +7,7 @@
* 0: Text <ANY>
* 1: Image <STRING>
* 2: Image color <ARRAY> <OPTIONAL>
* 3: Target Unit. Will only display if target is the player controlled object <OBJECT> <OPTIONAL>
*
* Return value:
* Nothing
@ -14,17 +15,30 @@
#include "script_component.hpp"
private ["_text", "_image", "_imageColor"];
private ["_text", "_image", "_imageColor", "_target"];
_text = _this select 0;
_image = _this select 1;
_imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]};
_imageColor resize 3;
_target = if (count _this > 3) then {_this select 3} else {ACE_player};
if (_target != ACE_player) exitWith {};
if (typeName _text != "TEXT") then {
if (typeName _text == "STRING" && {isLocalized _text}) then {
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;
};
};
if (typeName _text == "STRING" && {isLocalized _text}) then {
_text = localize _text;
};
_text = parseText format ["<t align='center'>%1</t>", _text];
_text = parseText format ["<t align='center'>%1</t>", _text];
};
_text = composeText [parseText format ["<img size='2' align='center' color='%2' image='%1'/>", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text];
[_text, 2] call FUNC(displayTextStructured);

View File

@ -6,6 +6,7 @@
* Argument:
* 0: Text <ANY>
* 1: Size of the textbox <NUMBER> <OPTIONAL>
* 2: Target Unit. Will only display if target is the player controlled object <OBJECT> <OPTIONAL>
*
* Return value:
* Nothing
@ -13,14 +14,24 @@
#include "script_component.hpp"
private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position"];
private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position", "_target"];
_text = _this select 0;
_size = _this select 1;
_size = if (count _this > 1) then {_this select 1} else {1.5;};
_target = if (count _this > 2) then {_this select 2} else {ACE_player};
if (isNil "_size") then {_size = 1.5};
if (_target != ACE_player) exitWith {};
if (typeName _text != "TEXT") then {
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;
};
};
if (typeName _text == "STRING" && {isLocalized _text}) then {
_text = localize _text;
};
@ -48,6 +59,12 @@ _xPos = ((safezoneX + safezoneW) - (10 *(((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));
//Zeus Interface Open and Display would be under the "CREATE" list
if (!isnull curatorCamera) then {
_xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos);
};
_position = [_xPos, _yPos, _wPos, _size * _hPos];
_ctrlHint ctrlSetPosition _position;