Advertisement
Guest User

Untitled

a guest
Aug 13th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. params[
  2. "_text",
  3. ["_error",false,[false]],
  4. ["_speed","",[""]]
  5. ];
  6.  
  7. if (!hasInterface) exitWith {};
  8.  
  9. disableSerialization;
  10. _display = finddisplay 46;
  11.  
  12. playSound "notificationRecieved";
  13.  
  14. private _headerColor = if (_error) then {
  15. [0.75,0,0,1];
  16. } else {
  17. [0,0.5,0.82,1];
  18. };
  19.  
  20. if (_text isEqualType "") then {
  21. _text = parseText _text;
  22. };
  23.  
  24. private _Header = _display ctrlCreate ["RscText", -1];
  25. _Header ctrlSetPosition [0.795 * safezoneW + safezoneX, 0.164 * safezoneH + safezoneY, 0.2 * safezoneW, 0.007 * safezoneH];
  26. _Header ctrlSetBackgroundColor _headerColor;
  27. _Header ctrlSetFade 1;
  28. _Header ctrlCommit 0;
  29. _Header ctrlSetFade 0;
  30. _Header ctrlCommit 0.4;
  31. private _TextField = _display ctrlCreate ["RscStructuredText", -1];
  32.  
  33. _TextField ctrlSetStructuredText _text;
  34. _TextField ctrlSetPosition [0.795 * safezoneW + safezoneX, 0.171 * safezoneH + safezoneY,0.2 * safezoneW, 0.5];
  35. _TextField ctrlCommit 0;
  36. _TextField ctrlSetPosition [0.795 * safezoneW + safezoneX, 0.171 * safezoneH + safezoneY,0.2 * safezoneW, ((ctrlTextHeight _TextField)+ (0.005 * safezoneH))];
  37. _TextField ctrlSetBackgroundColor [0,0,0,0.75];
  38. _TextField ctrlSetFade 1;
  39. _TextField ctrlCommit 0;
  40. _TextField ctrlSetFade 0;
  41. _TextField ctrlCommit 0.4;
  42.  
  43. [_TextField,_Header,_speed] spawn {
  44. disableSerialization;
  45. if (_this select 2 isEqualTo "fast") then {
  46. uiSleep 8;
  47. } else {
  48. uiSleep 15;
  49. };
  50.  
  51. private _TextField = _this select 0;
  52. private _Header = _this select 1;
  53. _TextField ctrlSetFade 1;
  54. _TextField ctrlCommit 0.3;
  55. _Header ctrlSetFade 1;
  56. _Header ctrlCommit 0.3;
  57. uiSleep 0.3;
  58. ctrlDelete _Header;
  59. ctrlDelete _TextField;
  60. };
  61.  
  62. private _posText = (ctrlPosition (_TextField)) select 1;
  63. private _posHeader = (ctrlPosition (_Header)) select 1;
  64. private _textHigh = (ctrlPosition (_TextField)) select 3;
  65. if(isNil{life_open_notifications}) then {life_open_notifications = [];};
  66. if (count life_open_notifications > 0) then {
  67. private _activeNotifications = 0;
  68. {
  69. private _ctrlHeader = _x select 0;
  70. private _ctrlText = _x select 1;
  71. if (!isNull _ctrlHeader && !isNull _ctrlText) then {
  72. _ctrlHeader ctrlSetPosition [0.795 * safezoneW + safezoneX, (_posHeader + _textHigh + 1.5*(0.011 * safezoneH))];
  73. _ctrlText ctrlSetPosition [0.795 * safezoneW + safezoneX, (_posText + _textHigh + 1.5*(0.011 * safezoneH))];
  74. _ctrlHeader ctrlCommit 0.25;
  75. _ctrlText ctrlCommit 0.25;
  76. _posText = (_posText + _textHigh + 1.5*(0.011 * safezoneH));
  77. _posHeader = (_posHeader + _textHigh + 1.5*(0.011 * safezoneH));
  78. _textHigh = (ctrlPosition (_ctrlText)) select 3;
  79. if (_activeNotifications > 3) then {
  80. _ctrlText ctrlSetFade 1;
  81. _ctrlHeader ctrlSetFade 1;
  82. _ctrlText ctrlCommit 0.2;
  83. _ctrlHeader ctrlCommit 0.2;
  84. };
  85. _activeNotifications = _activeNotifications + 1;
  86. };
  87. } forEach life_open_notifications;
  88. };
  89.  
  90. life_open_notifications = ([[_Header,_TextField]] + life_open_notifications) select {!isNull (_x select 0) && !isNull (_x select 1)};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement