DayZ 1.24
Loading...
Searching...
No Matches
BannerHandlerBase.c
Go to the documentation of this file.
1class BannerHandlerBase extends ScriptedWidgetEventHandler
2{
3 protected Widget m_Root;
4 protected Widget m_Parent; //frame
8
10 {
11 m_Parent = parent;
12 m_Root = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/dlc_panels/BannerTemplate.layout", m_Parent);
13 m_Root.SetHandler(this);
14
15 m_BannerBody = m_Root.FindAnyWidget("BadgeBody");
16 m_BannerWedge = m_Root.FindAnyWidget("BadgeWedge");
17 m_BannerText = TextWidget.Cast(m_Root.FindAnyWidget("BadgeText"));
18
19 m_BannerBody.SetAlpha(1.0);
20 m_BannerWedge.SetAlpha(1.0);
21 }
22
24 {
25 m_BannerBody.SetColor(argb);
26 m_BannerWedge.SetColor(argb);
27 }
28
29 void SetBannerText(string text)
30 {
31 m_BannerText.SetText(text);
32 }
33
34 override bool OnUpdate(Widget w)
35 {
36 if (w == m_BannerText)
37 {
38 float w0, h0, x0, y0;
39 m_BannerText.GetScreenSize(w0, h0);
40 float bannerBodyWidth = w0 + 20;
41
42 m_BannerBody.SetScreenSize(bannerBodyWidth, h0);
43 m_BannerBody.GetScreenPos(x0, y0);
44
45 m_BannerWedge.GetScreenSize(w0, h0);
46 m_BannerWedge.SetScreenPos(Math.Ceil(x0 - w0), y0);
47 }
48
49 return super.OnUpdate(w);
50 }
51}
Widget m_Root
Definition SizeToChild.c:85
Widget m_Parent
Definition SizeToChild.c:86
Definition EnMath.c:7
map: item x vector(index, width, height)
Definition EnWidgets.c:651
override bool OnUpdate(Widget w)
void BannerHandlerBase(Widget parent)
void SetBannerText(string text)
proto native CGame GetGame()
static proto float Ceil(float f)
Returns ceil of value.