diff --git a/addons/ui/README.md b/addons/ui/README.md index 6c22fc24..531e467f 100644 --- a/addons/ui/README.md +++ b/addons/ui/README.md @@ -8,3 +8,4 @@ https://github.com/gruppe-adler/grad_connectButtonPort #### Maintainer(s) * McDiod +* DerZade diff --git a/addons/ui/cfgFunctions.hpp b/addons/ui/cfgFunctions.hpp index c463fb80..669ad77f 100644 --- a/addons/ui/cfgFunctions.hpp +++ b/addons/ui/cfgFunctions.hpp @@ -1,10 +1,12 @@ class CfgFunctions { - class grad_ui { + class ADDON { class directConnect { - file = "x\grad\addons\ui\functions\directConnect"; + file = QPATHTOF(functions\directConnect); class connectToServer {}; + class onButtonConnect_rightClick {}; class onButtonConnect {}; class onButtonPasswordOK {}; + class onButtonPortOK {}; class onLoadButtonConnect {}; class onLoadRscDisplayDirectConnectPassword {}; }; diff --git a/addons/ui/config.cpp b/addons/ui/config.cpp index 207abcfe..db14431c 100644 --- a/addons/ui/config.cpp +++ b/addons/ui/config.cpp @@ -11,7 +11,8 @@ class CfgPatches { weapons[] = {}; VERSION_CONFIG; authors[] = { - "McDiod" + "McDiod", + "DerZade" }; }; }; diff --git a/addons/ui/dialog/directConnect.hpp b/addons/ui/dialog/directConnect.hpp index 60095f92..60e8d0d4 100644 --- a/addons/ui/dialog/directConnect.hpp +++ b/addons/ui/dialog/directConnect.hpp @@ -12,16 +12,16 @@ class RscPictureKeepAspectAllowPixelSplit; class RscDisplayMain { class Controls { - class grad_directConnectLogo: RscPictureKeepAspectAllowPixelSplit { - text = "\x\grad\addons\ui\dialog\logo_128.paa"; + class GVAR(directConnectLogo): RscPictureKeepAspectAllowPixelSplit { + text = QPATHTOF(dialog\logo_128.paa); - x = GRAD_DIRECTCONNECT_LOGOX; + x = DIRECTCONNECT_LOGOX; y = "safezoneY + 2.15 * (pixelH * pixelGrid * 2)"; w = "2.00 * (pixelH * pixelGrid * 2)"; h = "1.70 * (pixelH * pixelGrid * 2)"; }; - class grad_directConnectButton: RscButtonMenu { + class GVAR(directConnectButton): RscButtonMenu { idc = 62300; colorBackground[]={0,0,0,0}; colorBackground2[]={1,1,1,1}; @@ -29,14 +29,15 @@ class RscDisplayMain { size="1.25 * (pixelH * pixelGrid * 2)"; text = "ERROR SETTING TEXT"; - onLoad = "_this call compile preprocessFileLineNumbers '\x\grad\addons\ui\functions\directConnect\fn_onLoadButtonConnect.sqf'"; + onLoad = QUOTE(_this call (uiNamespace getVariable QQFUNC(onLoadButtonConnect))); - x = GRAD_DIRECTCONNECT_X; + x = DIRECTCONNECT_X; y = "safezoneY + 2 * (pixelH * pixelGrid * 2)"; w = "9 * (pixelW * pixelGrid * 2)"; h = "2 * (pixelH * pixelGrid * 2)"; - action = "call compile preprocessFileLineNumbers '\x\grad\addons\ui\functions\directConnect\fn_onButtonConnect.sqf'"; + action = QUOTE(call (uiNamespace getVariable QQFUNC(onButtonConnect))); + onMouseButtonClick = QUOTE(_this call (uiNamespace getVariable QQFUNC(onButtonConnect_rightClick))); class Attributes { align="center"; @@ -56,11 +57,11 @@ class RscDisplayMain { }; }; -class grad_RscDisplayDirectConnectPassword { +class GVAR(RscDisplayDirectConnectPassword) { idd = -1; movingEnable=0; enableDisplay=1; - onLoad = "_this call (uiNamespace getVariable 'grad_ui_fnc_onLoadRscDisplayDirectConnectPassword')"; + onLoad = QUOTE(_this call (uiNamespace getVariable QQFUNC(onLoadRscDisplayDirectConnectPassword))); class ControlsBackground { class Vignette: RscVignette { @@ -93,19 +94,19 @@ class grad_RscDisplayDirectConnectPassword { "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])" }; idc=1080; - x = GRAD_DIRECTCONNECT_TOTALX; - y = GRAD_DIRECTCONNECT_TOTALY; - w = GRAD_DIRECTCONNECT_TOTALW; - h = GRAD_DIRECTCONNECT_ELEMENTH; + x = DIRECTCONNECT_TOTALX; + y = DIRECTCONNECT_TOTALY; + w = DIRECTCONNECT_TOTALW; + h = DIRECTCONNECT_ELEMENTH; }; class MainBackground: RscText { colorBackground[]={0,0,0,0.69999999}; idc=1082; - x= GRAD_DIRECTCONNECT_TOTALX; - y = GRAD_DIRECTCONNECT_MAINY; - w = GRAD_DIRECTCONNECT_TOTALW; - h = GRAD_DIRECTCONNECT_MAINH; + x= DIRECTCONNECT_TOTALX; + y = DIRECTCONNECT_MAINY; + w = DIRECTCONNECT_TOTALW; + h = DIRECTCONNECT_MAINH; }; }; @@ -114,61 +115,179 @@ class grad_RscDisplayDirectConnectPassword { colorBackground[] = {0,0,0,0}; style = 0; idc = 1000; - text="$STR_GRAD_UI_DIRECTCONNECTPASSWORDWINDOWTITLE"; + text= CSTRING(DIRECTCONNECTPASSWORDWINDOWTITLE); - x = GRAD_DIRECTCONNECT_TOTALX; - y = GRAD_DIRECTCONNECT_TOTALY; - w = GRAD_DIRECTCONNECT_TOTALW; - h = GRAD_DIRECTCONNECT_ELEMENTH; + x = DIRECTCONNECT_TOTALX; + y = DIRECTCONNECT_TOTALY; + w = DIRECTCONNECT_TOTALW; + h = DIRECTCONNECT_ELEMENTH; }; class Text: RscText { - idc = GRAD_DIRECTCONNECT_IDC_PASSWORDTEXT; + idc = DIRECTCONNECT_IDC_PASSWORDTEXT; text = ""; - x = GRAD_DIRECTCONNECT_CONTENTX; - y = GRAD_DIRECTCONNECT_MAINY + GRAD_DIRECTCONNECT_PADDINGY; - w = GRAD_DIRECTCONNECT_CONTENTW; - h = GRAD_DIRECTCONNECT_TEXTBOXH; + x = DIRECTCONNECT_CONTENTX; + y = DIRECTCONNECT_MAINY + DIRECTCONNECT_PADDINGY; + w = DIRECTCONNECT_CONTENTW; + h = DIRECTCONNECT_TEXTBOXH; colorBackground[]={0,0,0,0}; }; class PasswordText: RscText { idc = -1; text = "PASSWORD"; - x = GRAD_DIRECTCONNECT_CONTENTX; - y = GRAD_DIRECTCONNECT_MAINY + GRAD_DIRECTCONNECT_PADDINGY + GRAD_DIRECTCONNECT_TEXTBOXH + GRAD_DIRECTCONNECT_PADDINGY; - w = GRAD_DIRECTCONNECT_XSCALE * 5; - h = GRAD_DIRECTCONNECT_ELEMENTH; + x = DIRECTCONNECT_CONTENTX; + y = DIRECTCONNECT_MAINY + DIRECTCONNECT_PADDINGY + DIRECTCONNECT_TEXTBOXH + DIRECTCONNECT_PADDINGY; + w = DIRECTCONNECT_XSCALE * 5; + h = DIRECTCONNECT_ELEMENTH; colorBackground[] = {0,0,0,0}; }; class PasswordBox: RscEdit { - idc = GRAD_DIRECTCONNECT_IDC_PASSWORD; + idc = DIRECTCONNECT_IDC_PASSWORD; - x = GRAD_DIRECTCONNECT_CONTENTX + GRAD_DIRECTCONNECT_XSCALE * 5.5; - y = GRAD_DIRECTCONNECT_MAINY + GRAD_DIRECTCONNECT_PADDINGY + GRAD_DIRECTCONNECT_TEXTBOXH + GRAD_DIRECTCONNECT_PADDINGY; - w = GRAD_DIRECTCONNECT_CONTENTW - GRAD_DIRECTCONNECT_XSCALE * 5.5; - h = GRAD_DIRECTCONNECT_ELEMENTH; + x = DIRECTCONNECT_CONTENTX + DIRECTCONNECT_XSCALE * 5.5; + y = DIRECTCONNECT_MAINY + DIRECTCONNECT_PADDINGY + DIRECTCONNECT_TEXTBOXH + DIRECTCONNECT_PADDINGY; + w = DIRECTCONNECT_CONTENTW - DIRECTCONNECT_XSCALE * 5.5; + h = DIRECTCONNECT_ELEMENTH; }; class ButtonCancel: RscButtonMenuCancel { - x = GRAD_DIRECTCONNECT_TOTALX; - y = GRAD_DIRECTCONNECT_BUTTONY; - w = GRAD_DIRECTCONNECT_BUTTONW; - h = GRAD_DIRECTCONNECT_ELEMENTH; + x = DIRECTCONNECT_TOTALX; + y = DIRECTCONNECT_BUTTONY; + w = DIRECTCONNECT_BUTTONW; + h = DIRECTCONNECT_ELEMENTH; }; class ButtonOK: RscButtonMenu { - x = GRAD_DIRECTCONNECT_BUTTONOKX; - y = GRAD_DIRECTCONNECT_BUTTONY; - w = GRAD_DIRECTCONNECT_BUTTONW; - h = GRAD_DIRECTCONNECT_ELEMENTH; + x = DIRECTCONNECT_BUTTONOKX; + y = DIRECTCONNECT_BUTTONY; + w = DIRECTCONNECT_BUTTONW; + h = DIRECTCONNECT_ELEMENTH; text = "OK"; style = 16; shortcuts[] = {28,156}; - onButtonClick = "_this call (uiNamespace getVariable 'grad_ui_fnc_onButtonPasswordOK')"; + onButtonClick = QUOTE(_this call (uiNamespace getVariable QQFUNC(onButtonPasswordOK))); + }; + }; +}; + + +class GVAR(RscDisplayDirectConnectPort) { + idd = -1; + movingEnable=0; + enableDisplay=1; + //onLoad = QUOTE(_this call (uiNamespace getVariable QQFUNC(onLoadRscDisplayDirectConnectPassword))); + + class ControlsBackground { + class Vignette: RscVignette { + idc=114998; + }; + + class TileGroup: RscControlsGroupNoScrollbars { + idc=115099; + x="safezoneXAbs"; + y="safezoneY"; + w="safezoneWAbs"; + h="safezoneH"; + + class Controls { + class Background: RscText { + idc=114999; + x=0; + y=0; + w="safezoneWAbs"; + h="safezoneH"; + colorBackground[]={0,0,0,0.5}; + }; + }; + }; + class RscTitleBackground: RscText { + colorBackground[]= { + "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])", + "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])", + "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])", + "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])" + }; + idc=1080; + x = DIRECTCONNECT_TOTALX; + y = DIRECTCONNECT_TOTALY; + w = DIRECTCONNECT_TOTALW; + h = DIRECTCONNECT_ELEMENTH; + }; + class MainBackground: RscText + { + colorBackground[]={0,0,0,0.69999999}; + idc=1082; + x= DIRECTCONNECT_TOTALX; + y = DIRECTCONNECT_MAINY; + w = DIRECTCONNECT_TOTALW; + h = DIRECTCONNECT_MAINH; + }; + }; + + class Controls { + class Title: RscTitle { + colorBackground[] = {0,0,0,0}; + style = 0; + idc = 1000; + text= CSTRING(DIRECTCONNECTPASSWORDWINDOWTITLE); + + x = DIRECTCONNECT_TOTALX; + y = DIRECTCONNECT_TOTALY; + w = DIRECTCONNECT_TOTALW; + h = DIRECTCONNECT_ELEMENTH; + }; + + class Text: RscText { + idc = DIRECTCONNECT_IDC_PASSWORDTEXT; + text = CSTRING(DIRECTCONNECTPORTTEXT); + x = DIRECTCONNECT_CONTENTX; + y = DIRECTCONNECT_MAINY + DIRECTCONNECT_PADDINGY; + w = DIRECTCONNECT_CONTENTW; + h = DIRECTCONNECT_TEXTBOXH; + colorBackground[]={0,0,0,0}; + }; + + class PortText: RscText { + idc = -1; + text = "PORT"; + x = DIRECTCONNECT_CONTENTX; + y = DIRECTCONNECT_MAINY + DIRECTCONNECT_PADDINGY + DIRECTCONNECT_TEXTBOXH + DIRECTCONNECT_PADDINGY; + w = DIRECTCONNECT_XSCALE * 5; + h = DIRECTCONNECT_ELEMENTH; + colorBackground[] = {0,0,0,0}; + }; + + class PortBox: RscEdit { + idc = DIRECTCONNECT_IDC_PASSWORD; + text="2302"; + x = DIRECTCONNECT_CONTENTX + DIRECTCONNECT_XSCALE * 5.5; + y = DIRECTCONNECT_MAINY + DIRECTCONNECT_PADDINGY + DIRECTCONNECT_TEXTBOXH + DIRECTCONNECT_PADDINGY; + w = DIRECTCONNECT_CONTENTW - DIRECTCONNECT_XSCALE * 5.5; + h = DIRECTCONNECT_ELEMENTH; + }; + + class ButtonCancel: RscButtonMenuCancel { + x = DIRECTCONNECT_TOTALX; + y = DIRECTCONNECT_BUTTONY; + w = DIRECTCONNECT_BUTTONW; + h = DIRECTCONNECT_ELEMENTH; + }; + + class ButtonOK: RscButtonMenu { + x = DIRECTCONNECT_BUTTONOKX; + y = DIRECTCONNECT_BUTTONY; + w = DIRECTCONNECT_BUTTONW; + h = DIRECTCONNECT_ELEMENTH; + + text = "OK"; + style = 16; + shortcuts[] = {28,156}; + + onButtonClick = QUOTE(_this call (uiNamespace getVariable QQFUNC(onButtonPortOK))); }; }; }; diff --git a/addons/ui/dialog/directConnectDefines.hpp b/addons/ui/dialog/directConnectDefines.hpp index 4ba34ff7..ef40bbb8 100644 --- a/addons/ui/dialog/directConnectDefines.hpp +++ b/addons/ui/dialog/directConnectDefines.hpp @@ -1,32 +1,32 @@ -#define GRAD_DIRECTCONNECT_IDC_PASSWORDTEXT 1008 -#define GRAD_DIRECTCONNECT_IDC_PASSWORD 1009 +#define DIRECTCONNECT_IDC_PASSWORDTEXT 1008 +#define DIRECTCONNECT_IDC_PASSWORD 1009 // ============================================================================= #define CENTER(PARENT_SIZE, CHILD_SIZE) ((PARENT_SIZE / 2) - (CHILD_SIZE / 2)) -#define GRAD_DIRECTCONNECT_XSCALE (((safezoneW / safezoneH) min 1.2) / 40) -#define GRAD_DIRECTCONNECT_YSCALE ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) +#define DIRECTCONNECT_XSCALE (((safezoneW / safezoneH) min 1.2) / 40) +#define DIRECTCONNECT_YSCALE ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) -#define GRAD_DIRECTCONNECT_TOTALW (30 * GRAD_DIRECTCONNECT_XSCALE) -#define GRAD_DIRECTCONNECT_TOTALH (10 * GRAD_DIRECTCONNECT_YSCALE) -#define GRAD_DIRECTCONNECT_SPACERY (0.12 * GRAD_DIRECTCONNECT_YSCALE) -#define GRAD_DIRECTCONNECT_ELEMENTH (1 * GRAD_DIRECTCONNECT_YSCALE) -#define GRAD_DIRECTCONNECT_PADDINGY (1 * GRAD_DIRECTCONNECT_YSCALE) -#define GRAD_DIRECTCONNECT_PADDINGX (1 * GRAD_DIRECTCONNECT_XSCALE) -#define GRAD_DIRECTCONNECT_TEXTBOXH (2* GRAD_DIRECTCONNECT_XSCALE) -#define GRAD_DIRECTCONNECT_BUTTONW (6.25 * GRAD_DIRECTCONNECT_XSCALE) +#define DIRECTCONNECT_TOTALW (30 * DIRECTCONNECT_XSCALE) +#define DIRECTCONNECT_TOTALH (10 * DIRECTCONNECT_YSCALE) +#define DIRECTCONNECT_SPACERY (0.12 * DIRECTCONNECT_YSCALE) +#define DIRECTCONNECT_ELEMENTH (1 * DIRECTCONNECT_YSCALE) +#define DIRECTCONNECT_PADDINGY (1 * DIRECTCONNECT_YSCALE) +#define DIRECTCONNECT_PADDINGX (1 * DIRECTCONNECT_XSCALE) +#define DIRECTCONNECT_TEXTBOXH (2* DIRECTCONNECT_XSCALE) +#define DIRECTCONNECT_BUTTONW (6.25 * DIRECTCONNECT_XSCALE) -#define GRAD_DIRECTCONNECT_MAINH (GRAD_DIRECTCONNECT_TOTALH - 2*GRAD_DIRECTCONNECT_ELEMENTH - 2*GRAD_DIRECTCONNECT_SPACERY) +#define DIRECTCONNECT_MAINH (DIRECTCONNECT_TOTALH - 2*DIRECTCONNECT_ELEMENTH - 2*DIRECTCONNECT_SPACERY) -#define GRAD_DIRECTCONNECT_TOTALX (CENTER(1,GRAD_DIRECTCONNECT_TOTALW)) -#define GRAD_DIRECTCONNECT_TOTALY (CENTER(1,GRAD_DIRECTCONNECT_TOTALH)) -#define GRAD_DIRECTCONNECT_MAINY (GRAD_DIRECTCONNECT_TOTALY + GRAD_DIRECTCONNECT_ELEMENTH + GRAD_DIRECTCONNECT_SPACERY) +#define DIRECTCONNECT_TOTALX (CENTER(1,DIRECTCONNECT_TOTALW)) +#define DIRECTCONNECT_TOTALY (CENTER(1,DIRECTCONNECT_TOTALH)) +#define DIRECTCONNECT_MAINY (DIRECTCONNECT_TOTALY + DIRECTCONNECT_ELEMENTH + DIRECTCONNECT_SPACERY) -#define GRAD_DIRECTCONNECT_CONTENTW (GRAD_DIRECTCONNECT_TOTALW - 2*GRAD_DIRECTCONNECT_PADDINGX) -#define GRAD_DIRECTCONNECT_CONTENTX (GRAD_DIRECTCONNECT_TOTALX + GRAD_DIRECTCONNECT_PADDINGX) -#define GRAD_DIRECTCONNECT_BUTTONOKX (GRAD_DIRECTCONNECT_TOTALX + GRAD_DIRECTCONNECT_TOTALW - GRAD_DIRECTCONNECT_BUTTONW) -#define GRAD_DIRECTCONNECT_BUTTONY (GRAD_DIRECTCONNECT_MAINY + GRAD_DIRECTCONNECT_MAINH + GRAD_DIRECTCONNECT_SPACERY) +#define DIRECTCONNECT_CONTENTW (DIRECTCONNECT_TOTALW - 2*DIRECTCONNECT_PADDINGX) +#define DIRECTCONNECT_CONTENTX (DIRECTCONNECT_TOTALX + DIRECTCONNECT_PADDINGX) +#define DIRECTCONNECT_BUTTONOKX (DIRECTCONNECT_TOTALX + DIRECTCONNECT_TOTALW - DIRECTCONNECT_BUTTONW) +#define DIRECTCONNECT_BUTTONY (DIRECTCONNECT_MAINY + DIRECTCONNECT_MAINH + DIRECTCONNECT_SPACERY) -#define GRAD_DIRECTCONNECT_X (safeZoneX + 2 * GRAD_DIRECTCONNECT_XSCALE) -#define GRAD_DIRECTCONNECT_LOGOX (GRAD_DIRECTCONNECT_X - (1.8 * (pixelH * pixelGrid * 2))) +#define DIRECTCONNECT_X (safeZoneX + 2 * DIRECTCONNECT_XSCALE) +#define DIRECTCONNECT_LOGOX (DIRECTCONNECT_X - (1.8 * (pixelH * pixelGrid * 2))) diff --git a/addons/ui/functions/directConnect/fn_connectToServer.sqf b/addons/ui/functions/directConnect/fn_connectToServer.sqf index 7830c93c..bfa0f62a 100644 --- a/addons/ui/functions/directConnect/fn_connectToServer.sqf +++ b/addons/ui/functions/directConnect/fn_connectToServer.sqf @@ -1,18 +1,20 @@ #include "script_component.hpp" #include "\A3\Ui_f\hpp\defineResincl.inc" -#define GRAD_UI_DIRECTCONNECTTIMEOUT 5 +#define UI_DIRECTCONNECTTIMEOUT 5 -params [["_password",""]]; +params [["_password",""],["_port",2302]]; -grad_ui_directConnectPassword = _password; -profileNamespace setVariable ["grad_ui_directConnectPassword",_password]; +GVAR(directConnectPassword) = _password; +profileNamespace setVariable [QGVAR(directConnectPassword),_password]; saveProfileNamespace; -grad_ui_directConnectPort = [configFile >> "GRAD_CfgConnectButton","port",2302] call (uiNamespace getVariable "BIS_fnc_returnConfigEntry"); +INFO_1("Attempting direct connect to port %1", _port); + +GVAR(directConnectPort) = _port; onEachFrame { - grad_ui_directConnectStartTime = diag_tickTime; + GVAR(directConnectStartTime) = diag_tickTime; _displayMain = findDisplay IDD_MAIN; _ctrlServerBrowser = _displayMain displayCtrl IDC_MAIN_MULTIPLAYER; @@ -24,7 +26,9 @@ onEachFrame { onEachFrame { _ctrlServerAddress = findDisplay IDD_IP_ADDRESS displayCtrl 2300; _ctrlServerAddress controlsGroupCtrl IDC_IP_ADDRESS ctrlSetText "arma.gruppe-adler.de"; - _ctrlServerAddress controlsGroupCtrl IDC_IP_PORT ctrlSetText str grad_ui_directConnectPort; + + _ctrlServerAddress controlsGroupCtrl IDC_IP_PORT ctrlSetText str GVAR(directConnectPort); + ctrlActivate (_ctrlServerAddress controlsGroupCtrl IDC_OK); onEachFrame { @@ -33,23 +37,23 @@ onEachFrame { ([_ctrlServerList lbText 0,_ctrlServerList lbData 0]) call { params [["_serverName",""],["_serverData",""]]; - if (diag_tickTime > (grad_ui_directConnectStartTime + GRAD_UI_DIRECTCONNECTTIMEOUT)) then { - ERROR("direct connect timed out"); - profileNamespace setVariable ["grad_ui_directConnectLastConnectSuccessful",true]; + if (diag_tickTime > (GVAR(directConnectStartTime) + UI_DIRECTCONNECTTIMEOUT)) then { + ERROR_1("direct connect on port %1 timed out", GVAR(directConnectPort)); + profileNamespace setVariable [QGVAR(directConnectLastConnectSuccessful),true]; saveProfileNamespace; onEachFrame {}; }; - if (_serverData isEqualTo format ["138.201.30.246:%1",grad_ui_directConnectPort]) then { + if (_serverData isEqualTo format ["138.201.30.253:%1",GVAR(directConnectPort)]) then { findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_SESSIONS lbSetCurSel 0; onEachFrame { ctrlActivate (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_JOIN); onEachFrame { - if (diag_tickTime > grad_ui_directConnectStartTime + GRAD_UI_DIRECTCONNECTTIMEOUT) then { - ERROR("direct connect timed out"); - profileNamespace setVariable ["grad_ui_directConnectLastConnectSuccessful",false]; + if (diag_tickTime > GVAR(directConnectStartTime) + UI_DIRECTCONNECTTIMEOUT) then { + ERROR_1("direct connect on port %1 timed out", GVAR(directConnectPort)); + profileNamespace setVariable [QGVAR(directConnectLastConnectSuccessful),false]; saveProfileNamespace; onEachFrame {}; }; @@ -57,13 +61,13 @@ onEachFrame { if (!isNull findDisplay IDD_PASSWORD) then { private _ctrlPassword = findDisplay IDD_PASSWORD displayCtrl IDC_PASSWORD; _ctrlPassword ctrlSetTextColor [0,0,0,0]; - _ctrlPassword ctrlSetText grad_ui_directConnectPassword; + _ctrlPassword ctrlSetText GVAR(directConnectPassword); ctrlActivate (findDisplay IDD_PASSWORD displayCtrl IDC_OK); }; if (getClientStateNumber >= 3) then { - INFO("direct connect successful"); - profileNamespace setVariable ["grad_ui_directConnectLastConnectSuccessful",true]; + INFO_1("direct connect on port %1 successful", GVAR(directConnectPort)); + profileNamespace setVariable [QGVAR(directConnectLastConnectSuccessful),true]; saveProfileNamespace; onEachFrame {}; diff --git a/addons/ui/functions/directConnect/fn_onButtonConnect.sqf b/addons/ui/functions/directConnect/fn_onButtonConnect.sqf index 5f8d5bbc..86eb354b 100644 --- a/addons/ui/functions/directConnect/fn_onButtonConnect.sqf +++ b/addons/ui/functions/directConnect/fn_onButtonConnect.sqf @@ -1,11 +1,14 @@ #include "script_component.hpp" #include "\A3\Ui_f\hpp\defineResincl.inc" -private _password = profileNamespace getVariable ["grad_ui_directConnectPassword",""]; -private _lastConnectSuccessful = profileNamespace getVariable ["grad_ui_directConnectLastConnectSuccessful",false]; +params [["_port", [configFile >> QGVARMAIN(CfgConnectButton),"port",2302] call (uiNamespace getVariable "BIS_fnc_returnConfigEntry")]]; + +private _password = profileNamespace getVariable [QGVAR(directConnectPassword),""]; +private _lastConnectSuccessful = profileNamespace getVariable [QGVAR(directConnectLastConnectSuccessful),false]; if (_password == "" || !_lastConnectSuccessful) exitWith { - (findDisplay IDD_MAIN) createDisplay "grad_RscDisplayDirectConnectPassword"; + (findDisplay IDD_MAIN) createDisplay QGVAR(RscDisplayDirectConnectPassword); + uiNamespace setVariable [QGVAR(selectedPort),_port]; }; -[_password] call compile preprocessFileLineNumbers '\x\grad\addons\ui\functions\directConnect\fn_connectToServer.sqf'; +[_password,_port] call (uiNamespace getVariable QFUNC(connectToServer)); diff --git a/addons/ui/functions/directConnect/fn_onButtonConnect_rightClick.sqf b/addons/ui/functions/directConnect/fn_onButtonConnect_rightClick.sqf new file mode 100644 index 00000000..eaa8b5de --- /dev/null +++ b/addons/ui/functions/directConnect/fn_onButtonConnect_rightClick.sqf @@ -0,0 +1,9 @@ +#include "script_component.hpp" +#include "\A3\Ui_f\hpp\defineResincl.inc" + +params ["_control", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"]; + +//check wether button was RMB +if !(_button isEqualTo 1) exitWith {}; + +(findDisplay IDD_MAIN) createDisplay QGVAR(RscDisplayDirectConnectPort); \ No newline at end of file diff --git a/addons/ui/functions/directConnect/fn_onButtonPasswordOK.sqf b/addons/ui/functions/directConnect/fn_onButtonPasswordOK.sqf index d7c3ceba..178ffe43 100644 --- a/addons/ui/functions/directConnect/fn_onButtonPasswordOK.sqf +++ b/addons/ui/functions/directConnect/fn_onButtonPasswordOK.sqf @@ -1,11 +1,12 @@ #include "script_component.hpp" -#include "\x\grad\addons\ui\dialog\directConnectDefines.hpp" +#include "..\..\dialog\directConnectDefines.hpp" params [["_buttonCtrl",controlNull]]; private _display = ctrlParent _buttonCtrl; -private _password = ctrlText (_display displayCtrl GRAD_DIRECTCONNECT_IDC_PASSWORD); +private _password = ctrlText (_display displayCtrl DIRECTCONNECT_IDC_PASSWORD); +private _port = uiNamespace getVariable [QGVAR(selectedPort),2302]; _display closeDisplay 1; -[_password] call (uiNamespace getVariable "grad_ui_fnc_connectToServer"); +[_password,_port] call (uiNamespace getVariable QFUNC(connectToServer)); diff --git a/addons/ui/functions/directConnect/fn_onButtonPortOK.sqf b/addons/ui/functions/directConnect/fn_onButtonPortOK.sqf new file mode 100644 index 00000000..c5544f76 --- /dev/null +++ b/addons/ui/functions/directConnect/fn_onButtonPortOK.sqf @@ -0,0 +1,15 @@ +#include "script_component.hpp" +#include "..\..\dialog\directConnectDefines.hpp" + +params [["_buttonCtrl",controlNull]]; + +private _display = ctrlParent _buttonCtrl; +private _port = ctrlText (_display displayCtrl DIRECTCONNECT_IDC_PASSWORD); + +_display closeDisplay 1; + +// game will crash if port dialog is still open when next dialog is created +[parseNumber _port] spawn { + uiSleep 0.5; + _this call (uiNamespace getVariable QFUNC(onButtonConnect)); +}; diff --git a/addons/ui/functions/directConnect/fn_onLoadButtonConnect.sqf b/addons/ui/functions/directConnect/fn_onLoadButtonConnect.sqf index 823a8b0c..14c842dd 100644 --- a/addons/ui/functions/directConnect/fn_onLoadButtonConnect.sqf +++ b/addons/ui/functions/directConnect/fn_onLoadButtonConnect.sqf @@ -2,5 +2,5 @@ params [["_ctrl",controlNull]]; -private _port = [configFile >> "GRAD_CfgConnectButton","port",2302] call (uiNamespace getVariable "BIS_fnc_returnConfigEntry"); -_ctrl ctrlSetText format [localize LSTRING(DIRECTCONNECTBUTTON),_port]; +private _port = [configFile >> QGVARMAIN(CfgConnectButton),"port",2302] call (uiNamespace getVariable "BIS_fnc_returnConfigEntry"); +_ctrl ctrlSetText format [LLSTRING(DIRECTCONNECTBUTTON),_port]; diff --git a/addons/ui/functions/directConnect/fn_onLoadRscDisplayDirectConnectPassword.sqf b/addons/ui/functions/directConnect/fn_onLoadRscDisplayDirectConnectPassword.sqf index bb9be81f..294939dd 100644 --- a/addons/ui/functions/directConnect/fn_onLoadRscDisplayDirectConnectPassword.sqf +++ b/addons/ui/functions/directConnect/fn_onLoadRscDisplayDirectConnectPassword.sqf @@ -1,17 +1,17 @@ #include "script_component.hpp" -#include "\x\grad\addons\ui\dialog\directConnectDefines.hpp" +#include "..\..\dialog\directConnectDefines.hpp" params [["_display",displayNull]]; -private _passwordCtrl = _display displayCtrl GRAD_DIRECTCONNECT_IDC_PASSWORD; -private _textCtrl = _display displayCtrl GRAD_DIRECTCONNECT_IDC_PASSWORDTEXT; +private _passwordCtrl = _display displayCtrl DIRECTCONNECT_IDC_PASSWORD; +private _textCtrl = _display displayCtrl DIRECTCONNECT_IDC_PASSWORDTEXT; -private _password = profileNamespace getVariable ["grad_ui_directConnectPassword",""]; -private _lastConnectSuccessful = profileNamespace getVariable ["grad_ui_directConnectLastConnectSuccessful",false]; +private _password = profileNamespace getVariable [QGVAR(directConnectPassword),""]; +private _lastConnectSuccessful = profileNamespace getVariable [QGVAR(directConnectLastConnectSuccessful),false]; if (_password != "") then { _passwordCtrl ctrlSetText _password; - _textCtrl ctrlSetText (localize "STR_GRAD_UI_DIRECTCONNECTPASSWORDTEXTFAIL"); + _textCtrl ctrlSetText LLSTRING(DIRECTCONNECTPASSWORDTEXTFAIL); } else { - _textCtrl ctrlSetText (localize "STR_GRAD_UI_DIRECTCONNECTPASSWORDTEXTFIRST"); + _textCtrl ctrlSetText LLSTRING(DIRECTCONNECTPASSWORDTEXTFIRST); }; diff --git a/addons/ui/stringtable.xml b/addons/ui/stringtable.xml index 31d46913..8e2d2beb 100644 --- a/addons/ui/stringtable.xml +++ b/addons/ui/stringtable.xml @@ -18,6 +18,10 @@ Looks like your last connection attempt didn't work. Please check your password. Es sieht aus als sei dein letzter Versuch fehlgeschlagen. Bitte überprüfe das Passwort. + + Enter the port of the server you want to connect to! + Gib den Port ein auf welchen du verbinden willst! + diff --git a/tools/armake b/tools/armake index 1ae27b8b..d9233cbf 100755 Binary files a/tools/armake and b/tools/armake differ