Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WatermarkComponent.c
Go to the documentation of this file.
1 class SCR_WatermarkComponent: ScriptedWidgetComponent
2 {
3  [Attribute("WatermarkPlatformText")]
4  private string m_sWatermarkWidgetName;
5 
6  [Attribute("WatermarkVersionText")]
7  private string m_sVersionTextWidgetName;
8 
9  private Widget m_wRoot;
10  private Widget m_wLayoutRoot;
11 
12  //------------------------------------------------------------------------------------------------
13  override void HandlerAttached(Widget w)
14  {
15  m_wRoot = w;
16  m_wLayoutRoot = m_wRoot.GetParent();
17 
18  m_wLayoutRoot.SetVisible(false);
19 
20  TextWidget wWatermark = TextWidget.Cast(w.FindAnyWidget(m_sWatermarkWidgetName));
21  TextWidget wVersion = TextWidget.Cast(w.FindAnyWidget(m_sVersionTextWidgetName));
22 
23  if (!wWatermark || !wVersion)
24  return;
25 
26  PlatformService platformService = GetGame().GetPlatformService();
27 
28  if (!platformService)
29  return;
30 
31  PlatformKind platformID = platformService.GetLocalPlatformKind();
32 
33  if (platformID < 0)
34  return;
35 
36  // Set current build name
37  string buildName = "";
38 
39  if (GetGame().IsExperimentalBuild())
40  {
41  buildName = "#AR-Experimental_WelcomeLabel";
42  }
43  else if (platformID == 0)
44  {
45  buildName = "#AR-Watermark_Development";
46  }
47 
48  wWatermark.SetText(buildName);
49 
50  // Get game version & platform suffix
51  string version = GetGame().GetBuildVersion();
52 
53  array <string> platformStrings =
54  {
55  "", /* Workbench - not to be displayed */
56  "#AR-UI_Xbox",
57  "#AR-UI_PSN",
58  "#AR-UI_Steam"
59  };
60 
61  if (platformID < platformStrings.Count())
62  {
63  string platformSuffix = WidgetManager.Translate(platformStrings[platformID]);
64 
65  if (platformSuffix != "")
66  version = string.Format("%1 (%2)", version, platformSuffix);
67  }
68 
69  // Update the game version widget (number + platform suffix)
70  wVersion.SetText(version);
71  m_wLayoutRoot.SetVisible(true);
72  }
73 };
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_WatermarkComponent
Definition: SCR_WatermarkComponent.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.