DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ OnKeyPress()

void PluginBase::OnKeyPress ( int key)
inlineprivate

См. определение в файле PluginKeyBinding.c строка 126

127 {
128 //Print("OnKeyPress "+ key );
129
130 for ( int i = 0; i < m_KeyBindings.Count(); ++i )
131 {
132 KeyBinding key_binding = m_KeyBindings.Get(i);
133
134 if ( !IsCurrentUIPageValid( key_binding.GetUIMenuID() ) )
135 {
136 continue;
137 }
138
139 bool key1_match = false;
140 bool key2_match = false;
141
142 if ( key_binding.GetKey1() > -1 )
143 {
144 if ( IsKeyPressed(key_binding.GetKey1()) )
145 {
146 // Key1 is down
147 key1_match = true;
148 }
149 }
150 else
151 {
152 // Key1 is not set
153 key1_match = true;
154 }
155
156 if ( key_binding.GetKey2() > -1 )
157 {
158 if ( IsKeyPressed(key_binding.GetKey2()) )
159 {
160 // Key2 is down
161 key2_match = true;
162 }
163 }
164 else
165 {
166 // Key2 is not set
167 key2_match = true;
168 }
169
170 if ( key1_match && key2_match )
171 {
172 //Log( "Call Method -> key press: " + itoa(key) + " " + key_binding.GetInfoDescription() );
173
174 PluginBase m = GetPlugin(key_binding.GetCallbackTarget().ToType());
175 GetGame().GameScript.CallFunction(m, key_binding.GetCallbackFunction(), NULL, 0);
176
177 break;
178 }
179 }
180 }
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
ScriptModule GameScript
Определения Game.c:12
string GetCallbackFunction()
Определения KeyBinding.c:42
int GetKey1()
Определения KeyBinding.c:27
int GetKey2()
Определения KeyBinding.c:32
int GetUIMenuID()
Определения KeyBinding.c:22
string GetCallbackTarget()
Определения KeyBinding.c:37
void PluginBase()
ref array< ref KeyBinding > m_KeyBindings
Определения PluginKeyBinding.c:281
bool IsCurrentUIPageValid(int ui_page_request)
Определения PluginKeyBinding.c:304
bool IsKeyPressed(int key)
Определения PluginKeyBinding.c:374
proto native CGame GetGame()
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...

Перекрестные ссылки ScriptModule::CallFunction(), CGame::GameScript, KeyBinding::GetCallbackFunction(), KeyBinding::GetCallbackTarget(), GetGame(), KeyBinding::GetKey1(), KeyBinding::GetKey2(), GetPlugin(), KeyBinding::GetUIMenuID(), IsCurrentUIPageValid(), IsKeyPressed(), m_KeyBindings, PluginBase() и string::ToType().