Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
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 = g_Game.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
23 void SetBannerColor(int argb)
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}
Entity m_Parent
Definition enmath.c:7
map: item x vector(index, width, height)
Definition enwidgets.c:657
void BannerHandlerBase(Widget parent)
void SetBannerText(string text)
override bool OnUpdate(Widget w)
DayZGame g_Game
Definition dayzgame.c:3942
static proto float Ceil(float f)
Returns ceil of value.
WorkspaceWidget Widget
Defined in code.
Widget m_Root
Definition sizetochild.c:91