Advertisement
Guest User

ui_selectSlot.sqf

a guest
Apr 7th, 2015
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. private ["_control","_button","_parent","_group","_pos","_item","_conf","_name","_cfgActions","_numActions","_height","_menu","_config","_type","_script","_outputOriented","_compile","_array","_outputClass","_outputType"];
  2. disableSerialization;
  3. _control = _this select 0;
  4. _button = _this select 1;
  5. _parent = findDisplay 106;
  6.  
  7. //if ((time - dayzClickTime) < 1) exitWith {};
  8. if (!DZE_SelfTransfuse && ((gearSlotData _control) == "ItemBloodBag")) exitWith {};
  9. if (_button == 1) then {
  10. //dayzClickTime = time;
  11. _group = _parent displayCtrl 6902;
  12.  
  13. _pos = ctrlPosition _group;
  14. _pos set [0,((_this select 2) + 0.48)];
  15. _pos set [1,((_this select 3) + 0.07)];
  16.  
  17. _item = gearSlotData _control;
  18.  
  19. _conf = configFile >> "cfgMagazines" >> _item;
  20. if (!isClass _conf) then {
  21. _conf = configFile >> "cfgWeapons" >> _item;
  22. };
  23. _name = getText(_conf >> "displayName");
  24.  
  25. _cfgActions = _conf >> "ItemActions";
  26. _numActions = (count _cfgActions);
  27. _height = 0;
  28.  
  29. //Populate Menu
  30. for "_i" from 0 to (_numActions - 1) do
  31. {
  32. _menu = _parent displayCtrl (1600 + _i);
  33. _menu ctrlShow true;
  34. _config = (_cfgActions select _i);
  35. _type = getText (_config >> "text");
  36. _script = getText (_config >> "script");
  37. _outputOriented = getNumber (_config >> "outputOriented") == 1;
  38. _height = _height + (0.025 * safezoneH);
  39. _compile = format["_id = '%2' %1;",_script,_item];
  40. uiNamespace setVariable ['uiControl', _control];
  41. if (_outputOriented) then {
  42. /*
  43. This flag means that the action is output oriented
  44. the output class will then be transferred to the script
  45. && the type used for the name
  46. */
  47. _array = getArray (_config >> "output");
  48. _outputClass = _array select 0;
  49. _outputType = _array select 1;
  50. _name = getText (configFile >> _outputType >> _outputClass >> "displayName");
  51. _compile = format["_id = ['%2',%3] %1;",_script,_item,_array];
  52. };
  53.  
  54. _menu ctrlSetText format[_type,_name];
  55. _menu ctrlSetEventHandler ["ButtonClick",_compile];
  56. };
  57.  
  58. //### BEGIN MODIFIED CODE: extra click actions
  59. {
  60. private["_classname","_text","_execute","_condition"];
  61. _classname = _x select 0;
  62. _text = _x select 1;
  63. _execute = _x select 2;
  64. _condition = _x select 3;
  65. // if the clicked item matches, then assign the script call and display text
  66. if(_item == _classname && (call compile _condition)) then {
  67. _menu = _parent displayCtrl (1600 + _numActions);
  68. _menu ctrlShow true;
  69. _height = _height + (0.025 * safezoneH);
  70. uiNamespace setVariable ['uiControl', _control];
  71. _menu ctrlSetText _text;
  72. _menu ctrlSetEventHandler ["ButtonClick",_execute];
  73. _numActions = _numActions + 1;
  74. };
  75. } forEach DZE_CLICK_ACTIONS;
  76. //### END MODIFIED CODE: extra click actions
  77.  
  78. _pos set [3,_height];
  79. //hint format["Obj: %1 \nHeight: %2\nPos: %3",_item,_height,_grpPos];
  80.  
  81. _group ctrlShow true;
  82. ctrlSetFocus _group;
  83. _group ctrlSetPosition _pos;
  84. _group ctrlCommit 0;
  85. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement