2016-05-18 15:16:35 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
|
|
|
* Initalises the `global skill` zeus module display
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: globalSetSkill controls group <CONTROL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* onSetFocus = "_this call ace_zeus_fnc_ui_globalSetSkill"
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2016-02-26 06:57:18 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
disableSerialization;
|
|
|
|
|
|
|
|
params ["_control"];
|
|
|
|
TRACE_1("params",_control);
|
|
|
|
|
|
|
|
//Generic Init:
|
|
|
|
private _display = ctrlparent _control;
|
|
|
|
private _ctrlButtonOK = _display displayctrl 1; //IDC_OK
|
2016-05-15 17:08:54 +00:00
|
|
|
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull);
|
2016-02-26 06:57:18 +00:00
|
|
|
TRACE_1("logicObject",_logic);
|
|
|
|
|
|
|
|
_control ctrlRemoveAllEventHandlers "setFocus";
|
|
|
|
|
2016-05-16 13:55:19 +00:00
|
|
|
//Specific on-load stuff:
|
|
|
|
private _fnc_sliderMove = {
|
2016-02-26 06:57:18 +00:00
|
|
|
params ["_slider"];
|
2016-05-16 13:55:19 +00:00
|
|
|
private _idc = ctrlIDC _slider; // IDCs ∈ [16184,16187]
|
|
|
|
private _curVal = GVAR(GlobalSkillAI) select (_idc - 16184); // [0,3]
|
2016-05-15 17:08:54 +00:00
|
|
|
_slider ctrlSetTooltip format ["%1%3 (was %2%3)", round(sliderPosition _slider * 100), round(_curVal * 100), "%"];
|
2016-02-26 06:57:18 +00:00
|
|
|
};
|
|
|
|
|
2016-05-16 13:55:19 +00:00
|
|
|
{
|
|
|
|
private _slider = _display displayCtrl _x;
|
|
|
|
_slider sliderSetRange [0, 1];
|
|
|
|
_slider sliderSetSpeed [0.01,0.1];
|
|
|
|
_slider sliderSetPosition (GVAR(GlobalSkillAI) select _forEachIndex);
|
|
|
|
_slider ctrlAddEventHandler ["SliderPosChanged", _fnc_sliderMove];
|
|
|
|
_slider call _fnc_sliderMove;
|
|
|
|
} forEach [16184,16185,16186,16187];
|
2016-02-26 06:57:18 +00:00
|
|
|
|
2016-05-16 13:55:19 +00:00
|
|
|
(_display displayCtrl 16188) cbSetChecked (GVAR(GlobalSkillAI) select 4);
|
|
|
|
(_display displayCtrl 16189) cbSetChecked (GVAR(GlobalSkillAI) select 5);
|
2016-02-26 06:57:18 +00:00
|
|
|
|
2016-05-18 15:30:14 +00:00
|
|
|
private _fnc_onUnload = {
|
|
|
|
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull);
|
|
|
|
if (isNull _logic) exitWith {};
|
|
|
|
|
|
|
|
deleteVehicle _logic;
|
|
|
|
};
|
|
|
|
|
2016-02-26 06:57:18 +00:00
|
|
|
private _fnc_onConfirm = {
|
|
|
|
params [["_ctrlButtonOK", controlNull, [controlNull]]];
|
|
|
|
TRACE_1("_fnc_onConfirm params",_this);
|
2016-05-16 13:55:19 +00:00
|
|
|
|
2016-02-26 06:57:18 +00:00
|
|
|
private _display = ctrlparent _ctrlButtonOK;
|
|
|
|
if (isNull _display) exitWith {};
|
|
|
|
|
2016-05-16 13:55:19 +00:00
|
|
|
GVAR(GlobalSkillAI) = [
|
|
|
|
sliderPosition (_display displayCtrl 16184), // General
|
|
|
|
sliderPosition (_display displayCtrl 16185), // Accuracy
|
|
|
|
sliderPosition (_display displayCtrl 16186), // Handling
|
|
|
|
sliderPosition (_display displayCtrl 16187), // Spotting
|
|
|
|
cbChecked (_display displayCtrl 16188), // Seek cover
|
|
|
|
cbChecked (_display displayCtrl 16189) // Autocombat
|
|
|
|
];
|
|
|
|
publicVariable QGVAR(GlobalSkillAI); // Values should persist for future use
|
|
|
|
|
|
|
|
// PV EH won't run on local machine
|
|
|
|
[QGVAR(GlobalSkillAI),GVAR(GlobalSkillAI)] call FUNC(moduleGlobalSetSkill);
|
2016-02-26 06:57:18 +00:00
|
|
|
};
|
|
|
|
|
2016-05-18 15:30:14 +00:00
|
|
|
_display displayAddEventHandler ["unload", _fnc_onUnload];
|
|
|
|
_ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm];
|