From 55a8a8cd1b66d674f9b04b49d07656056401bdad Mon Sep 17 00:00:00 2001 From: IT07 Date: Mon, 11 Apr 2016 16:11:30 +0200 Subject: [PATCH] Reworked --- .../gui/RscDisplayVEMFrClient.hpp | 43 +++++++ .../gui/RscDisplayVEMFrClientControls.hpp | 36 ++++++ .../VEMFr_client/sqf/handleMessage.sqf | 118 ++++++++++++++++++ Exile.MapName/VEMFr_client/sqf/initClient.sqf | 36 ++++++ 4 files changed, 233 insertions(+) create mode 100644 Exile.MapName/VEMFr_client/gui/RscDisplayVEMFrClient.hpp create mode 100644 Exile.MapName/VEMFr_client/gui/RscDisplayVEMFrClientControls.hpp create mode 100644 Exile.MapName/VEMFr_client/sqf/handleMessage.sqf create mode 100644 Exile.MapName/VEMFr_client/sqf/initClient.sqf diff --git a/Exile.MapName/VEMFr_client/gui/RscDisplayVEMFrClient.hpp b/Exile.MapName/VEMFr_client/gui/RscDisplayVEMFrClient.hpp new file mode 100644 index 0000000..8b74a2f --- /dev/null +++ b/Exile.MapName/VEMFr_client/gui/RscDisplayVEMFrClient.hpp @@ -0,0 +1,43 @@ +class RscDisplayVEMFrClient +{ + idd = 2991; + fadeIn = 0.2; + fadeOut = 1; + duration = 99999; + onLoad = "uiNamespace setVariable ['RscDisplayVEMFrClient', _this select 0]"; + movingEnable = 0; + class IGUIBack + { + type = 0; + text = ""; + colorText[] = {0,0,0,0}; + font = "PuristaMedium"; + sizeEx = 0; + shadow = 0; + style = 128; + colorBackground[] = {0,0,0,1}; + }; + class RscText + { + shadow = 0; + deletable = 0; + fade = 0; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + font = "PuristaLight"; + style = 0; + access = 0; + type = 0; + fixedWidth = 0; + colorShadow[] = {0,0,0,0.5}; + lineSpacing = 1; + tooltipColorText[] = {1,1,1,0.9}; + tooltipColorBox[] = {1,1,1,0.2}; + tooltipColorShade[] = {0,0,0,0.7}; + colorText[] = {0.22,0.745,0.882,1}; + colorBackground[] = {0.071,0.078,0.094,1}; + }; + class controls + { + #include "RscDisplayVEMFrClientControls.hpp" + }; +}; diff --git a/Exile.MapName/VEMFr_client/gui/RscDisplayVEMFrClientControls.hpp b/Exile.MapName/VEMFr_client/gui/RscDisplayVEMFrClientControls.hpp new file mode 100644 index 0000000..c0cc61e --- /dev/null +++ b/Exile.MapName/VEMFr_client/gui/RscDisplayVEMFrClientControls.hpp @@ -0,0 +1,36 @@ +class txtType: RscText +{ + idc = 1002; + font = "PuristaSemiBold"; + text = ""; + colorText[] = {0,0,0,0.9}; + colorBackground[] = {1,1,1,0.9}; + x = 0.25 * safezoneW + safezoneX; + y = 0.88 * safezoneH + safezoneY; + w = 0 * safezoneW; + h = 0.02 * safezoneH; +}; +class txtTag: RscText +{ + idc = 1001; + font = "PuristaBold"; + text = ""; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.3)"; + colorText[] = {0,0,0,0.9}; + colorBackground[] = {1,1,1,0.9}; + x = 0.25 * safezoneW + safezoneX; + y = 0.9 * safezoneH + safezoneY; + w = 0.05 * safezoneW; + h = 0 * safezoneH; +}; +class txtMsg: RscText +{ + idc = 1000; + text = ""; + colorText[] = {1,1,1,0.9}; + colorBackground[] = {0,0,0,0.9}; + x = 0.3 * safezoneW + safezoneX; + y = 0.9 * safezoneH + safezoneY; + w = 0 * safezoneW; + h = 0.03 * safezoneH; +}; diff --git a/Exile.MapName/VEMFr_client/sqf/handleMessage.sqf b/Exile.MapName/VEMFr_client/sqf/handleMessage.sqf new file mode 100644 index 0000000..2a4bdf5 --- /dev/null +++ b/Exile.MapName/VEMFr_client/sqf/handleMessage.sqf @@ -0,0 +1,118 @@ +_txt = param [0, "", [""]]; +_type = param [1, "", [""]]; +if not(_txt isEqualTo "") then +{ + _msgQueue = uiNamespace getVariable ["RscDisplayVEMFrClientMsgQueue", []]; + _msgQueue pushBack _txt; + disableSerialization; + _dsp = uiNamespace getVariable ["RscDisplayVEMFrClient", displayNull]; + _doAnim = + { + for "_g" from 1 to (count _txt) do + { + _ctrl ctrlSetText (_txt select [0, _g]); + if isNull (findDisplay 49) then + { + if not isNull _dsp then + { + playSound ["ReadOutClick", true]; + }; + }; + uiSleep 0.05; + }; + _chars = []; + for "_t" from 1 to (count _txt) do + { + _char = _txt select [_t, 1]; + _chars pushBack _char; + }; + _writeThis = +_chars; + uiSleep ((count _txt)/6); + for "_i" from (count _chars) to 1 step -1 do + { + _charID = floor random count _chars; + _deleted = _chars deleteAt _charID; + if not(_deleted isEqualTo "") then + { + _charToSet = _writeThis find _deleted; + if not(_deleted isEqualTo " ") then + { + _binaries = ["0","1"]; + _writeThis set [_charToSet, _binaries select floor random count _binaries]; + }; + _string = ""; + { + _string = _string + _x; + } forEach _writeThis; + _ctrl ctrlSetText _string; + if isNull(findDisplay 49) then + { + if not isNull _dsp then + { + playSound ["ReadOutHideClick1", true]; + }; + }; + uiSleep 0.05; + }; + }; + + if (typeName _msgQueue isEqualTo "ARRAY") then + { + _index = _msgQueue find _txt; + if (_index > -1) then + { + _msgQueue deleteAt _index; + }; + }; + + if (count _msgQueue isEqualTo 0) then + { + _ctrl ctrlSetPosition [(ctrlPosition _ctrl) select 0, (ctrlPosition _ctrl) select 1, 0 * safezoneW, (ctrlPosition _ctrl) select 3]; + _ctrl ctrlCommit 0.5; + uiSleep 0.5; + _ctrlTag ctrlSetPosition [(ctrlPosition _ctrlTag) select 0, (ctrlPosition _ctrlTag) select 1, (ctrlPosition _ctrlTag) select 2, 0 * safezoneH]; + _ctrlTag ctrlCommit 0.3; + _ctrlTag ctrlSetText ""; + uiSleep 0.3; + _ctrlMsgType ctrlSetPosition [(ctrlPosition _ctrlMsgType) select 0, (ctrlPosition _ctrlMsgType) select 1, 0 * safezoneW, (ctrlPosition _ctrlMsgType) select 3]; + _ctrlMsgType ctrlCommit 0.3; + uiSleep 0.3; + (["RscDisplayVEMFrClient"] call BIS_fnc_rscLayer) cutFadeOut 0.3; + }; + }; + if isNull _dsp then + { // Make sure the display is actually active + (["RscDisplayVEMFrClient"] call BIS_fnc_rscLayer) cutRsc["RscDisplayVEMFrClient", "PLAIN", 0, true]; + _dsp = uiNamespace getVariable ["RscDisplayVEMFrClient", displayNull]; + if ((count _msgQueue) > 0) then + { + _ctrlMsgType = _dsp displayCtrl 1002; + _ctrlMsgType ctrlSetText _type; + _ctrlMsgType ctrlSetPosition [(ctrlPosition _ctrlMsgType) select 0, (ctrlPosition _ctrlMsgType) select 1, 0.1 * safezoneW, (ctrlPosition _ctrlMsgType) select 3]; + _ctrlMsgType ctrlCommit 0.3; + uiSleep 0.3; + _ctrlTag = _dsp displayCtrl 1001; + _ctrlTag ctrlSetPosition [(ctrlPosition _ctrlTag) select 0, (ctrlPosition _ctrlTag) select 1, (ctrlPosition _ctrlTag) select 2, 0.03 * safezoneH]; + _ctrlTag ctrlCommit 0.3; + uiSleep 0.3; + _ctrlTag ctrlSetText toString [91,86,69,77,70,93]; + _ctrl = _dsp displayCtrl 1000; + _ctrl ctrlSetPosition [(ctrlPosition _ctrl) select 0, (ctrlPosition _ctrl) select 1, 0.4375 * safezoneW, (ctrlPosition _ctrl) select 3]; + _ctrl ctrlCommit 0.3; + uiSleep 0.3; + call _doAnim; + }; + }; + if not isNull _dsp then + { + waitUntil { uiSleep 1; (_msgQueue select 0) isEqualTo _txt }; + if not isNull _dsp then + { + _ctrlMsgType = _dsp displayCtrl 1002; + _ctrlMsgType ctrlSetText _type; + _ctrlTag = _dsp displayCtrl 1001; + _ctrl = _dsp displayCtrl 1000; + call _doAnim; + }; + }; +}; diff --git a/Exile.MapName/VEMFr_client/sqf/initClient.sqf b/Exile.MapName/VEMFr_client/sqf/initClient.sqf new file mode 100644 index 0000000..ec72124 --- /dev/null +++ b/Exile.MapName/VEMFr_client/sqf/initClient.sqf @@ -0,0 +1,36 @@ +if (hasInterface) then +{ + uiNamespace setVariable ["RscDisplayVEMFrClientMsgQueue", []]; + uiNamespace setVariable ["RscDisplayVEMFrClient", displayNull]; + // custom addPublicVariableEventHandler. Those bloody BE filters..... + [] spawn + { + while {true} do + { + waitUntil { uiSleep 0.05; not isNil"VEMFrClientMsg" }; + if (typeName VEMFrClientMsg isEqualTo "ARRAY") then + { + _data = +[VEMFrClientMsg]; + VEMFrClientMsg = nil; + _data = _data select 0; + [_data] spawn + { + _data = _this select 0; + _mode = _data param [1, "", [""]]; + _msg = _data param [0, "", [[],format[""]]]; + switch _mode do + { + case "sys": + { + systemChat _msg; + }; + default + { + [_msg select 0, _msg select 1] ExecVM "VEMFr_client\sqf\handleMessage.sqf"; + }; + }; + }; + }; + }; + }; +};