Перейти к содержимому

DustBlue IPB Skin by CodeGame Networks

ExtraRC для всех ключей


  • Авторизуйтесь для ответа в теме
В этой теме нет ответов

#1 NoNameUltima

NoNameUltima

    Администратор

  • Администраторы
  • 191 сообщений
  • ГородСанкт-Петербург

Отправлено 28 февраля 2017 - 08:09

Как то встала задача, чтобы в ExtraRC (ПКМ опциях), были кликабельны ВСЕ ключи.
т.е. - при клике на любой ключ, появлялись пункты меню...
Сам ExtraRC в том виде, в котором он есть, данного не позволяет, а ключей несколько сотен, и добавлять каждый это гиблое дело...
Но решить проблемку можно достаточно просто, - для этого дела, нам понадобится слегка модернизировать файл
ui_selectSlot.sqf
Сам файл теперь будет выглядеть так:
private ["_control","_button","_parent","_group","_pos","_item","_subItem","_conf","_name","_cfgActions","_numActions","_height","_menu","_config","_type","_script","_outputOriented","_compile","_array","_outputClass","_outputType","_erc_cfgActions", "_erc_numActions"];
disableSerialization;
_control	=	(_this select 0);
_button		=	(_this select 1);
_parent		=	findDisplay 106;
if (_button == 1) then
	{
		_group	=	_parent displayCtrl 6902;
		_pos	=	ctrlPosition _group;
		_pos set [0, ((_this select 2) + 0.48)];
		_pos set [1, ((_this select 3) + 0.07)];
		_item	=	gearSlotData _control;
		_conf	=	configFile >> "cfgMagazines" >> _item;
		if (!isClass _conf) then
			{_conf	=	configFile >> "cfgWeapons" >> _item;};
		_name		=	getText(_conf >> "displayName");
		_cfgActions	=	_conf >> "ItemActions";
		_numActions	=	(count _cfgActions);
		_height		=	0;
		for "_i" from 0 to (_numActions - 1) do 
			{
				_menu			=	_parent displayCtrl (1600 + _i);
				_menu ctrlShow true;
				_config			=	(_cfgActions select _i);
				_type			=	getText	(_config >> "text");
				_script			=	getText	(_config >> "script");
				_outputOriented	=	getNumber	(_config >> "outputOriented") == 1;
				_height			=	_height + (0.025 * safezoneH);
				_compile		=	format["_id = '%2' %1;",_script,_item];
				uiNamespace setVariable ['uiControl', _control];
				if (_outputOriented) then
					{		
						_array			=	getArray (_config >> "output");
						_outputClass	=	(_array select 0);
						_outputType		=	(_array select 1);
						_name			=	getText (configFile >> _outputType >> _outputClass >> "displayName");
						_compile		=	 format["_id = ['%2',%3] %1;",_script,_item,_array];
					};
				_menu ctrlSetText format[_type, _name];
				_menu ctrlSetEventHandler ["Buttonclick", _compile];
			};
		//	Ключи
		_subItem	=	_item;
		_subItem	=	toArray _subItem;
		if ( (count _subItem) > 7 ) then
			{_subItem resize 7;};
		_subItem	=	toString _subItem;
		if (_subItem == "ItemKey") then
			{_erc_cfgActions	=	(missionConfigFile >> "ExtraRc" >> _subItem);}
		else
			{_erc_cfgActions	=	(missionConfigFile >> "ExtraRc" >> _item);};
		_erc_numActions	=	(count _erc_cfgActions);
		if (isClass _erc_cfgActions) then
			{
				for "_j" from 0 to (_erc_numActions - 1) do 
					{
						_menu	=	_parent displayCtrl (1600 + _j + _numActions);
						_menu ctrlShow true;
						_config	=	(_erc_cfgActions select _j);
						_text	=	getText	(_config >> "text");
						_script	=	getText	(_config >> "script");
						_height	=	_height + (0.025 * safezoneH);
						uiNamespace setVariable ['uiControl', _control];
						_menu ctrlSetText _text;
						_compile=	format["_item = '%2'; %1", _script, _item];
						_menu ctrlSetEventHandler ["Buttonclick", _compile];
					};
			};
		_pos set [3,_height];
		_group ctrlShow true;
		ctrlSetFocus _group;
		_group ctrlSetPosition _pos;
		_group ctrlCommit 0;
	};
А чтобы добавить пункты ко всем ключам, в самом ExtraRC прописываем так:
	class ItemKey
			{
				class Ultima_Client_ExtraRC_Vehicle_Find_By_Key
					{
						text = "Найти технику";
						script	=	"[] spawn Ultima_Client_Procedure_Vehicle_Find_By_Key;";
					};
				class Ultima_Client_ExtraRC_Vehicle_Set_Alarm
					{
						text = "Поставить на сигнализацию";
						script	=	"[] spawn Ultima_Client_Procedure_Vehicle_Set_Alarm;";
					};
			};
*Пункты приведены для примера.




Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных