4 protected string m_sTextName;
7 protected string m_sOptionalMessageLayoutName;
11 protected Widget m_Root;
14 [
Attribute(
"1",
desc:
"Wether or not the notification message list shrinks if a new stick notification is added (and increases again on deactivate). Do not change in runtime unless you are certain the notification log knows this notification is not active!")]
15 protected bool m_bInfluenceNotificationListSize;
17 protected bool m_bStickyNotificationActive =
false;
19 protected TextWidget m_Text;
20 protected Widget m_OptionalMessageLayout;
22 protected ref ScriptInvoker Event_OnStickyActiveChanged =
new ScriptInvoker();
24 protected void SetStickyActive(
bool newActive,
bool fade =
true)
26 if (newActive == m_bStickyNotificationActive)
30 SetVisible(newActive);
35 m_bStickyNotificationActive = newActive;
37 Event_OnStickyActiveChanged.Invoke(m_bStickyNotificationActive);
42 SetVisible(newActive);
51 return m_bStickyNotificationActive;
58 bool InfluenceNotificationListSize()
60 return m_bInfluenceNotificationListSize;
67 ScriptInvoker GetOnStickyActiveChanged()
69 return Event_OnStickyActiveChanged;
73 protected void SetVisible(
bool visible)
80 m_Root.SetVisible(visible);
84 protected void Fade(
bool fadeIn)
88 if (!m_FadeUIComponent.IsFadingIn())
89 m_FadeUIComponent.FadeIn(
false);
93 if (!
m_Root.IsVisible() || !m_FadeUIComponent.IsFadingOut())
94 m_FadeUIComponent.FadeOut(
false);
99 protected void OnButton()
110 m_NotificationsLog = notificationLog;
113 if (!m_NotificationsLog.HasNotificationInput())
123 m_Root.SetEnabled(editorManager.IsOpened());
124 editorManager.GetOnOpened().Insert(EditorOpened);
125 editorManager.GetOnClosed().Insert(EditorClosed);
129 protected void OnDestroy()
134 protected void EditorOpened()
141 protected void EditorClosed()
148 override void HandlerAttached(Widget w)
155 if (!m_FadeUIComponent)
156 Print(
"SCR_NotificationVotingInProgressUIComponent could not find SCR_FadeUIComponent! Make sure this component comes after the SCR_FadeUIComponent!", LogLevel.ERROR);
158 m_Text = TextWidget.Cast(w.FindAnyWidget(m_sTextName));
160 Print(
"SCR_NotificationVotingInProgressUIComponent could not find m_Text!", LogLevel.ERROR);
162 m_OptionalMessageLayout = w.FindAnyWidget(m_sOptionalMessageLayoutName);
166 onPressed.Insert(OnButton);
170 override void HandlerDeattached(Widget w)
174 if (m_NotificationsLog)
179 editorManager.GetOnOpened().Remove(EditorOpened);
180 editorManager.GetOnClosed().Remove(EditorClosed);