5 protected Widget m_wCancelButton;
6 protected Widget m_wConfirmButton;
10 protected ImageWidget m_wImgTopLine;
11 protected ImageWidget m_wImgTitleIcon;
13 protected TextWidget m_wTitle;
14 protected TextWidget m_wContent;
15 ref ScriptInvoker m_OnConfirm =
new ScriptInvoker();
16 ref ScriptInvoker m_OnCancel =
new ScriptInvoker();
17 protected float m_fAnimationRate =
UIConstants.FADE_RATE_FAST;
24 override void OnMenuOpen()
31 m_wCancelButton = w.FindAnyWidget(
"Cancel");
36 m_Cancel.m_OnActivated.Insert(OnCancel);
40 m_wConfirmButton = w.FindAnyWidget(
"Confirm");
45 m_Confirm.m_OnActivated.Insert(OnConfirm);
49 m_wImgTopLine = ImageWidget.Cast(w.FindAnyWidget(
"Separator"));
50 m_wImgTitleIcon = ImageWidget.Cast(w.FindAnyWidget(
"ImgTitleIcon"));
53 m_wTitle = TextWidget.Cast(w.FindAnyWidget(
"Title"));
54 m_wContent = TextWidget.Cast(w.FindAnyWidget(
"Message"));
61 SetDialogType(m_DialogData.m_iDialogType);
67 override void OnMenuInit()
75 override void OnMenuClose()
82 override void OnMenuUpdate(
float tDelta)
84 super.OnMenuUpdate(tDelta);
86 GetGame().GetInputManager().ActivateContext(
"DialogContext");
90 protected void OnConfirm()
98 protected void OnCancel()
109 m_iDialogType =
type;
112 if (!m_wImgTopLine || !m_wImgTitleIcon)
116 Color color = Color.FromInt(Color.WHITE);
118 switch (m_iDialogType)
121 color = Color.FromInt(
UIColors.CONTRAST_CLICKED_HOVERED.PackToInt());
125 color = Color.FromInt(
UIColors.WARNING.PackToInt());
129 color = Color.FromInt(
UIColors.CONFIRM.PackToInt());
133 color = Color.FromInt(
UIColors.ONLINE.PackToInt());
138 m_wImgTopLine.SetColor(color);
139 m_wImgTitleIcon.SetColor(color);
143 void SetTitle(
string text)
146 m_wTitle.SetText(text);
155 return m_wTitle.GetText();
159 void SetMessage(
string text)
175 void SetConfirmText(
string text)
178 m_Confirm.SetLabel(text);
182 void SetCancelText(
string text)
185 m_Cancel.SetLabel(text);
191 m_iDialogType =
type;
196 void SetTitleIcon(ResourceName image,
string imageName)
198 if (!m_wImgTitleIcon)
202 if (image.EndsWith(
"imageset"))
203 m_wImgTitleIcon.LoadImageFromSet(0, image, imageName);
205 m_wImgTitleIcon.LoadImageTexture(0, image);
210 void SetTitleIcon(
string imageName)
215 m_wImgTitleIcon.LoadImageFromSet(0, m_DialogData.m_sIconSet, imageName);
224 if (m_fAnimationRate > 0)
225 delay = 1 / m_fAnimationRate * 1000;
226 GetGame().GetCallqueue().CallLater(Close, delay);
232 return m_DynamicFooter;