DayZ 1.24
Loading...
Searching...
No Matches
ActionMenu Class Reference
Collaboration diagram for ActionMenu:
[legend]

Private Member Functions

void ActionMenu ()
 
void Init (Widget actions_panel_widget, TextWidget default_action_widget)
 
void UpdateWidgets ()
 
void NextAction ()
 
void PrevAction ()
 
void NextActionCategory ()
 
void PrevActionCategory ()
 
void Show ()
 
void Refresh ()
 
void Hide ()
 
void HideWithFadeout ()
 

Private Attributes

const float FADE_IN_TIME = 0.3
 
const float FADE_OUT_TIME = 0.3
 
const float HIDE_MENU_TIME = 5
 
ref WidgetFadeTimer m_FadeTimer
 
ref array< TextWidgetm_actionItems
 
TextWidget m_defaultActionWidget
 
Widget m_actionsPanelWidget
 
ref Timer m_hide_timer
 
bool m_visible
 

Detailed Description

Definition at line 1 of file ActionMenu.c.

Constructor & Destructor Documentation

◆ ActionMenu()

void ActionMenu::ActionMenu ( )
inlineprivate

Definition at line 15 of file ActionMenu.c.

16 {
18 m_FadeTimer = new WidgetFadeTimer;
20 m_visible = false;
21 }
ref Timer m_hide_timer
Definition ActionMenu.c:11
ref array< TextWidget > m_actionItems
Definition ActionMenu.c:8
bool m_visible
Definition ActionMenu.c:13
ref WidgetFadeTimer m_FadeTimer
Definition ActionMenu.c:7
const int CALL_CATEGORY_GUI
Definition tools.c:9

References CALL_CATEGORY_GUI, m_actionItems, m_FadeTimer, m_hide_timer, and m_visible.

Member Function Documentation

◆ Hide()

void ActionMenu::Hide ( )
inlineprivate

Definition at line 155 of file ActionMenu.c.

156 {
157 if (!m_visible)
158 return;
159
160 m_visible = false;
161 m_hide_timer.Stop();
162 m_FadeTimer.Stop();
163 //m_defaultActionWidget.Show(false);
164 m_actionsPanelWidget.Show(false);
165 }
Widget m_actionsPanelWidget
Definition ActionMenu.c:10

References m_actionsPanelWidget, m_FadeTimer, m_hide_timer, and m_visible.

◆ HideWithFadeout()

void ActionMenu::HideWithFadeout ( )
inlineprivate

Definition at line 167 of file ActionMenu.c.

168 {
169 //m_defaultActionWidget.Show(false);
170 if (m_actionsPanelWidget.IsVisible())
172 }
const float FADE_OUT_TIME
Definition ActionMenu.c:4

References FADE_OUT_TIME, m_actionsPanelWidget, and m_FadeTimer.

◆ Init()

void ActionMenu::Init ( Widget actions_panel_widget,
TextWidget default_action_widget )
inlineprivate

Definition at line 23 of file ActionMenu.c.

24 {
27 m_actionItems.Clear();
28 int i = 0;
29 TextWidget w = TextWidget.Cast(m_actionsPanelWidget.FindAnyWidget("ActionListItem" + i.ToString()));
30
31 while (w)
32 {
33 m_actionItems.Insert(w);
34 w.Show(false);
35 i++;
36 w = TextWidget.Cast(m_actionsPanelWidget.FindAnyWidget("ActionListItem" + i.ToString()));
37 }
38
39 m_defaultActionWidget.Show(false);
40 m_actionsPanelWidget.Show(true);
41 m_actionsPanelWidget.SetAlpha(0);
42 }
TextWidget m_defaultActionWidget
Definition ActionMenu.c:9

References m_actionItems, m_actionsPanelWidget, and m_defaultActionWidget.

◆ NextAction()

void ActionMenu::NextAction ( )
inlineprivate

Definition at line 96 of file ActionMenu.c.

97 {
99 player.GetActionManager().SelectNextAction();
100
102
103 m_hide_timer.Run(HIDE_MENU_TIME, this, "HideWithFadeout");
104 }
PlayerBase GetPlayer()
const float HIDE_MENU_TIME
Definition ActionMenu.c:5
void UpdateWidgets()
Definition ActionMenu.c:44
proto native CGame GetGame()

References GetGame(), GetPlayer(), HIDE_MENU_TIME, m_hide_timer, and UpdateWidgets().

◆ NextActionCategory()

void ActionMenu::NextActionCategory ( )
inlineprivate

Definition at line 116 of file ActionMenu.c.

117 {
119 player.GetActionManager().SelectNextActionCategory();
120
122
123 m_hide_timer.Run(HIDE_MENU_TIME, this, "HideWithFadeout");
124 }

References GetGame(), GetPlayer(), HIDE_MENU_TIME, m_hide_timer, and UpdateWidgets().

◆ PrevAction()

void ActionMenu::PrevAction ( )
inlineprivate

Definition at line 106 of file ActionMenu.c.

107 {
109 player.GetActionManager().SelectPrevAction();
110
112
113 m_hide_timer.Run(HIDE_MENU_TIME, this, "HideWithFadeout");
114 }

References GetGame(), GetPlayer(), HIDE_MENU_TIME, m_hide_timer, and UpdateWidgets().

◆ PrevActionCategory()

void ActionMenu::PrevActionCategory ( )
inlineprivate

Definition at line 126 of file ActionMenu.c.

127 {
129 player.GetActionManager().SelectPrevActionCategory();
130
132
133 m_hide_timer.Run(HIDE_MENU_TIME, this, "HideWithFadeout");
134 }

References GetGame(), GetPlayer(), HIDE_MENU_TIME, m_hide_timer, and UpdateWidgets().

◆ Refresh()

void ActionMenu::Refresh ( )
inlineprivate

Definition at line 145 of file ActionMenu.c.

146 {
147 if (!m_visible)
148 Show();
149
151 if (player.GetActionManager().IsSelectableActionsChanged())
153 }
void Show()
Definition ActionMenu.c:136

References GetGame(), GetPlayer(), m_visible, Show(), and UpdateWidgets().

◆ Show()

void ActionMenu::Show ( )
inlineprivate

Definition at line 136 of file ActionMenu.c.

137 {
138 if (m_visible)
139 return;
140
141 m_visible = true;
142 m_hide_timer.Run(HIDE_MENU_TIME, this, "HideWithFadeout");
143 }

References HIDE_MENU_TIME, m_hide_timer, and m_visible.

Referenced by Refresh().

◆ UpdateWidgets()

void ActionMenu::UpdateWidgets ( )
inlineprivate

Definition at line 44 of file ActionMenu.c.

45 {
46#ifdef DIAG_DEVELOPER
47 // tmp
48 bool newATSelection = DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_TARGETS_NEW, true);
49
50 // read the action manager
52 TSelectableActionInfoArray actions = player.GetActionManager().GetSelectableActions();
53 int selectedActionIndex = player.GetActionManager().GetSelectedActionIndex();
54
55 // clear state
56 m_defaultActionWidget.Show(false);
57 if (actions.Count() <= 1)
59 else
61
62 // update state
63 for (int i = 0; i < m_actionItems.Count(); i++)
64 {
66
67 if (i < actions.Count())
68 {
70 w.SetText(actionInfo.param3);
71
73 {
74 w.SetColor(0xFFFFEC44);
75
76 m_defaultActionWidget.SetText(actionInfo.param3);
77 if (!newATSelection)
78 m_defaultActionWidget.Show(true);
79 }
80 else
81 w.SetColor(0xFFFFFFFF);
82
83 w.Show(true);
84 }
85 else
86 w.Show(false);
87 }
88
89 float sx;
90 float sy;
91 m_actionsPanelWidget.GetSize(sx, sy);
92 m_actionsPanelWidget.SetSize(sx, 8 + (actions.Count() * 32));
93#endif
94 }
DiagMenuIDs
Definition EDiagMenuIDs.c:2
const float FADE_IN_TIME
Definition ActionMenu.c:3
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.

References FADE_IN_TIME, FADE_OUT_TIME, DiagMenu::GetBool(), GetGame(), GetPlayer(), m_actionItems, m_actionsPanelWidget, m_defaultActionWidget, and m_FadeTimer.

Referenced by NextAction(), NextActionCategory(), PrevAction(), PrevActionCategory(), and Refresh().

Member Data Documentation

◆ FADE_IN_TIME

const float ActionMenu::FADE_IN_TIME = 0.3
private

Definition at line 3 of file ActionMenu.c.

Referenced by UpdateWidgets().

◆ FADE_OUT_TIME

const float ActionMenu::FADE_OUT_TIME = 0.3
private

Definition at line 4 of file ActionMenu.c.

Referenced by HideWithFadeout(), and UpdateWidgets().

◆ HIDE_MENU_TIME

const float ActionMenu::HIDE_MENU_TIME = 5
private

Definition at line 5 of file ActionMenu.c.

Referenced by NextAction(), NextActionCategory(), PrevAction(), PrevActionCategory(), and Show().

◆ m_actionItems

ref array<TextWidget> ActionMenu::m_actionItems
private

Definition at line 8 of file ActionMenu.c.

Referenced by ActionMenu(), Init(), and UpdateWidgets().

◆ m_actionsPanelWidget

Widget ActionMenu::m_actionsPanelWidget
private

Definition at line 10 of file ActionMenu.c.

Referenced by Hide(), HideWithFadeout(), Init(), and UpdateWidgets().

◆ m_defaultActionWidget

TextWidget ActionMenu::m_defaultActionWidget
private

Definition at line 9 of file ActionMenu.c.

Referenced by Init(), and UpdateWidgets().

◆ m_FadeTimer

ref WidgetFadeTimer ActionMenu::m_FadeTimer
private

Definition at line 7 of file ActionMenu.c.

Referenced by ActionMenu(), Hide(), HideWithFadeout(), and UpdateWidgets().

◆ m_hide_timer

ref Timer ActionMenu::m_hide_timer
private

◆ m_visible

bool ActionMenu::m_visible
private

Definition at line 13 of file ActionMenu.c.

Referenced by ActionMenu(), Hide(), Refresh(), and Show().


The documentation for this class was generated from the following file: