fnc_ui_volatileSettings.sqf 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_volatileInit", [100]];
  12. if(_idc == 58502) then {
  13. // Health
  14. private _curVal = _jammerInit select 0;
  15. _slider ctrlSetTooltip format ["%1%3 (default %2%3)", round(sliderPosition _slider), round(_curVal), " hitpoints"];
  16. };
  17. };
  18. private _logic = missionNamespace getVariable["BIS_fnc_initCuratorAttributes_target",objNull];
  19. private _init = _logic getVariable ["rd501_ui_volatileInit", [100]];
  20. private _slider = _display displayCtrl 58502;
  21. _slider sliderSetRange [10, 1000];
  22. _slider sliderSetSpeed [1,100];
  23. _slider sliderSetPosition (_init select 0);
  24. _slider ctrlAddEventHandler ["SliderPosChanged", _fnc_sliderMove];
  25. _slider call _fnc_sliderMove;
  26. private _fnc_onUnload = {
  27. private _logic = missionNamespace getVariable ["BIS_fnc_initCuratorAttributes_target",objNull];
  28. if (isNull _logic) exitWith { };
  29. deleteVehicle _logic;
  30. };
  31. private _fnc_onConfirm = {
  32. params [["_ctrlButtonOK", controlNull, [controlNull]]];
  33. private _display = ctrlparent _ctrlButtonOK;
  34. if (isNull _display) exitWith { };
  35. private _logic = missionNamespace getVariable["BIS_fnc_initCuratorAttributes_target",objNull];
  36. if (isNull _logic) exitWith { };
  37. _logic setVariable ["rd501_ui_volatileInit", [sliderPosition (_display displayCtrl 58502)]];
  38. [_logic] call rd501_zeus_fnc_moduleVolatile;
  39. };
  40. _display displayAddEventHandler ["unload", _fnc_onUnload];
  41. _ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm];