New message design

This commit is contained in:
IT07 2016-05-26 15:55:21 +02:00
parent fe8d4b4496
commit 53a0c79872
5 changed files with 254 additions and 199 deletions

View File

@ -4,40 +4,125 @@ class RscDisplayVEMFrClient
fadeIn = 0.2;
fadeOut = 1;
duration = 99999;
onLoad = "uiNamespace setVariable ['RscDisplayVEMFrClient', _this select 0]";
onLoad = "uiNamespace setVariable ['RscDisplayVEMFrClient', _this select 0]; ExecVM 'VEMFr_client\sqf\onLoad.sqf'";
onUnLoad = "uiNamespace setVariable ['RscDisplayVEMFrClient', displayNull]";
movingEnable = 0;
class IGUIBack
class RscBackground
{
type = 0;
text = "";
colorText[] = {0,0,0,0};
font = "PuristaMedium";
sizeEx = 0;
access = 0;
colorBackground[] = {0.48,0.5,0.35,1};
colorShadow[] = {0,0,0,0.5};
colorText[] = {0.1,0.1,0.1,1};
deletable = 0;
fade = 0;
fixedWidth = 0;
font = "PuristaLight";
h = 1;
idc = -1;
linespacing = 1;
shadow = 0;
style = 128;
SizeEx = 1;
style = 512;
text = "";
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
tooltipColorText[] = {1,1,1,1};
type = 0;
w = 1;
x = 0;
y = 0;
};
class RscPictureKeepAspect
{
access = 0;
colorBackground[] = {0,0,0,1};
colorText[] = {1,1,1,1};
deletable = 0;
fade = 0;
fixedWidth = 0;
font = "PuristaMedium";
h = 0.15;
idc = -1;
lineSpacing = 0;
shadow = 0;
sizeEx = 0;
style = "0x30 + 0x800";
text = "";
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
tooltipColorText[] = {1,1,1,1};
type = 0;
w = 0.2;
x = 0;
y = 0;
};
class RscText
{
shadow = 0;
access = 0;
colorBackground[] = {0.071,0.078,0.094,1};
colorShadow[] = {0,0,0,0.5};
colorText[] = {0.22,0.745,0.882,1};
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};
font = "PuristaMedium";
h = 0.037;
idc = -1;
linespacing = 1;
shadow = 1;
sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
style = 0;
text = "";
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
tooltipColorText[] = {1,1,1,1};
type = 0;
w = 0.3;
x = 0;
y = 0;
};
class controls
{
#include "RscDisplayVEMFrClientControls.hpp"
class icon:RscPictureKeepAspect
{
x = 0.25 * safezoneW + safezoneX;
y = 0.825 * safezoneH + safezoneY;
w = 0.025 * safezoneW;
h = 0.0525 * safezoneH;
fade = 1;
idc = 10;
text = "\A3\ui_f\data\map\markers\nato\o_unknown.paa";
};
class txtTitle: RscText
{
x = 0.285 * safezoneW + safezoneX;
y = 0.825 * safezoneH + safezoneY;
w = 0 * safezoneW;
h = 0.02 * safezoneH;
colorBackground[] = {1,1,1,0.1};
colorText[] = {1,1,1,0.95};
fade = 1;
idc = 11;
shadow = 0;
sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.85)";
text = "";
};
class txtMsg: RscText
{
x = 0.285 * safezoneW + safezoneX;
y = 0.845 * safezoneH + safezoneY;
w = 0 * safezoneW;
h = 0.03 * safezoneH;
colorBackground[] = {1,1,1,0.1};
colorText[] = {1,1,1,0.95};
fade = 1;
idc = 12;
shadow = 0;
sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.25)";
text = "";
};
};
};

View File

@ -1,36 +0,0 @@
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;
};

View File

@ -1,118 +0,0 @@
_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;
};
};
};

View File

@ -1,29 +1,45 @@
if (hasInterface) then
{
uiNamespace setVariable ["RscDisplayVEMFrClientMsgQueue", []];
uiNamespace setVariable ["RscDisplayVEMFrClient", displayNull];
// custom addPublicVariableEventHandler. Those bloody BE filters.....
[] spawn
if hasInterface then
{
_handleMessage =
{
_data = _this;
_msg = param [0, "", [[],format[""]]];
_mode = param [1, "", [""]];
if (_mode isEqualTo "sys") then
uiNamespace setVariable ["VEMFrMsgQueue", []];
uiNamespace setVariable ["RscDisplayVEMFrClient", displayNull];
// custom addPublicVariableEventHandler. Those bloody BE filters.....
if isMultiplayer then
{
systemChat _msg;
_handleMessage =
{
_data = _this;
_msg = param [0, "", [[],format[""]]];
_mode = param [1, "", [""]];
if (_mode isEqualTo "sys") then
{
systemChat _msg;
} else
{
(uiNamespace getVariable ["VEMFrMsgQueue", []]) pushBack _msg;
if isNull(uiNamespace getVariable ["RscDisplayVEMFrClient", displayNull]) then
{
(["RscDisplayVEMFrClient"] call BIS_fnc_rscLayer) cutRsc["RscDisplayVEMFrClient", "PLAIN", 0, true]
};
};
};
while {true} do
{
if not isNil"VEMFrMsgToClient" then
{
VEMFrMsgToClient spawn _handleMessage;
VEMFrMsgToClient = nil;
} else
{
uiSleep 0.05;
};
};
} else
{
[_msg select 0, _msg select 1] ExecVM "VEMFr_client\sqf\handleMessage.sqf";
_arr = uiNamespace getVariable ["VEMFrMsgQueue",[]];
_arr pushBack [0,"NEW TAKEOVER","Raiders have taken over ..."];
_arr pushBack [1,"NEW POLICE RAID", format["%1 Police forces are raiding ...", worldName]];
_arr pushBack [2,"NEW S.W.A.T. RAID", format["%1's S.W.A.T. teams are raiding ...", worldName]];
waitUntil { if not(isNull(findDisplay 46)) then {true} else {uiSleep 0.5; false} };
player addAction ["Trigger VEMFr Message",{(["RscDisplayVEMFrClient"] call BIS_fnc_rscLayer) cutRsc["RscDisplayVEMFrClient", "PLAIN", 0, true]},"",-1,false,true,"User2","alive player"];
};
};
while {true} do
{
waitUntil { if isNil"VEMFrClientMsg" then { uiSleep 0.05; false } else { true }};
_data = VEMFrClientMsg;
VEMFrClientMsg = nil;
_data spawn _handleMessage;
};
};
};

View File

@ -0,0 +1,108 @@
_dsp = uiNamespace getVariable ["RscDisplayVEMFrClient", displayNull];
if not isNull _dsp then
{
if (count (uiNamespace getVariable ["VEMFrMsgQueue", []]) isEqualTo 0) then
{
(["RscDisplayVEMFrClient"] call BIS_fnc_rscLayer) cutFadeOut 0;
systemChat "[VEMFrClient] No messages to display";
} else
{
// do stuff
_ctrlPic = _dsp displayCtrl 10;
_ctrlTitle = _dsp displayCtrl 11;
_ctrlMsg = _dsp displayCtrl 12;
{
[_dsp, _x] spawn
{
disableSerialization;
_dsp = _this select 0;
_data = _this select 1;
_ctrlPic = _dsp displayCtrl 10;
if (ctrlFade _ctrlPic < 1) then
{
_ctrlPic ctrlSetFade 1;
_ctrlPic ctrlCommit 0.5;
uiSleep 0.75;
};
_ctrlPic ctrlSetTextColor call
{
private ["_return"];
if (_data select 0 isEqualTo 0) then
{
_return = [0.5,0,0,1];
};
if (_data select 0 isEqualTo 1) then
{
_return = [0,0.3,0.6,1];
};
if (_data select 0 isEqualTo 2) then
{
_return = [0,0,0,1];
};
if isNil"_return" then
{
_return = [1,1,1,1];
};
_return
};
_ctrlPic ctrlSetFade 0;
_ctrlPic ctrlCommit 0.5;
};
if (_ctrlTitle getVariable ["expanded",false] AND _ctrlMsg getVariable ["expanded", false]) then
{
_ctrlPos = ctrlPosition _ctrlTitle;
_ctrlTitle ctrlSetPosition [_ctrlPos select 0, _ctrlPos select 1, 0 * safezoneW, _ctrlPos select 3];
_ctrlTitle ctrlSetFade 1;
_ctrlTitle ctrlCommit 0.5;
_ctrlTitle setVariable ["expanded", false];
uiSleep 0.75;
_ctrlTitle ctrlSetText toUpper (_x select 1);
_ctrlPos = ctrlPosition _ctrlTitle;
_ctrlTitle ctrlSetPosition [_ctrlPos select 0, _ctrlPos select 1, 0.1 * safezoneW, _ctrlPos select 3];
_ctrlTitle ctrlSetFade 0;
_ctrlTitle ctrlCommit 0.5;
_ctrlTitle setVariable ["expanded", true];
_ctrlPos = ctrlPosition _ctrlMsg;
_ctrlMsg ctrlSetPosition [_ctrlPos select 0, _ctrlPos select 1, 0 * safezoneW, _ctrlPos select 3];
_ctrlMsg ctrlSetFade 1;
_ctrlMsg ctrlCommit 0.5;
_ctrlMsg setVariable ["expanded", false];
uiSleep 0.75;
_ctrlMsg ctrlSetText (_x select 2);
_ctrlPos = ctrlPosition _ctrlMsg;
_ctrlMsg ctrlSetPosition [_ctrlPos select 0, _ctrlPos select 1, 0.45 * safezoneW, _ctrlPos select 3];
_ctrlMsg ctrlSetFade 0;
_ctrlMsg ctrlCommit 0.5;
_ctrlMsg setVariable ["expanded", true];
uiSleep (count (_x select 2) / 5);
} else
{
_ctrlTitle ctrlSetText toUpper (_x select 1);
_ctrlPos = ctrlPosition _ctrlTitle;
_ctrlTitle ctrlSetPosition [_ctrlPos select 0, _ctrlPos select 1, 0.1 * safezoneW, _ctrlPos select 3];
_ctrlTitle ctrlSetFade 0;
_ctrlTitle ctrlCommit 0.5;
_ctrlTitle setVariable ["expanded", true];
_ctrlMsg ctrlSetText (_x select 2);
_ctrlPos = ctrlPosition _ctrlMsg;
_ctrlMsg ctrlSetPosition [_ctrlPos select 0, _ctrlPos select 1, 0.45 * safezoneW, _ctrlPos select 3];
_ctrlMsg ctrlSetFade 0;
_ctrlMsg ctrlCommit 0.5;
_ctrlMsg setVariable ["expanded", true];
uiSleep (count (_x select 2) / 5);
};
} forEach (uiNamespace getVariable ["VEMFrMsgQueue",[]]);
uiNamespace setVariable ["VEMFrMsgQueue", []];
(["RscDisplayVEMFrClient"] call BIS_fnc_rscLayer) cutFadeOut 0.5;
};
} else
{
systemChat "Nope.";
};
//(uiNamespace getVariable ["VEMFrMsgQueue", []]) pushBack ["title","message"];