Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ContentDetailsPanelBase.c
Go to the documentation of this file.
2 {
4 
6  protected ref DetailsPanelContentPresetConfig m_FallbackContent;
7 
8  [Attribute("500")]
9  protected int m_iMaxDescriptionLenght;
10 
11  [Attribute("0")]
12  protected bool m_bDisplayAdditionalInfo;
13 
14  [Attribute("{8D067F8167DB936D}UI/layouts/Menus/Common/DetailsPanel/Prefabs/AddonTypeImage.layout")]
15  protected ResourceName m_sTypeDisplayLayout;
16 
17  [Attribute("12")]
18  protected int m_iMaxTypeImages;
19 
20  protected const int DESCRIPTION_LENGHT_OFFSET = 10;
21 
22  protected SCR_SimpleWarningOverlayComponent m_WarningOverlay;
23  protected ref array<Widget> m_aTypeImages = {};
24 
25  //------------------------------------------------------------------------------------------------
26  override void HandlerAttached(Widget w)
27  {
28  super.HandlerAttached(w);
29  m_CommonWidgets.Init(w.FindWidget("ContentDetailsPanel")); // The layout is exported from base layout which is embedded into this layout.
30 
31  m_CommonWidgets.m_WarningOverlayComponent.SetWarningVisible(false, false);
32  m_CommonWidgets.m_wAdditionalInfo.SetVisible(m_bDisplayAdditionalInfo);
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  override bool OnUpdate(Widget w)
37  {
38  // This will also get called on updates of children, ignore them
39  if (w != m_wRoot)
40  return true;
41 
42  GetGame().GetCallqueue().CallLater(UpdateSize, 0);
43 
44  return true;
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  protected void UpdateSize()
49  {
50  // Resize the height of the picture, it must keep a fixed aspect ratio
51  float sizex, sizey;
52  m_wRoot.GetScreenSize(sizex, sizey);
53  float sizexUnscaled = GetGame().GetWorkspace().DPIUnscale(sizex);
54  m_CommonWidgets.m_wTopSize.EnableHeightOverride(true);
55  m_CommonWidgets.m_wTopSize.SetHeightOverride(sizexUnscaled / SCR_WorkshopUiCommon.IMAGE_SIZE_RATIO);
56  }
57 
58  //-----------------------------------------------------------------------------------
60  protected DetailsPanelContentPreset FallbackContentByTag(string contentTag)
61  {
62  foreach (DetailsPanelContentPreset content : m_FallbackContent.m_aContent)
63  {
64  if (content.m_sTag == contentTag)
65  return content;
66  }
67 
68  return m_FallbackContent.m_DefaultContent;
69  }
70 
71  //-----------------------------------------------------------------------------------
73  protected void SetDescriptionText(string text)
74  {
75  // Edit text if it's too long
76  if (text.Length() > m_iMaxDescriptionLenght + DESCRIPTION_LENGHT_OFFSET)
77  {
78  text = text.Substring(0, m_iMaxDescriptionLenght);
79  text += "...";
80  }
81 
82  m_CommonWidgets.m_wDescriptionText.SetText(text);
83  }
84 
85  //-----------------------------------------------------------------------------------
86  protected Widget AddTypeDisplay(string image, ResourceName imageset, ResourceName glowImageset)
87  {
88  if (m_aTypeImages.Count() >= m_iMaxTypeImages)
89  return null;
90 
91  Widget w = GetGame().GetWorkspace().CreateWidgets(m_sTypeDisplayLayout, m_CommonWidgets.m_wTypeImages);
92  if (!w)
93  return null;
94 
95  m_aTypeImages.Insert(w);
96 
98  if (comp)
99  comp.SetImage(image, imageset, glowImageset);
100 
101  return w;
102  }
103 
104  //-----------------------------------------------------------------------------------
105  protected void ClearTypeDisplays()
106  {
107  foreach (Widget w : m_aTypeImages)
108  {
109  w.RemoveFromHierarchy();
110  }
111 
112  m_aTypeImages.Clear();
113  }
114 }
115 
116 //-----------------------------------------------------------------------------------
117 [BaseContainerProps(configRoot : true)]
118 class DetailsPanelContentPresetConfig
119 {
120  [Attribute()]
121  ref DetailsPanelContentPreset m_DefaultContent;
122 
123  [Attribute()]
124  ref array<ref DetailsPanelContentPreset> m_aContent;
125 }
126 
127 //-----------------------------------------------------------------------------------
130 {
131  [Attribute()]
132  string m_sTag;
133 
134  [Attribute("", UIWidgets.ResourceNamePicker, "Layout", "edds")]
135  ResourceName m_sImage;
136 
137  [Attribute()]
138  string m_sTitle;
139 
140  [Attribute()]
141  string m_sTitleImageName;
142 
143  [Attribute(UIColors.GetColorAttribute(UIColors.NEUTRAL_INFORMATION))]
144  ref Color m_sTitleImageColor;
145 
146  [Attribute()]
147  string m_sDescription;
148 }
m_FallbackContent
protected ref DetailsPanelContentPresetConfig m_FallbackContent
Definition: SCR_ContentDetailsPanelBase.c:5
m_iMaxTypeImages
protected int m_iMaxTypeImages
Definition: SCR_ContentDetailsPanelBase.c:17
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
m_bDisplayAdditionalInfo
protected bool m_bDisplayAdditionalInfo
Definition: SCR_ContentDetailsPanelBase.c:11
SCR_ContentDetailsPanelBase
Definition: SCR_ContentDetailsPanelBase.c:1
m_aTypeImages
protected ref array< Widget > m_aTypeImages
Definition: SCR_ContentDetailsPanelBase.c:22
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_sTypeDisplayLayout
protected ResourceName m_sTypeDisplayLayout
Definition: SCR_ContentDetailsPanelBase.c:14
SCR_ContentDetailsPanelBaseWidgets
Definition: SCR_ContentDetailsPanelBaseWidgets.c:3
BaseContainerCustomTitleField
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition: SCR_KeyBindingMenuConfig.c:113
SCR_SimpleWarningOverlayComponent
Definition: SCR_SimpleWarningOverlayComponent.c:6
Attribute
typedef Attribute
Post-process effect of scripted camera.
UIColors
Definition: Constants.c:16
DetailsPanelContentPreset
Definition: SCR_ContentDetailsPanelBase.c:129
SCR_DynamicIconComponent
Definition: SCR_DynamicIconComponent.c:5
SCR_WorkshopUiCommon
Definition: SCR_WorkshopUiCommon.c:5
SCR_ScriptedWidgetComponent
Definition: SCR_ScriptedWidgetComponent.c:7
BaseContainerProps
SCR_ContentDetailsPanelBase SCR_ScriptedWidgetComponent BaseContainerProps(configRoot :true)
Definition: SCR_ContentDetailsPanelBase.c:117
m_CommonWidgets
protected ref SCR_ContentDetailsPanelBaseWidgets m_CommonWidgets
Definition: SCR_ContentDetailsPanelBase.c:2