Skip to content
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.

Commit

Permalink
Fixed a lot of bugs, improved performance, new algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Relentless authored and Relentless committed Sep 19, 2017
1 parent df4c030 commit d724d34
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 182 deletions.
6 changes: 3 additions & 3 deletions rlnt/dialogs/RLNT_updatepanel.hpp
Expand Up @@ -80,7 +80,7 @@ class rlnt_updatepanel_style_2 {
onLoad = "uiNamespace setVariable ['rlnt_updatepanel_style_2', _this select 0];";

class Controls {
class rlnt_text_header: RscText
class rlnt_text_header: RLNT_RscText
{
idc = 1028;
text = "";
Expand All @@ -90,7 +90,7 @@ class rlnt_updatepanel_style_2 {
h = 0.0329878 * safezoneH;
sizeEx = 0.02076 * SafezoneH;
};
class rlnt_text_line_1: RscText
class rlnt_text_line_1: RLNT_RscText
{
idc = 1029;
text = "";
Expand All @@ -100,7 +100,7 @@ class rlnt_updatepanel_style_2 {
h = 0.0175934 * safezoneH;
sizeEx = 0.0173 * SafezoneH;
};
class rlnt_text_line_2: RscText
class rlnt_text_line_2: RLNT_RscText
{
idc = 1030;
text = "";
Expand Down
186 changes: 19 additions & 167 deletions rlnt/functions/RLNT_up_main.sqf
Expand Up @@ -4,7 +4,7 @@ Author: Relentless
Description: Base function for RLNT-CustomUpdatePanel
Call: [Side,Style,Header,Line1,Line2,Img,Duration,FontColor,BgColor] spawn RLNT_updatePanel;
*/
private ["_input","_upSide","_upStyle","_upHeader","_upLine1","_upLine2","_upImg","_upDuration","_upFontColor","_upBgColor"];
private ["_input","_varArray"];
disableSerialization;


Expand All @@ -14,188 +14,40 @@ if (rlnt_debug) then {
};


/* Count the input for optional arguments */
_input = count _this;
/* Variables */
_input = (count _this) - 1;
_varArray = rlnt_up_defaults;


/* Variables, fill with config if optional */
switch (_input) do {

case 0: {
_upSide = rlnt_up_Side;
_upStyle = rlnt_up_Style;
_upHeader = rlnt_up_Header;
_upLine1 = rlnt_up_Line1;
_upLine2 = rlnt_up_Line2;
_upImg = rlnt_up_Img;
_upDuration = rlnt_up_Duration;
_upFontColor = rlnt_up_FontColor;
_upBgColor = rlnt_up_BgColor;
};

case 1: {
_upSide = _this select 0;
_upStyle = rlnt_up_Style;
_upHeader = rlnt_up_Header;
_upLine1 = rlnt_up_Line1;
_upLine2 = rlnt_up_Line2;
_upImg = rlnt_up_Img;
_upDuration = rlnt_up_Duration;
_upFontColor = rlnt_up_FontColor;
_upBgColor = rlnt_up_BgColor;
};

case 2: {
_upSide = _this select 0;
_upStyle = _this select 1;
_upHeader = rlnt_up_Header;
_upLine1 = rlnt_up_Line1;
_upLine2 = rlnt_up_Line2;
_upImg = rlnt_up_Img;
_upDuration = rlnt_up_Duration;
_upFontColor = rlnt_up_FontColor;
_upBgColor = rlnt_up_BgColor;
};

case 3: {
_upSide = _this select 0;
_upStyle = _this select 1;
_upHeader = _this select 2;
_upLine1 = rlnt_up_Line1;
_upLine2 = rlnt_up_Line2;
_upImg = rlnt_up_Img;
_upDuration = rlnt_up_Duration;
_upFontColor = rlnt_up_FontColor;
_upBgColor = rlnt_up_BgColor;
};

case 4: {
_upSide = _this select 0;
_upStyle = _this select 1;
_upHeader = _this select 2;
_upLine1 = _this select 3;
_upLine2 = rlnt_up_Line2;
_upImg = rlnt_up_Img;
_upDuration = rlnt_up_Duration;
_upFontColor = rlnt_up_FontColor;
_upBgColor = rlnt_up_BgColor;
};

case 5: {
_upSide = _this select 0;
_upStyle = _this select 1;
_upHeader = _this select 2;
_upLine1 = _this select 3;
_upLine2 = _this select 4;
_upImg = rlnt_up_Img;
_upDuration = rlnt_up_Duration;
_upFontColor = rlnt_up_FontColor;
_upBgColor = rlnt_up_BgColor;
};

case 6: {
_upSide = _this select 0;
_upStyle = _this select 1;
_upHeader = _this select 2;
_upLine1 = _this select 3;
_upLine2 = _this select 4;
_upImg = _this select 5;
_upDuration = rlnt_up_Duration;
_upFontColor = rlnt_up_FontColor;
_upBgColor = rlnt_up_BgColor;
};

case 7: {
_upSide = _this select 0;
_upStyle = _this select 1;
_upHeader = _this select 2;
_upLine1 = _this select 3;
_upLine2 = _this select 4;
_upImg = _this select 5;
_upDuration = _this select 6;
_upFontColor = rlnt_up_FontColor;
_upBgColor = rlnt_up_BgColor;
/* Define arguments for setup */
for "_i" from 0 to _input do {
if (isNil (_this select _i)) then {
if (rlnt_up_debug) then {
diag_log format ["[RLNT][UP] The variable '_this select %1' wasn't overwritten.", str(_i)];
};
} else {
_varArray set [_i, (_this select _i)];
if (rlnt_up_debug) then {
diag_log format ["[RLNT][UP] The variable '_this select %1' was overwritten with ''%2'.", str(_i), _varArray select _i];
};
};

case 8: {
_upSide = _this select 0;
_upStyle = _this select 1;
_upHeader = _this select 2;
_upLine1 = _this select 3;
_upLine2 = _this select 4;
_upImg = _this select 5;
_upDuration = _this select 6;
_upFontColor = _this select 7;
_upBgColor = rlnt_up_BgColor;
};

case 9: {
_upSide = _this select 0;
_upStyle = _this select 1;
_upHeader = _this select 2;
_upLine1 = _this select 3;
_upLine2 = _this select 4;
_upImg = _this select 5;
_upDuration = _this select 6;
_upFontColor = _this select 7;
_upBgColor = _this select 8;
};

};


/* Use config if not defined */
if (isNil "_upSide") then {
_upSide = rlnt_up_Side;
};

if (isNil "_upStyle") then {
_upStyle = rlnt_up_Style;
};

if (isNil "_upHeader") then {
_upHeader = rlnt_up_Header;
};

if (isNil "_upLine1") then {
_upLine1 = rlnt_up_Line1;
};

if (isNil "_upLine2") then {
_upLine2 = rlnt_up_Line2;
};

if (isNil "_upImg") then {
_upImg = rlnt_up_Img;
};

if (isNil "_upDuration") then {
_upDuration = rlnt_up_Duration;
};

if (isNil "_upFontColor") then {
_upFontColor = rlnt_up_FontColor;
};

if (isNil "_upBgColor") then {
_upBgColor = rlnt_up_BgColor;
};


/* Check the receiver */
if (_upSide == "local") then {
if ((_varArray select 1) == "local") then {
if (rlnt_up_debug) then {
diag_log "[RLNT][UP] The RLNT_up_main.sqf decided a local receiver!";
};

[_upStyle,_upHeader,_upLine1,_upLine2,_upImg,_upDuration,_upFontColor,_upBgColor] spawn RLNT_up_setup;
_varArray spawn RLNT_up_setup;
};

if (_upSide == "global") then {
if ((_varArray select 1) == "global") then {
if (rlnt_up_debug) then {
diag_log "[RLNT][UP] The RLNT_up_main.sqf decided a global receiver!";
};

RLNT_up_global = [_upStyle,_upHeader,_upLine1,_upLine2,_upImg,_upDuration,_upFontColor,_upBgColor];
RLNT_up_global = _varArray;
publicVariableServer "RLNT_up_global";
};
20 changes: 10 additions & 10 deletions rlnt/functions/RLNT_up_setup.sqf
Expand Up @@ -2,7 +2,7 @@
Filename: RLNT_up_setup.sqf
Author: Relentless
Description: Creation function for RLNT-CustomUpdatePanel
Call: [_upStyle,_upHeader,_upLine1,_upLine2,_upImg,_upDuration,_upFontColor,_upBgColor] spawn RLNT_up_setup;
Call: _varArray spawn RLNT_up_setup;
*/
private ["_upStyle","_upHeader","_upLine1","_upLine2","_upImg","_upDuration","_upFontColor","_upBgColor","_layer","_display","_cHeader","_cLine1","_cLine2","_cImg","_cFontColor","_cBgColor"];
disableSerialization;
Expand All @@ -15,14 +15,14 @@ if (rlnt_debug) then {


/* Variables */
_upStyle = _this select 0;
_upHeader = _this select 1;
_upLine1 = _this select 2;
_upLine2 = _this select 3;
_upImg = _this select 4;
_upDuration = _this select 5;
_upFontColor = _this select 6;
_upBgColor = _this select 7;
_upStyle = _this select 1;
_upHeader = _this select 2;
_upLine1 = _this select 3;
_upLine2 = _this select 4;
_upImg = _this select 5;
_upDuration = _this select 6;
_upFontColor = _this select 7;
_upBgColor = _this select 8;
_layer = 1302;


Expand Down Expand Up @@ -59,7 +59,7 @@ switch (_upStyle) do {

//Left upper corner without image (PLAIN)
case 2: {
_layer cutRsc ["rlnt_updatepnael_style_2","PLAIN",1];
_layer cutRsc ["rlnt_updatepanel_style_2","PLAIN",1];
sleep 0.01;

if (rlnt_up_debug) then {
Expand Down
2 changes: 1 addition & 1 deletion rlnt/scripts/Update Panel/RLNT_up_config.sqf
Expand Up @@ -76,7 +76,7 @@ rlnt_up_Style = 1; /* default: 1 */
//// Default string that defines the text that's used ////
//// as the header of the Update Panel. ////
//// THE OPTION HAS TO BE A STRING! ////
//// MAXIMUM CHAR AMOUNT IS 13! ////
//// MAXIMUM CHAR AMOUNT IS 16! ////
////////////////////////////////////////////////////////////
rlnt_up_Header = "RLNT Panel:";

Expand Down
9 changes: 8 additions & 1 deletion rlnt/scripts/Update Panel/RLNT_up_init.sqf
Expand Up @@ -11,5 +11,12 @@ if (rlnt_debug) then {
};



execVM "rlnt\scripts\Update Panel\RLNT_up_config.sqf";
sleep 0.2;
rlnt_up_defaults = [rlnt_up_Side,rlnt_up_Style,rlnt_up_Header,rlnt_up_Line1,rlnt_up_Line2,rlnt_up_Img,rlnt_up_Duration,rlnt_up_FontColor,rlnt_up_BgColor];


/* UP RLNT Debug */
if (rlnt_up_debug) then {
diag_log format ["[RLNT][UP] The default variable array is %1.", rlnt_up_defaults];
};

0 comments on commit d724d34

Please sign in to comment.