Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WarCrimesPanelUI.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
2 class SCR_WarCrimesPanelUI: ScriptedWidgetComponent
3 {
4 
5  protected Widget m_wRootWidget;
6 
7  protected ImageWidget m_WarCrimesHeaderImage;
8  protected RichTextWidget m_WarCrimesHeaderTitle;
9  protected RichTextWidget m_WarCrimesHeaderSubTitle;
10 
11  [Attribute(defvalue: "0.302 0.302 0.302 1", desc: "War crimes header background color")]
12  protected ref Color m_iWarCrimesHeaderBackgroundColor;
13 
14  [Attribute("{FDD5423E69D007F8}UI/Textures/Icons/icons_wrapperUI-128.imageset", UIWidgets.ResourcePickerThumbnail)]
15  protected ResourceName m_TextureHeaderImageNoWarCrimes;
16 
17  [Attribute(defvalue: "1 1 1 1", desc: "No war crimes header image color")]
18  protected ref Color m_iNoWarCrimesHeaderColor;
19 
20  [Attribute("HeaderImageNoWarCrimes")]
21  protected string m_StringHeaderImageNoWarCrimes;
22 
23  [Attribute(params: "No war crimes title")]
24  protected string m_sNoWarCrimesTitleString;
25 
26  [Attribute(params: "No war crimes subtitle")]
27  protected string m_sNoWarCrimesSubtitleString;
28 
29  [Attribute("{FDD5423E69D007F8}UI/Textures/Icons/icons_wrapperUI-128.imageset", UIWidgets.ResourcePickerThumbnail)]
30  protected ResourceName m_TextureHeaderImageWarCrimes;
31 
32  [Attribute(defvalue: "1 0 0 1", desc: "War crimes header image color")]
33  protected ref Color m_iWarCrimesHeaderColor;
34 
35  [Attribute("HeaderImageNoWarCrimes")]
36  protected string m_StringHeaderImageWarCrimes;
37 
38  [Attribute(params: "War crimes title")]
39  protected string m_sWarCrimesTitleString;
40 
41  [Attribute(params: "War crimes subtitle")]
42  protected string m_sWarCrimesSubtitleString;
43 
44  [Attribute(params: "War Crimes Entry layout")]
45  protected ResourceName m_WarCrimesEntryLayout;
46 
47  [Attribute("{FDD5423E69D007F8}UI/Textures/Icons/icons_wrapperUI-128.imageset", UIWidgets.ResourcePickerThumbnail)]
48  protected ResourceName m_TextureEntryImageWarCrimes;
49 
50  [Attribute(defvalue: "1 0 0 1", desc: "War crimes entry image color")]
51  protected ref Color m_iWarCrimesEntryColor;
52 
53  [Attribute(defvalue: "0.19608 0.06667 0.06667 1", desc: "War crimes entry image color")]
54  protected ref Color m_iWarCrimesEntryBackgroundColor;
55 
56  [Attribute("EntryImageNoWarCrimes")]
57  protected string m_StringEntryImageWarCrimes;
58 
59  [Attribute(params: "Harming friendlies string")]
60  protected string m_sHarmingFriendliesString;
61 
62  [Attribute(defvalue: "0.761 0.392 0.078 1", desc: "No War Crimes subtitle color")]
63  protected ref Color m_iNoWarCrimesSubtitleColor;
64 
65  [Attribute(defvalue: "0.502 0 0 1", desc: "War Crimes subtitle color")]
66  protected ref Color m_iWarCrimesSubtitleColor;
67 
68  protected bool m_bActiveWarCrimes = false;
69 
70  //------------------------------------------------------------------------------------------------
71  protected override void HandlerAttached(Widget w)
72  {
73  m_wRootWidget = w;
74  m_WarCrimesHeaderImage = ImageWidget.Cast(m_wRootWidget.FindAnyWidget("WarCrimesHeaderImage"));
75  m_WarCrimesHeaderTitle = RichTextWidget.Cast(m_wRootWidget.FindAnyWidget("WarCrimesTitle"));
76  m_WarCrimesHeaderSubTitle = RichTextWidget.Cast(m_wRootWidget.FindAnyWidget("WarCrimesSubtitle"));
77  WarCrimesActive(false);
78 
79  ImageWidget backgroundHeader = ImageWidget.Cast(m_wRootWidget.FindAnyWidget("Background1"));
80  if (backgroundHeader)
81  backgroundHeader.SetColor(m_iWarCrimesHeaderBackgroundColor);
82  }
83 
84  //------------------------------------------------------------------------------------------------
85  void CreateWarCrimeEntry(SCR_EWarCrimes crime)
86  {
87  WorkspaceWidget workspace = GetGame().GetWorkspace();
88  if (!workspace)
89  return;
90 
91  Widget container = Widget.Cast(m_wRootWidget.FindAnyWidget("WarCrimeEntriesContainer"));
92  if (!container)
93  return;
94 
95  switch (crime)
96  {
97  case SCR_EWarCrimes.HARMINGFRIENDLIES:
98  Widget entry = Widget.Cast(workspace.CreateWidgets(m_WarCrimesEntryLayout, container));
99  if (!entry)
100  return;
101 
102  RichTextWidget entryText = RichTextWidget.Cast(entry.FindAnyWidget("WarCrimeEntryText"));
103  ImageWidget entryImage = ImageWidget.Cast(entry.FindAnyWidget("WarCrimeEntryImage"));
104  if (!entryText || !entryImage)
105  return;
106 
107  entryText.SetText(m_sHarmingFriendliesString);
108  SCR_WLibComponentBase.SetTexture(entryImage, m_TextureEntryImageWarCrimes, m_StringEntryImageWarCrimes);
109  entryImage.SetColor(m_iWarCrimesEntryColor);
110  break;
111  default: return;
112  }
113 
114  if (!m_bActiveWarCrimes)
115  WarCrimesActive(true);
116  }
117 
118  //------------------------------------------------------------------------------------------------
119  protected void WarCrimesActive(bool warCriminal)
120  {
121  if (!m_WarCrimesHeaderImage || !m_WarCrimesHeaderTitle || !m_WarCrimesHeaderSubTitle)
122  return;
123 
124  Widget ListOfWarCrimes = Widget.Cast(m_wRootWidget.FindAnyWidget("ListOfWarCrimes"));
125  if (!ListOfWarCrimes)
126  return;
127 
128  if (warCriminal)
129  {
130  ListOfWarCrimes.SetVisible(true);
131  m_bActiveWarCrimes = true;
132  SCR_WLibComponentBase.SetTexture(m_WarCrimesHeaderImage, m_TextureHeaderImageWarCrimes, m_StringHeaderImageWarCrimes);
133  m_WarCrimesHeaderImage.SetColor(m_iWarCrimesHeaderColor);
134  m_WarCrimesHeaderTitle.SetText(m_sWarCrimesTitleString);
135  m_WarCrimesHeaderSubTitle.SetText(m_sWarCrimesSubtitleString);
136  m_WarCrimesHeaderSubTitle.SetColor(m_iWarCrimesSubtitleColor);
137  return;
138  }
139 
140  ListOfWarCrimes.SetVisible(false);
141  m_bActiveWarCrimes = false;
142  SCR_WLibComponentBase.SetTexture(m_WarCrimesHeaderImage, m_TextureHeaderImageNoWarCrimes, m_StringHeaderImageNoWarCrimes);
143  m_WarCrimesHeaderImage.SetColor(m_iNoWarCrimesHeaderColor);
144  m_WarCrimesHeaderTitle.SetText(m_sNoWarCrimesTitleString);
145  m_WarCrimesHeaderSubTitle.SetText(m_sNoWarCrimesSubtitleString);
146  m_WarCrimesHeaderSubTitle.SetColor(m_iNoWarCrimesSubtitleColor);
147  }
148 
149  //------------------------------------------------------------------------------------------------
150 };
151 
152 //------------------------------------------------------------------------------------------------
154 {
156 };
SCR_WLibComponentBase
Base class for all final Reforger interactive elements.
Definition: SCR_WLibComponentBase.c:4
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_EWarCrimes
SCR_EWarCrimes
Definition: SCR_WarCrimesPanelUI.c:153
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_WarCrimesPanelUI
Definition: SCR_WarCrimesPanelUI.c:2
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
HARMINGFRIENDLIES
@ HARMINGFRIENDLIES
Definition: SCR_WarCrimesPanelUI.c:155