Advertisement
Guest User

Untitled

a guest
May 15th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.96 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.  
  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. if (_item == "HandGrenade_West") then {
  30. _menu = _parent displayCtrl (1600);
  31. _menu ctrlShow true;
  32. _type = "Craft IED";
  33. _script = "Scripts\ied.sqf";
  34. _height = _height + (0.025 * safezoneH);
  35. _compile = format["_id = '%2' execVM '%1';closeDialog 0;",_script,_item];
  36. uiNamespace setVariable ['uiControl', _control];
  37. _menu ctrlSetText format[_type,_name];
  38. _menu ctrlSetTextColor [1,0.25,0.25,1];
  39. _menu ctrlSetEventHandler ["ButtonClick",_compile];
  40. };
  41. if (_item == "BAF_ied_v1") then {
  42. _menu = _parent displayCtrl (1600);
  43. _menu ctrlShow true;
  44. _type = "Craft Large IED";
  45. _script = "Scripts\ied_large.sqf";
  46. _height = _height + (0.025 * safezoneH);
  47. _compile = format["_id = '%2' execVM '%1';closeDialog 0;",_script,_item];
  48. uiNamespace setVariable ['uiControl', _control];
  49. _menu ctrlSetText format[_type,_name];
  50. _menu ctrlSetTextColor [1,0.25,0.25,1];
  51. _menu ctrlSetEventHandler ["ButtonClick",_compile];
  52. };
  53.  
  54. //Populate Menu
  55. for "_i" from 0 to (_numActions - 1) do
  56. {
  57. _menu = _parent displayCtrl (1600 + _i);
  58. _menu ctrlShow true;
  59. _config = (_cfgActions select _i);
  60. _type = getText (_config >> "text");
  61. _script = getText (_config >> "script");
  62. _outputOriented = getNumber (_config >> "outputOriented") == 1;
  63. _height = _height + (0.025 * safezoneH);
  64. _compile = format["_id = '%2' %1;",_script,_item];
  65. uiNamespace setVariable ['uiControl', _control];
  66. if (_outputOriented) then {
  67. /*
  68. This flag means that the action is output oriented
  69. the output class will then be transferred to the script
  70. and the type used for the name
  71. */
  72. _array = getArray (_config >> "output");
  73. _outputClass = _array select 0;
  74. _outputType = _array select 1;
  75. _name = getText (configFile >> _outputType >> _outputClass >> "displayName");
  76. _compile = format["_id = ['%2',%3] %1;",_script,_item,_array];
  77. };
  78.  
  79. _menu ctrlSetText format[_type,_name];
  80. _menu ctrlSetEventHandler ["ButtonClick",_compile];
  81. };
  82.  
  83. // Add extra context menus
  84. _erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
  85. _erc_numActions = (count _erc_cfgActions);
  86. if (isClass _erc_cfgActions) then {
  87. for "_j" from 0 to (_erc_numActions - 1) do {
  88. _menu = _parent displayCtrl (1600 + _j + _numActions);
  89. _menu ctrlShow true;
  90. _config = (_erc_cfgActions select _j);
  91. _text = getText (_config >> "text");
  92. _script = getText (_config >> "script");
  93. _height = _height + (0.025 * safezoneH);
  94. uiNamespace setVariable ['uiControl', _control];
  95. _menu ctrlSetText _text;
  96. _menu ctrlSetEventHandler ["ButtonClick",_script];
  97. };
  98. };
  99.  
  100. _pos set [3,_height];
  101. //hint format["Obj: %1 \nHeight: %2\nPos: %3",_item,_height,_grpPos];
  102.  
  103. _group ctrlShow true;
  104. ctrlSetFocus _group;
  105. _group ctrlSetPosition _pos;
  106. _group ctrlCommit 0;
  107. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement