3 private const float FADE_IN_TIME = 0.3;
4 private const float FADE_OUT_TIME = 0.3;
5 private const float HIDE_MENU_TIME = 5;
7 private ref WidgetFadeTimer m_FadeTimer;
10 private Widget m_actionsPanelWidget;
11 private ref
Timer m_hide_timer;
13 private bool m_visible;
18 m_FadeTimer =
new WidgetFadeTimer;
25 m_defaultActionWidget = default_action_widget;
26 m_actionsPanelWidget = actions_panel_widget;
27 m_actionItems.Clear();
29 TextWidget w =
TextWidget.Cast( m_actionsPanelWidget.FindAnyWidget(
"ActionListItem" + i.ToString()) );
33 m_actionItems.Insert(w);
36 w =
TextWidget.Cast( m_actionsPanelWidget.FindAnyWidget(
"ActionListItem" + i.ToString()) );
39 m_defaultActionWidget.Show(
false);
40 m_actionsPanelWidget.Show(
true);
41 m_actionsPanelWidget.SetAlpha(0);
52 TSelectableActionInfoArray actions = player.GetActionManager().GetSelectableActions();
53 int selectedActionIndex = player.GetActionManager().GetSelectedActionIndex();
56 m_defaultActionWidget.Show(
false);
57 if ( actions.Count() <= 1 )
58 m_FadeTimer.FadeOut(m_actionsPanelWidget, FADE_OUT_TIME,
true);
60 m_FadeTimer.FadeIn(m_actionsPanelWidget, FADE_IN_TIME,
true);
63 for (
int i = 0; i < m_actionItems.Count(); i++)
67 if (i < actions.Count())
70 w.SetText(actionInfo.param3);
72 if (i == selectedActionIndex)
74 w.SetColor(0xFFFFEC44);
76 m_defaultActionWidget.SetText(actionInfo.param3);
77 if ( !newATSelection )
79 m_defaultActionWidget.Show(
true);
84 w.SetColor(0xFFFFFFFF);
97 m_actionsPanelWidget.GetSize(sx, sy);
98 m_actionsPanelWidget.SetSize(sx, 8 + (actions.Count() * 32));
105 player.GetActionManager().SelectNextAction();
109 m_hide_timer.Run(HIDE_MENU_TIME,
this,
"HideWithFadeout");
115 player.GetActionManager().SelectPrevAction();
119 m_hide_timer.Run(HIDE_MENU_TIME,
this,
"HideWithFadeout");
122 void NextActionCategory()
125 player.GetActionManager().SelectNextActionCategory();
129 m_hide_timer.Run(HIDE_MENU_TIME,
this,
"HideWithFadeout");
132 void PrevActionCategory()
135 player.GetActionManager().SelectPrevActionCategory();
139 m_hide_timer.Run(HIDE_MENU_TIME,
this,
"HideWithFadeout");
148 m_hide_timer.Run(HIDE_MENU_TIME,
this,
"HideWithFadeout");
157 if( player.GetActionManager().IsSelectableActionsChanged() )
170 m_actionsPanelWidget.Show(
false);
173 void HideWithFadeout()
176 if (m_actionsPanelWidget.IsVisible())
177 m_FadeTimer.FadeOut(m_actionsPanelWidget, FADE_OUT_TIME,
true);