1
0

fnc_ui_jammerSettings.sqf 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. params ["_control"];
  2. private _display = ctrlParent _control;
  3. private _ctrlButtonOK = _display displayCtrl 1;
  4. private _logic = missionNamespace getVariable ["BIS_fnc_initCuratorAttributes_target",objNull];
  5. _control ctrlRemoveAllEventHandlers "setFocus";
  6. private _fnc_sliderMove = {
  7. params ["_slider"];
  8. private _idc = ctrlIDC _slider;
  9. private _logic = missionNamespace getVariable["BIS_fnc_initCuratorAttributes_target",objNull];
  10. if (isNull _logic) exitWith {};
  11. private _jammerInit = _logic getVariable ["rd501_ui_jammerInit", [300,160]];
  12. if(_idc == 58402) then {
  13. // Radius
  14. private _curVal = _jammerInit select 0;
  15. _slider ctrlSetTooltip format ["%1%3 (default %2%3)", round(sliderPosition _slider), round(_curVal), " metres"];
  16. };
  17. if(_idc == 58403) then {
  18. // Strength
  19. private _curVal = _jammerInit select 1;
  20. _slider ctrlSetTooltip format ["%1%3 (default %2%3)", round(sliderPosition _slider), round(_curVal), " MW"];
  21. };
  22. };
  23. private _logic = missionNamespace getVariable["BIS_fnc_initCuratorAttributes_target",objNull];
  24. private _jammerInit = _logic getVariable ["rd501_ui_jammerInit", [300,160]];
  25. {
  26. private _slider = _display displayCtrl _x;
  27. _slider sliderSetRange [0, 2000];
  28. _slider sliderSetSpeed [1,10];
  29. _slider sliderSetPosition (_jammerInit select _forEachIndex);
  30. _slider ctrlAddEventHandler ["SliderPosChanged", _fnc_sliderMove];
  31. _slider call _fnc_sliderMove;
  32. } forEach [58402, 58403];
  33. private _fnc_onUnload = {
  34. private _logic = missionNamespace getVariable ["BIS_fnc_initCuratorAttributes_target",objNull];
  35. if (isNull _logic) exitWith { };
  36. deleteVehicle _logic;
  37. };
  38. private _fnc_onConfirm = {
  39. params [["_ctrlButtonOK", controlNull, [controlNull]]];
  40. private _display = ctrlparent _ctrlButtonOK;
  41. if (isNull _display) exitWith { };
  42. private _logic = missionNamespace getVariable["BIS_fnc_initCuratorAttributes_target",objNull];
  43. if (isNull _logic) exitWith { };
  44. private _jammerInit = _logic setVariable ["rd501_ui_jammerInit", [sliderPosition (_display displayCtrl 58402), sliderPosition (_display displayCtrl 58403)]];
  45. [_logic] call rd501_zeus_fnc_moduleJammerSettings;
  46. };
  47. _display displayAddEventHandler ["unload", _fnc_onUnload];
  48. _ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm];