Skip to content

Commit

Permalink
Add fall back functions for user input menus
Browse files Browse the repository at this point in the history
If for some reason the client isn't using the User Input Menus mod, all functions will revert to BIS_fnc_guiMessage and either replicate the effect of the original function or show a warning with a download link to the mod.
  • Loading branch information
ConnorAU committed Mar 27, 2019
1 parent 4a8dffa commit 7646a94
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
10 changes: 10 additions & 0 deletions mission/functions/defines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
#define DLOG(input) [QUOTE(THIS_FUNC),input] call GG_system_fnc_log
#endif

#ifdef COLOR_ACTIVE_RGBA
#define FNC_LINKTEXT \
{\
params ["_text","_url"];\
private _colorRGBA = [COLOR_ACTIVE_RGBA] call BIS_fnc_colorConfigToRGBA;\
private _colorHex = _colorRGBA call BIS_fnc_colorRGBtoHTML;\
format["<a colorLink='%1' href='%2'>%3</t>",_colorHex,_url,_text]\
}
#endif

// ~ UI Positioning
#ifdef pixelScale
// Mission UIs were built using small UI scale.
Expand Down
23 changes: 21 additions & 2 deletions mission/functions/ui/fn_adminMenu.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define THIS_FUNC GG_ui_fnc_adminMenu
#define DISPLAY_NAME GG_displayAdminMenu

#include "..\macros.inc"
#include "..\defines.inc"

#define VAL_CUSTOM_POS_MARKER "GG_CombatZoneCustom"
Expand Down Expand Up @@ -132,6 +133,7 @@ switch _mode do {
];
};

// https://github.com/ConnorAU/A3UserInputMenus
[
_options,
"Select a Value",
Expand All @@ -141,7 +143,18 @@ switch _mode do {
};
},
"Select",""
] call CAU_UserInputMenus_fnc_listBox;
] call (missionNameSpace getVariable ["CAU_UserInputMenus_fnc_listBox",{
private _linkText = FNC_LINKTEXT;

[
parseText format[
"You cannot set new parameter values without the %1 mod.",
["User Input Menus","https://steamcommunity.com/sharedfiles/filedetails/?id=1673595418"] call _linkText
],
"Missing Mod",
"Ok"
] spawn BIS_fnc_guiMessage;
}]);
};
case "ParamsValueChanged":{
_params params ["_paramData","_paramValue"];
Expand Down Expand Up @@ -365,13 +378,19 @@ switch _mode do {

_display closeDisplay 2;

// https://github.com/ConnorAU/A3UserInputMenus
[
"Would you like to reset the round and apply these changes immediately?",
"Changes saved",
{["confirm",_confirmed] call THIS_FUNC},
"Reset Now",
"Reset Later"
] call CAU_UserInputMenus_fnc_guiMessage;
] call (missionNameSpace getVariable ["CAU_UserInputMenus_fnc_guiMessage",{
_this spawn {
private _confirmed = [_this#0,_this#1,_this#3,_this#4] call BIS_fnc_guiMessage;
call (_this#2);
};
}]);
} else {
if _params then {
private _scores = [] call GG_system_fnc_getLeaderboardStats;
Expand Down
16 changes: 9 additions & 7 deletions mission/functions/ui/fn_welcome.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
#include "..\macros.inc"
#include "..\defines.inc"

private _linkText = {
params ["_text","_url"];
private _colorRGBA = [COLOR_ACTIVE_RGBA] call BIS_fnc_colorConfigToRGBA;
private _colorHex = _colorRGBA call BIS_fnc_colorRGBtoHTML;
format["<a colorLink='%1' href='%2'>%3</t>",_colorHex,_url,_text]
};
private _linkText = FNC_LINKTEXT;

private _text = [
"<t size='1.4' align='center'>Gun Game by ConnorAU</t>",
Expand Down Expand Up @@ -63,5 +58,12 @@ _text append [
format["If you have any questions about this mission, you can contact me on %1.",["discord","https://discord.gg/DMkxetD"] call _linkText]
];

[_text joinString "<br/>","Welcome",{},"Continue"] call CAU_UserInputMenus_fnc_guiMessage;
// https://github.com/ConnorAU/A3UserInputMenus
[_text joinString "<br/>","Welcome",{},"Continue"] call (missionNameSpace getVariable ["CAU_UserInputMenus_fnc_guiMessage",{
uiNamespace setVariable ["CAU_UserInputMenus_displayGuiMessage",findDisplay 46];
[_this#0,_this#1,_this#3] spawn {
_this call BIS_fnc_guiMessage;
uiNamespace setVariable ["CAU_UserInputMenus_displayGuiMessage",displayNull];
};
}]);
waitUntil {isNull(uiNamespace getVariable ["CAU_UserInputMenus_displayGuiMessage",displayNull])};

0 comments on commit 7646a94

Please sign in to comment.