add color support to epoch message @SPKcoding

This commit is contained in:
vbawol 2017-03-30 11:19:46 -05:00
parent e379038ab4
commit be52b911f2
2 changed files with 47 additions and 31 deletions

View File

@ -12,101 +12,112 @@
Usage: Usage:
"TEST" call Epoch_message "TEST" call Epoch_message
TODO: Add colors
*/ */
#include "\A3\ui_f\hpp\defineCommonGrids.inc" #include "\A3\ui_f\hpp\defineCommonGrids.inc"
_msg = param [0, "No input"]; _msg = param [0, "No input"];
_time = param [1, 2]; _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 _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 { [] spawn {
private ["_c1pos","_c2pos","_c3pos","_clr","_dsp"]; private ["_c1pos","_c2pos","_c3pos","_clr","_dsp"];
disableSerialization; disableSerialization;
_dsp = findDisplay 46; _dsp = findDisplay 46;
_yPos = 15; _yPos = 15;
_ySize = 2; _ySize = 2;
_c1StartPos = [safeZoneX,((_yPos - _ySize) * GUI_GRID_H + GUI_GRID_Y),safeZoneW, _ySize * GUI_GRID_H]; _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]; _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]; _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]; _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 //Start anim
_msg = ""; _msg = "";
_time = (rmx_var_msgQueue select 0 select 1); _time = (rmx_var_msgQueue select 0 select 1);
_col = (rmx_var_msgQueue select 0)select 2;
_fnc_animFirst = { _fnc_animFirst = {
private "_ctrl"; private "_ctrl";
_ctrl = param [0]; _ctrl = param [0];
_msg = param [1]; _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 ctrlSetText _msg;
_ctrl ctrlSetTextColor (_col select 1);
_ctrl ctrlSetPosition _c1StartPos; _ctrl ctrlSetPosition _c1StartPos;
_ctrl ctrlSetFade 1; _ctrl ctrlSetFade 1;
_ctrl ctrlCommit 0; _ctrl ctrlCommit 0;
_ctrl ctrlSetPosition _c1pos; _ctrl ctrlSetPosition _c1pos;
_ctrl ctrlSetFade 0; _ctrl ctrlSetFade 0;
_ctrl ctrlCommit 0.3; _ctrl ctrlCommit 0.3;
}; };
_fnc_animShiftCtrl = { _fnc_animShiftCtrl = {
private ["_ctrl", "_fade", "_fontSize", "_pos"]; private ["_ctrl", "_fade", "_fontSize", "_pos"];
_ctrl = param [0]; _ctrl = param [0];
_fade = param [1]; _fade = param [1];
_fontSize = param [2]; _fontSize = param [2];
_pos = param [3]; _pos = param [3];
_ctrl ctrlSetPosition _pos; _ctrl ctrlSetPosition _pos;
_ctrl ctrlSetFontHeight _fontSize; _ctrl ctrlSetFontHeight _fontSize;
_ctrl ctrlSetFade _fade; _ctrl ctrlSetFade _fade;
_ctrl ctrlCommit 0.3; _ctrl ctrlCommit 0.3;
}; };
_tick = diag_tickTime; _ctrlArr = []; _tick = diag_tickTime;
_ctrlArr = [];
while {(diag_tickTime - _tick) < _time} do { while {(diag_tickTime - _tick) < _time} do {
if !(rmx_var_msgQueue isEqualTo []) then { if !(rmx_var_msgQueue isEqualTo []) then {
_msg = (rmx_var_msgQueue select 0 select 0); _msg = (rmx_var_msgQueue select 0 select 0);
_time = (rmx_var_msgQueue select 0 select 1); _time = (rmx_var_msgQueue select 0 select 1);
_col = (rmx_var_msgQueue select 0)select 2;
_tick = diag_tickTime; _tick = diag_tickTime;
rmx_var_msgQueue deleteAt 0; rmx_var_msgQueue deleteAt 0;
_uniqueID = //_uniqueID =
switch (count _ctrlArr) do { switch (count _ctrlArr) do {
case 0: case 0:
{ {
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC]; _c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
_ctrlArr = [[_c, _msg]]; _ctrlArr = [[_c, _msg]];
[_c, _msg] call _fnc_animFirst; [_c, _msg, _col] call _fnc_animFirst;
}; };
case 1: case 1:
{ {
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC]; _c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
_ctrlArr set [count _ctrlArr, [_c, _msg]]; _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; [_ctrlArr select 0 select 0, 0.5, 0.035, _c2pos] call _fnc_animShiftCtrl;
}; };
case 2: case 2:
{ {
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC]; _c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
_ctrlArr set [count _ctrlArr, [_c, _msg]]; _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 1 select 0, 0.5, 0.035, _c2pos] call _fnc_animShiftCtrl;
[_ctrlArr select 0 select 0, 0.75, 0.03, _c3pos] 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; [_oldCtrl] call epoch_getIDC;
ctrlDelete _oldCtrl; ctrlDelete _oldCtrl;
_ctrlArr deleteAt 0; _ctrlArr deleteAt 0;
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC]; _c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
_ctrlArr pushBack [_c, _msg]; _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 1 select 0, 0.5, 0.035, _c2pos] call _fnc_animShiftCtrl;
[_ctrlArr select 0 select 0, 0.75, 0.03, _c3pos] call _fnc_animShiftCtrl; [_ctrlArr select 0 select 0, 0.75, 0.03, _c3pos] call _fnc_animShiftCtrl;
}; };
}; };
}; };
}; };
//End anim //End anim
{ {
(_x select 0) ctrlSetFade 1; (_x select 0) ctrlSetFade 1;
@ -136,11 +147,11 @@ rmx_var_msgQueue = [[_msg, _time]];
} forEach _ctrlArr; } forEach _ctrlArr;
uisleep 0.50; uisleep 0.50;
{ {
ctrlDelete (_x select 0); ctrlDelete (_x select 0);
} forEach _ctrlArr; } forEach _ctrlArr;
rmx_var_msgQueue = nil; rmx_var_msgQueue = nil;
}; };

View File

@ -43,6 +43,11 @@ class CfgEpochClient
maxgates = 5; // Max allowed Gates per Group maxgates = 5; // Max allowed Gates per Group
disableRemoteSensors = "true"; // disableRemoteSensors true/false 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.."}; 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 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} 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}