mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
add color support to epoch message @SPKcoding
This commit is contained in:
parent
e379038ab4
commit
be52b911f2
@ -12,101 +12,112 @@
|
||||
|
||||
Usage:
|
||||
"TEST" call Epoch_message
|
||||
|
||||
TODO: Add colors
|
||||
*/
|
||||
|
||||
#include "\A3\ui_f\hpp\defineCommonGrids.inc"
|
||||
_msg = param [0, "No input"];
|
||||
_time = param [1, 2];
|
||||
_customCol = param[2,[]];
|
||||
private["_bgCol","_txtCol"];
|
||||
if(_customCol isEqualTo [])then{
|
||||
_config = 'CfgEpochClient' call EPOCH_returnConfig;
|
||||
_bgCol = getArray(_config >> "epochMessageBackgroundCol");
|
||||
_txtCol = getArray(_config >> "epochMessageTextCol");
|
||||
if !(_bgCol isEqualTypeAll 0)then{_bgCol = [0,0,0,0.2]};
|
||||
if !(_txtCol isEqualTypeAll 0)then{_txtCol = [1,1,1,0.95]};
|
||||
}else{
|
||||
_bgCol = if((_customCol select 0)isEqualTypeAll 0)then[{_customCol select 0},{_bgCol = [0,0,0,0.2]}];
|
||||
_txtCol = if((_customCol select 1)isEqualTypeAll 0)then[{_customCol select 1},{_txtCol = [1,1,1,0.95]}];
|
||||
};
|
||||
|
||||
_msg = str (parseText str _msg); //Parses and converts text back to small string
|
||||
|
||||
if !(isNil "rmx_var_msgQueue") exitWith { rmx_var_msgQueue pushBack [_msg, _time];};
|
||||
if !(isNil "rmx_var_msgQueue") exitWith {rmx_var_msgQueue pushBack [_msg, _time, [_bgCol,_txtCol]]};
|
||||
|
||||
rmx_var_msgQueue = [[_msg, _time]];
|
||||
rmx_var_msgQueue = [[_msg, _time, [_bgCol,_txtCol]]];
|
||||
|
||||
[] spawn {
|
||||
private ["_c1pos","_c2pos","_c3pos","_clr","_dsp"];
|
||||
|
||||
disableSerialization;
|
||||
|
||||
_dsp = findDisplay 46;
|
||||
|
||||
_yPos = 15;
|
||||
_ySize = 2;
|
||||
_c1StartPos = [safeZoneX,((_yPos - _ySize) * GUI_GRID_H + GUI_GRID_Y),safeZoneW, _ySize * GUI_GRID_H];
|
||||
_c1pos = [safeZoneX,(_yPos * GUI_GRID_H + GUI_GRID_Y),safeZoneW, _ySize * GUI_GRID_H];
|
||||
_c2pos = [safeZoneX,((_yPos + _ySize) * GUI_GRID_H + GUI_GRID_Y),safeZoneW, _ySize * GUI_GRID_H];
|
||||
_c3pos = [safeZoneX,((_yPos + _ySize * 2) * GUI_GRID_H + GUI_GRID_Y),safeZoneW, _ySize * GUI_GRID_H];
|
||||
|
||||
_getClr = call Epoch_getColorScheme;
|
||||
_clr = [_getClr select 0, _getClr select 1, _getClr select 2, 0.2];
|
||||
|
||||
|
||||
//Start anim
|
||||
_msg = "";
|
||||
_time = (rmx_var_msgQueue select 0 select 1);
|
||||
|
||||
_col = (rmx_var_msgQueue select 0)select 2;
|
||||
|
||||
_fnc_animFirst = {
|
||||
private "_ctrl";
|
||||
|
||||
_ctrl = param [0];
|
||||
_msg = param [1];
|
||||
_ctrl ctrlSetBackgroundColor [_clr select 0, _clr select 1, _clr select 2, 0.2];
|
||||
_col = param [2];
|
||||
|
||||
_ctrl ctrlSetBackgroundColor (_col select 0);
|
||||
_ctrl ctrlSetText _msg;
|
||||
|
||||
_ctrl ctrlSetTextColor (_col select 1);
|
||||
|
||||
_ctrl ctrlSetPosition _c1StartPos;
|
||||
_ctrl ctrlSetFade 1;
|
||||
_ctrl ctrlCommit 0;
|
||||
|
||||
|
||||
_ctrl ctrlSetPosition _c1pos;
|
||||
_ctrl ctrlSetFade 0;
|
||||
_ctrl ctrlCommit 0.3;
|
||||
};
|
||||
|
||||
|
||||
_fnc_animShiftCtrl = {
|
||||
private ["_ctrl", "_fade", "_fontSize", "_pos"];
|
||||
_ctrl = param [0];
|
||||
_fade = param [1];
|
||||
_fontSize = param [2];
|
||||
_pos = param [3];
|
||||
|
||||
|
||||
_ctrl ctrlSetPosition _pos;
|
||||
_ctrl ctrlSetFontHeight _fontSize;
|
||||
_ctrl ctrlSetFade _fade;
|
||||
_ctrl ctrlCommit 0.3;
|
||||
};
|
||||
|
||||
_tick = diag_tickTime; _ctrlArr = [];
|
||||
|
||||
_tick = diag_tickTime;
|
||||
_ctrlArr = [];
|
||||
while {(diag_tickTime - _tick) < _time} do {
|
||||
|
||||
if !(rmx_var_msgQueue isEqualTo []) then {
|
||||
|
||||
_msg = (rmx_var_msgQueue select 0 select 0);
|
||||
_time = (rmx_var_msgQueue select 0 select 1);
|
||||
_col = (rmx_var_msgQueue select 0)select 2;
|
||||
_tick = diag_tickTime;
|
||||
rmx_var_msgQueue deleteAt 0;
|
||||
_uniqueID =
|
||||
//_uniqueID =
|
||||
switch (count _ctrlArr) do {
|
||||
case 0:
|
||||
{
|
||||
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
|
||||
_ctrlArr = [[_c, _msg]];
|
||||
[_c, _msg] call _fnc_animFirst;
|
||||
[_c, _msg, _col] call _fnc_animFirst;
|
||||
};
|
||||
case 1:
|
||||
{
|
||||
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
|
||||
_ctrlArr set [count _ctrlArr, [_c, _msg]];
|
||||
[_c, _msg] call _fnc_animFirst;
|
||||
|
||||
[_c, _msg, _col] call _fnc_animFirst;
|
||||
|
||||
[_ctrlArr select 0 select 0, 0.5, 0.035, _c2pos] call _fnc_animShiftCtrl;
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
|
||||
_ctrlArr set [count _ctrlArr, [_c, _msg]];
|
||||
[_c, _msg] call _fnc_animFirst;
|
||||
|
||||
[_c, _msg, _col] call _fnc_animFirst;
|
||||
|
||||
[_ctrlArr select 1 select 0, 0.5, 0.035, _c2pos] call _fnc_animShiftCtrl;
|
||||
[_ctrlArr select 0 select 0, 0.75, 0.03, _c3pos] call _fnc_animShiftCtrl;
|
||||
};
|
||||
@ -116,18 +127,18 @@ rmx_var_msgQueue = [[_msg, _time]];
|
||||
[_oldCtrl] call epoch_getIDC;
|
||||
ctrlDelete _oldCtrl;
|
||||
_ctrlArr deleteAt 0;
|
||||
|
||||
|
||||
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
|
||||
_ctrlArr pushBack [_c, _msg];
|
||||
[_c, _msg] call _fnc_animFirst;
|
||||
|
||||
[_c, _msg, _col] call _fnc_animFirst;
|
||||
|
||||
[_ctrlArr select 1 select 0, 0.5, 0.035, _c2pos] call _fnc_animShiftCtrl;
|
||||
[_ctrlArr select 0 select 0, 0.75, 0.03, _c3pos] call _fnc_animShiftCtrl;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//End anim
|
||||
{
|
||||
(_x select 0) ctrlSetFade 1;
|
||||
@ -136,11 +147,11 @@ rmx_var_msgQueue = [[_msg, _time]];
|
||||
} forEach _ctrlArr;
|
||||
|
||||
uisleep 0.50;
|
||||
|
||||
|
||||
{
|
||||
ctrlDelete (_x select 0);
|
||||
} forEach _ctrlArr;
|
||||
|
||||
|
||||
rmx_var_msgQueue = nil;
|
||||
};
|
||||
|
||||
|
@ -43,6 +43,11 @@ class CfgEpochClient
|
||||
maxgates = 5; // Max allowed Gates per Group
|
||||
|
||||
disableRemoteSensors = "true"; // disableRemoteSensors true/false
|
||||
|
||||
epochMessageBackgroundCol[] = {0,0,0,0.2}; //Epoch_message background color (format: {R,G,B,A})
|
||||
epochMessageTextCol[] = {1,1,1,0.95}; //Epoch_message text color (format: {R,G,B,A})
|
||||
//to use different colored messages in scripts, just call it this way: ["the message", 6, [[0,0,0,0.2],[1,1,1,0.95]]] call Epoch_message;
|
||||
|
||||
EPOCH_news[] = {"Word is that Sappers have a new boss.","Dogs will often lure them monsters away.","My dog was blown up. I miss him.."};
|
||||
deathMorphClass[] = {"Epoch_Sapper_F","Epoch_SapperG_F","Epoch_SapperB_F","I_UAV_01_F","Epoch_Cloak_F"}; //Random selection of these classes when player morphs after death. Currently available: Epoch_Cloak_F, Epoch_SapperB_F, Epoch_Sapper_F, I_UAV_01_F
|
||||
niteLight[] = {1,1.88,22}; //Set ambient lighting at night: {Brightness of light,Height of light}. Default (Low Ambient): {1.88,22} | Twilight: {7.2,88} | Distant: {12.8,142}
|
||||
|
Loading…
Reference in New Issue
Block a user