mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
98 lines
3.7 KiB
Plaintext
98 lines
3.7 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: PabstMirror
|
|
* Changes the display mode of the MicroDAGR.
|
|
*
|
|
* Arguments:
|
|
* 0: Display Mode to show the microDAGR in <NUMBER> (default: -1)
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [1] call ace_microdagr_fnc_openDisplay
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params [["_newDisplayShowMode", -1, [-1]]];
|
|
private _oldShowMode = GVAR(currentShowMode);
|
|
|
|
if (_newDisplayShowMode == -1) then {
|
|
//Toggle mode button:
|
|
if (_oldShowMode in [DISPLAY_MODE_DISPLAY, DISPLAY_MODE_HIDDEN]) then {_newDisplayShowMode = DISPLAY_MODE_DIALOG};
|
|
if (_oldShowMode in [DISPLAY_MODE_DIALOG, DISPLAY_MODE_CLOSED]) then {_newDisplayShowMode = DISPLAY_MODE_DISPLAY};
|
|
};
|
|
|
|
if ((_newDisplayShowMode == DISPLAY_MODE_DISPLAY) && {!([DISPLAY_MODE_DISPLAY] call FUNC(canShow))}) then {_newDisplayShowMode = DISPLAY_MODE_HIDDEN};
|
|
if ((_newDisplayShowMode == DISPLAY_MODE_DIALOG) && {!([DISPLAY_MODE_DIALOG] call FUNC(canShow))}) then {_newDisplayShowMode = DISPLAY_MODE_HIDDEN};
|
|
|
|
|
|
//On first-startup
|
|
if (GVAR(currentApplicationPage) == APP_MODE_NULL) then {
|
|
GVAR(currentApplicationPage) = APP_MODE_INFODISPLAY;
|
|
GVAR(mapPosition) = getPos ACE_player;
|
|
};
|
|
|
|
if (_newDisplayShowMode in [DISPLAY_MODE_CLOSED, DISPLAY_MODE_HIDDEN]) then {
|
|
|
|
//If Dialog is open, back it up before closing:
|
|
if (dialog && {!isNull (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull])}) then {
|
|
[-1] call FUNC(saveCurrentAndSetNewMode);
|
|
closeDialog 0;
|
|
};
|
|
|
|
//Close the display:
|
|
(QGVAR(TheRscTitleDisplay) call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
|
} else {
|
|
if (_newDisplayShowMode == DISPLAY_MODE_DISPLAY) then {
|
|
//If Dialog is open, back it up before closing:
|
|
if (dialog && {!isNull (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull])}) then {
|
|
[-1] call FUNC(saveCurrentAndSetNewMode);
|
|
closeDialog 0;
|
|
};
|
|
//Open the display:
|
|
(QGVAR(TheRscTitleDisplay) call BIS_fnc_rscLayer) cutRsc [QGVAR(TheRscTitleDisplay), "PLAIN", 0, true];
|
|
} else { //DISPLAY_MODE_DIALOG
|
|
//Close the display:
|
|
(QGVAR(TheRscTitleDisplay) call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
|
//Open the dialog:
|
|
createDialog QGVAR(TheDialog);
|
|
};
|
|
};
|
|
|
|
GVAR(currentShowMode) = _newDisplayShowMode;
|
|
//Update display applicaiton if open:
|
|
if (GVAR(currentShowMode) in [DISPLAY_MODE_DIALOG, DISPLAY_MODE_DISPLAY]) then {
|
|
[] call FUNC(showApplicationPage);
|
|
};
|
|
|
|
if ((_oldShowMode == DISPLAY_MODE_CLOSED) && {GVAR(currentShowMode) != DISPLAY_MODE_CLOSED}) then {
|
|
//Start a pfeh to update display and handle hiding display
|
|
|
|
[{
|
|
params ["_args", "_idPFH"];
|
|
_args params ["_player"];
|
|
if ((isNull ACE_player) || {!alive ACE_player} || {ACE_player != _player} || {!("ACE_microDAGR" in (ACE_player call EFUNC(common,uniqueItems)))} || {GVAR(currentShowMode) == DISPLAY_MODE_CLOSED}) then {
|
|
//Close Display if still open:
|
|
if (GVAR(currentShowMode) != DISPLAY_MODE_CLOSED) then {
|
|
[DISPLAY_MODE_CLOSED] call FUNC(openDisplay);
|
|
};
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
} else {
|
|
if (GVAR(currentShowMode) == DISPLAY_MODE_HIDDEN) then {
|
|
//If display is hidden, and we can show, then swithc modes:
|
|
if ([DISPLAY_MODE_DISPLAY] call FUNC(canShow)) then {
|
|
[DISPLAY_MODE_DISPLAY] call FUNC(openDisplay);
|
|
};
|
|
} else {
|
|
if ([GVAR(currentShowMode)] call FUNC(canShow)) then {
|
|
[] call FUNC(updateDisplay);
|
|
} else {
|
|
[DISPLAY_MODE_HIDDEN] call FUNC(openDisplay);
|
|
};
|
|
};
|
|
};
|
|
}, 0.1, [ACE_player]] call CBA_fnc_addPerFrameHandler;
|
|
};
|