diff --git a/@cTab/addons/cTab/functions/fn_addNotification.sqf b/@cTab/addons/cTab/functions/fn_addNotification.sqf index 3daf2d0..0dbab32 100644 --- a/@cTab/addons/cTab/functions/fn_addNotification.sqf +++ b/@cTab/addons/cTab/functions/fn_addNotification.sqf @@ -7,20 +7,22 @@ * Arguments: * 0: App ID * 1: Notification + * 2: Decay time in seconds * * Return Value: * TRUE * * Example: - * [_appID,"This is a notification"] call cTab_fnc_addNotification; + * [_appID,"This is a notification",5] call cTab_fnc_addNotification; * * Public: No */ -private ["_appID","_notification","_time","_done"]; +private ["_appID","_notification","_time","_done","_decayTime"]; _appID = _this select 0; _notification = _this select 1; +_decayTime = _this select 2; _time = [] call cTab_fnc_currentTime; _done = false; @@ -28,14 +30,14 @@ _done = false; { // if we find one, override it and increase the counter if ((_x select 0) isEqualTo _appID) exitWith { - cTabNotificationCache set [_forEachIndex,[_appID,_time,_notification,(_x select 3) + 1]]; + cTabNotificationCache set [_forEachIndex,[_appID,_time,_notification,_decayTime,(_x select 4) + 1]]; _done = true; }; } forEach cTabNotificationCache; // if we haven't added the notification to the cache above, do it now if !(_done) then { - cTabNotificationCache pushBack [_appID,_time,_notification,1]; + cTabNotificationCache pushBack [_appID,_time,_notification,_decayTime,1]; }; [] call cTab_fnc_processNotifications; diff --git a/@cTab/addons/cTab/functions/fn_addUserMarker.sqf b/@cTab/addons/cTab/functions/fn_addUserMarker.sqf index ca2ab15..6f79486 100644 --- a/@cTab/addons/cTab/functions/fn_addUserMarker.sqf +++ b/@cTab/addons/cTab/functions/fn_addUserMarker.sqf @@ -47,7 +47,11 @@ call { // If this was run on a client-server (i.e. in single player or locally hosted), update the marker list if (hasInterface && {_encryptionKey == call cTab_fnc_getPlayerEncryptionKey}) then { call cTab_fnc_updateUserMarkerList; - ["BFT","Marker added succesfully"] call cTab_fnc_addNotification; + if ((_markerData select 5) != cTab_player) then { + ["BFT",format ["New marker at #%1",mapGridPosition (_markerData select 0)],20] call cTab_fnc_addNotification; + } else { + ["BFT","Marker added succesfully",3] call cTab_fnc_addNotification; + }; }; }; }; @@ -68,10 +72,10 @@ call { call cTab_fnc_updateUserMarkerList; // add notification if marker was issued by someone else - if ((_markerData select 5) != cTab_player) then { - ["BFT",format ["New marker at #%1",mapGridPosition _markerData select 0]] call cTab_fnc_addNotification; + if ((_markerData select 1 select 5) != cTab_player) then { + ["BFT",format ["New marker at #%1",mapGridPosition (_markerData select 1 select 0)],20] call cTab_fnc_addNotification; } else { - ["BFT","Marker added succesfully"] call cTab_fnc_addNotification; + ["BFT","Marker added succesfully",3] call cTab_fnc_addNotification; }; }; }; diff --git a/@cTab/addons/cTab/functions/fn_processNotifications.sqf b/@cTab/addons/cTab/functions/fn_processNotifications.sqf index 083a9f8..c3707b3 100644 --- a/@cTab/addons/cTab/functions/fn_processNotifications.sqf +++ b/@cTab/addons/cTab/functions/fn_processNotifications.sqf @@ -18,7 +18,7 @@ #include "\cTab\shared\cTab_gui_macros.hpp" -private ["_displayName","_display","_ctrl","_currentTime","_text","_notification"]; +private ["_displayName","_display","_ctrl","_currentTime","_text","_notification","_decayTime"]; // make sure there is no PFH already, the interface is open and notifications are available if (isNil "cTabProcessNotificationsPFH" && !(isNil "cTabIfOpen") && count cTabNotificationCache != 0) then { @@ -36,17 +36,17 @@ if (isNil "cTabProcessNotificationsPFH" && !(isNil "cTabIfOpen") && count cTabNo if (count cTabNotificationCache != 0) then { // grab and delete the oldest notification _notification = cTabNotificationCache deleteAt 0; - + _decayTime = _notification select 3; _currentTime = [] call cTab_fnc_currentTime; // see if notification was issued in the same minute, if so, omit showing the time - if (_currentTime isEqualTo (_notification select 1)) then { - _text = format ["%1",_notification select 2]; + _text = if (_currentTime isEqualTo (_notification select 1)) then { + format ["%1",_notification select 2]; } else { - _text = format ["%1: %2",_notification select 1,_notification select 2]; + format ["%1: %2",_notification select 1,_notification select 2]; }; // if the counter on the notification is greater than 1, append the counter to the notification text - if ((_notification select 3) > 1) then { - _text = format ["%1 (x%2)",_text,_notification select 3]; + if ((_notification select 4) > 1) then { + _text = format ["%1 (x%2)",_text,_notification select 4]; }; // show the notification @@ -64,7 +64,7 @@ if (isNil "cTabProcessNotificationsPFH" && !(isNil "cTabIfOpen") && count cTabNo // make the control fade out _ctrl ctrlSetFade 1; - _ctrl ctrlCommit 5; + _ctrl ctrlCommit _decayTime; } else { [_this select 1] call CBA_fnc_removePerFrameHandler; _ctrl ctrlShow false; diff --git a/@cTab/addons/cTab/functions/fn_remoteControlUav.sqf b/@cTab/addons/cTab/functions/fn_remoteControlUav.sqf index 72fa588..3794e72 100644 --- a/@cTab/addons/cTab/functions/fn_remoteControlUav.sqf +++ b/@cTab/addons/cTab/functions/fn_remoteControlUav.sqf @@ -40,11 +40,11 @@ if (UAVControl cTabActUav select 1 != "GUNNER") then { }; } else { // show notification - ["UAV","No gunner optics available"] call cTab_fnc_addNotification; + ["UAV","No gunner optics available",5] call cTab_fnc_addNotification; }; } else { // show notification - ["UAV","Another user has control"]call cTab_fnc_addNotification; + ["UAV","Another user has control",5] call cTab_fnc_addNotification; }; true \ No newline at end of file diff --git a/@cTab/addons/cTab/player_init.sqf b/@cTab/addons/cTab/player_init.sqf index 0cce160..ac971f8 100644 --- a/@cTab/addons/cTab/player_init.sqf +++ b/@cTab/addons/cTab/player_init.sqf @@ -1101,7 +1101,7 @@ cTab_msg_Send = { }; // add a notification - ["MSG","Message sent successfully"] call cTab_fnc_addNotification; + ["MSG","Message sent successfully",3] call cTab_fnc_addNotification; playSound "cTab_mailSent"; // remove message body _msgBodyctrl ctrlSetText ""; @@ -1132,7 +1132,7 @@ cTab_msg_Send = { _nop = [] call cTab_msg_gui_load; // add a notification - ["MSG",format ["New message from %1",name _sender]] call cTab_fnc_addNotification; + ["MSG",format ["New message from %1",name _sender],6] call cTab_fnc_addNotification; } else { cTabRscLayerMailNotification cutRsc ["cTab_Mail_ico_disp", "PLAIN"]; //show }; diff --git a/README.md b/README.md index 3beb0d8..e264779 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,9 @@ this setVariable ["cTab_groupId","Fox",true]; Changelog --------- ### 2.2.1 ### +* Added variable message decay to notification system (new-marker notifications are now shown for longer) * Fixed error regarding the helmet cam icon when looking at a cTab-box placed with Zeus +* Fixed issue with notification system upon marker creation * Marker menu will now stay inside the device screen boundaries * Moved marker menu above brightness layer to allow it to show tool-tips properly * Tweaked marker menu size on Android