Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ContentDetailsPanelBase.c
Go to the documentation of this file.
2{
4
5 [Attribute()]
6 protected ref DetailsPanelContentPresetConfig m_FallbackContent;
7
8 [Attribute("500")]
10
11 [Attribute("0")]
13
14 [Attribute("{8D067F8167DB936D}UI/layouts/Menus/Common/DetailsPanel/Prefabs/AddonTypeImage.layout")]
16
17 [Attribute("12")]
18 protected int m_iMaxTypeImages;
19
20 protected const int DESCRIPTION_LENGHT_OFFSET = 10;
21
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 {
39 return super.OnUpdate(w);
40
41 // This will also get called on updates of children, ignore them
42 if (w != m_wRoot)
43 return false;
44
45 GetGame().GetCallqueue().Call(UpdateSize);
46
47 return super.OnUpdate(w);
48 }
49
50 //------------------------------------------------------------------------------------------------
51 protected void UpdateSize()
52 {
53 // Resize the height of the picture, it must keep a fixed aspect ratio
54 float sizex, sizey;
55 m_wRoot.GetScreenSize(sizex, sizey);
56 float sizexUnscaled = GetGame().GetWorkspace().DPIUnscale(sizex);
57 m_CommonWidgets.m_wTopSize.EnableHeightOverride(true);
58 m_CommonWidgets.m_wTopSize.SetHeightOverride(sizexUnscaled / SCR_WorkshopUiCommon.IMAGE_SIZE_RATIO);
59 }
60
61 //-----------------------------------------------------------------------------------
64 {
66 {
67 if (content.m_sTag == contentTag)
68 return content;
69 }
70
71 return m_FallbackContent.m_DefaultContent;
72 }
73
74 //-----------------------------------------------------------------------------------
76 protected void SetDescriptionText(string text)
77 {
78 // Edit text if it's too long
80 {
81 text = text.Substring(0, m_iMaxDescriptionLenght);
82 text += "...";
83 }
84
85 m_CommonWidgets.m_wDescriptionText.SetText(text);
86 }
87
88 //-----------------------------------------------------------------------------------
89 protected Widget AddTypeDisplay(string image, ResourceName imageset, ResourceName glowImageset)
90 {
91 if (m_aTypeImages.Count() >= m_iMaxTypeImages)
92 return null;
93
94 Widget w = GetGame().GetWorkspace().CreateWidgets(m_sTypeDisplayLayout, m_CommonWidgets.m_wTypeImages);
95 if (!w)
96 return null;
97
98 m_aTypeImages.Insert(w);
99
101 if (comp)
102 comp.SetImage(image, imageset, glowImageset);
103
104 return w;
105 }
106
107 //-----------------------------------------------------------------------------------
108 protected void ClearTypeDisplays()
109 {
110 foreach (Widget w : m_aTypeImages)
111 {
112 w.RemoveFromHierarchy();
113 }
114
115 m_aTypeImages.Clear();
116 }
117}
118
119//-----------------------------------------------------------------------------------
120[BaseContainerProps(configRoot : true)]
121class DetailsPanelContentPresetConfig
122{
123 [Attribute()]
124 ref DetailsPanelContentPreset m_DefaultContent;
125
126 [Attribute()]
127 ref array<ref DetailsPanelContentPreset> m_aContent;
128}
129
130//-----------------------------------------------------------------------------------
134 [Attribute()]
135 string m_sTag;
137 [Attribute("", UIWidgets.ResourceNamePicker, "Layout", "edds")]
138 ResourceName m_sImage;
139
141 string m_sTitle;
142
143 [Attribute()]
144 string m_sTitleImageName;
145
146 [Attribute(UIColors.GetColorAttribute(UIColors.NEUTRAL_INFORMATION))]
147 ref Color m_sTitleImageColor;
148
149 [Attribute()]
150 string m_sDescription;
151}
class RestAPIHelper< JsonApiStruct T > content
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
string m_sDescription
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition Color.c:13
ref SCR_ContentDetailsPanelBaseWidgets m_CommonWidgets
SCR_SimpleWarningOverlayComponent m_WarningOverlay
void SetDescriptionText(string text)
Set description text with enforced text lenght limit.
DetailsPanelContentPreset FallbackContentByTag(string contentTag)
Get fallback content by tag.
ref DetailsPanelContentPresetConfig m_FallbackContent
Widget AddTypeDisplay(string image, ResourceName imageset, ResourceName glowImageset)
static bool IsEditMode()
Definition Functions.c:1566
SCR_FieldOfViewSettings Attribute