10 m_iActionT = pActionType;
25 protected int m_iAction;
26 protected int m_iActionT;
56 TextListboxWidget m_Selector;
57 ButtonWidget m_ButtonStart;
62 ButtonWidget m_SetInitStateB;
63 ButtonWidget m_WeaponChange;
64 ButtonWidget m_WeaponHide;
71 int m_CH_WeapAction = -1;
72 int m_CH_WeapActionType = -1;
73 int m_CH_LastWeapAction = -1;
74 int m_CH_LastWeapActionType = -1;
75 float m_CH_WeapActionProgressStart = 0;
76 float m_CH_WeapActionProgressEnd = 1;
78 string m_CH_WeaponChangeI;
79 int m_CH_WeaponChangeSlotH = -1;
80 int m_CH_WeaponChangeSlotS = -1;
164 int FindAbilityConfig(
int pAction,
int pActionT)
166 int l = m_AbilityConfig.Count();
167 for (
int i = 0; i < l; i++)
185 CreateModuleWidgets();
192 hcw.DebugResetEvents();
199 DestroyModuleWidgets();
203 void CreateModuleWidgets()
205 m_Selector = TextListboxWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapActionSelector") );
206 m_ButtonStart = ButtonWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapActionStart") );
212 m_SetInitStateB = ButtonWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapInitStateB") );
214 m_WeaponChange = ButtonWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapChange") );
215 m_WeaponHide = ButtonWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapHide") );
222 m_WidgetActionEvents.SetText(
"Events:");
226 void DestroyModuleWidgets()
246 EntityAI entityInHands = player.GetHumanInventory().GetEntityInHands();
248 if (
Class.CastTo(w, entityInHands))
250 if (m_CurrentWeapon != w)
255 m_Selector.ClearItems();
262 string text =
"Action: " + hcw.GetRunningAction().ToString() +
" " + hcw.GetRunningActionType().ToString();
263 m_WidgetActionRunning.SetText(text);
266 int aEvent = hcw.DebugIsEvent();
269 string eventStr =
"Event: ";
270 eventStr = eventStr + aEvent.ToString() +
" ";
273 aEvent = hcw.DebugIsEvent();
279 Print(
"Event: " + aEvent.ToString());
281 eventStr += aEvent.ToString();
285 m_WidgetActionEvents.SetText(eventStr);
297 m_Selector.ClearItems();
300 int abilityCount = w.GetAbilityCount();
302 for (
int i = 0; i < abilityCount; ++i)
305 int abConfigIndex = FindAbilityConfig(rec.m_action, rec.m_actionType);
306 if (abConfigIndex != -1)
312 m_Selector.AddItem(
"=========== All - not safe =========", NULL, 0);
317 int l = m_AbilityConfig.Count();
318 for (
int a = 0; a < l; a++)
329 void WeaponsStartAction()
331 int row = m_Selector.GetSelectedRow();
338 m_Selector.GetItemData(row, 0, userData);
341 m_CH_WeapAction = userData.GetAction();
342 m_CH_WeapActionType = userData.GetActionType();
343 m_CH_WeapActionProgressStart = m_WeaponActionProgressStart.GetText().ToFloat();
344 m_CH_WeapActionProgressEnd = m_WeaponActionProgressEnd.GetText().ToFloat();
346 Print(
"DayzPlayerImplement_Weapons::WeaponsStartAction");
355 bool OnClick(
Widget w,
int x,
int y,
int button)
357 if (w == m_ButtonStart)
359 WeaponsStartAction();
362 else if (w == m_SetInitStateB)
364 int frameI = m_SetInitStateI.GetText().ToInt();
369 hcw.SetInitState(frameI);
371 else if (w == m_WeaponChange)
373 Print(
"Weapon Change pressed");
378 Print(
"No dispatcher - cannot get selected weapon");
385 Print(
"No selected object");
389 Param1<string> p1 = Param1<string>.Cast(p);
392 m_CH_WeaponChangeI = p1.param1;
393 m_CH_WeaponChangeSlotH = m_WeaponSlotH.GetText().ToInt();
394 m_CH_WeaponChangeSlotS = m_WeaponSlotS.GetText().ToInt();
396 else if (w == m_WeaponHide)
398 m_CH_WeaponChangeI =
"";
399 m_CH_WeaponChangeSlotH = m_WeaponSlotH.GetText().ToInt();
400 m_CH_WeaponChangeSlotS = m_WeaponSlotS.GetText().ToInt();
410 bool IsWeaponChange(out
string pNewWeapon, out
int pHideSlot, out
int pShowSlot)
412 if (m_CH_WeaponChangeSlotH == -1)
417 pNewWeapon = m_CH_WeaponChangeI;
418 pHideSlot = m_CH_WeaponChangeSlotH;
419 pShowSlot = m_CH_WeaponChangeSlotS;
421 m_CH_WeaponChangeSlotH = -1;
422 m_CH_WeaponChangeSlotS = -1;
431 void CommandHandler()
438 m_CH_WeapAction = m_CH_LastWeapAction;
439 m_CH_WeapActionType = m_CH_LastWeapActionType;
441 Print(
"DayzPlayerImplement_Weapons OnKC_MULTIPLY");
445 if (m_CH_WeapAction >= 0)
447 m_CH_LastWeapAction = m_CH_WeapAction;
448 m_CH_LastWeapActionType = m_CH_WeapActionType;
455 hcw.SetActionProgressParams(m_CH_WeapActionProgressStart, m_CH_WeapActionProgressEnd);
456 hcw.StartAction(m_CH_WeapAction, m_CH_WeapActionType);
458 Print(
"DayzPlayerImplement_Weapons::WeaponsStartAction2");
462 m_CH_WeapAction = -1;