Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FieldManualPiece_Image.c
Go to the documentation of this file.
1[BaseContainerProps(insertable: false), SCR_BaseContainerCustomTitleResourceName("m_ImagePath", true, "Image: %1")]
3{
4 protected static const int IMAGE_INDEX = 0;
5
6 [Attribute(uiwidget: UIWidgets.ResourcePickerThumbnail, params: "edds imageset")]
8
9 [Attribute()]
10 protected string m_sImageSetName;
11
12 [Attribute(defvalue: "1 1 1 1")]
14
15 [Attribute()]
16 protected string m_sCaption;
17
18 [Attribute(defvalue: "{68553AA626CD1A41}UI/layouts/Menus/FieldManual/Pieces/FieldManual_Piece_Image.layout", uiwidget: UIWidgets.EditBoxWithButton, params: "layout")]
20
21 [Attribute(defvalue: PlatformKind.PSN.ToString(), uiwidget: UIWidgets.ComboBox, desc: "Platform selected here will not show this element", enums: ParamEnumArray.FromEnum(PlatformKind))]
23
24 //------------------------------------------------------------------------------------------------
25 override void CreateWidget(notnull Widget parent)
26 {
27 if (m_ImagePath.IsEmpty() && m_sCaption.IsEmpty())
28 {
29 Print("Empty image entry, skipping widget creation | " + FilePath.StripPath(__FILE__) + ":" + __LINE__, LogLevel.DEBUG);
30 return;
31 }
32
33 WorkspaceWidget workspace = GetGame().GetWorkspace();
34
35 Widget createdWidget = workspace.CreateWidgets(m_Layout, parent);
36 if (!createdWidget)
37 {
38 Print("could not create image widget | " + FilePath.StripPath(__FILE__) + ":" + __LINE__, LogLevel.WARNING);
39 return;
40 }
41
42 ImageWidget imageWidget = ImageWidget.Cast(createdWidget.FindAnyWidget("Image"));
43 if (imageWidget)
44 {
45 if (!m_ImagePath.IsEmpty())
46 {
47 if (m_ImagePath.EndsWith("imageset") && !m_sImageSetName.IsEmpty())
48 {
49 imageWidget.LoadImageFromSet(IMAGE_INDEX, m_ImagePath, m_sImageSetName);
50 }
51 else
52 {
53 imageWidget.LoadImageTexture(IMAGE_INDEX, m_ImagePath);
54 }
55 SCR_WidgetHelper.ResizeToImage(imageWidget, IMAGE_INDEX);
56 if (m_ImageColor)
57 imageWidget.SetColor(m_ImageColor);
58 }
59 }
60
61 TextWidget textWidget = TextWidget.Cast(createdWidget.FindAnyWidget("Caption"));
62 if (textWidget)
63 textWidget.SetText(m_sCaption);
64 }
65
66 //------------------------------------------------------------------------------------------------
69 {
70 return m_ImagePath;
71 }
72
73 //------------------------------------------------------------------------------------------------
75 string GetSetName()
76 {
77 return m_sImageSetName;
78 }
79
80 //------------------------------------------------------------------------------------------------
83 {
84 return Color.FromInt(m_ImageColor.PackToInt());
85 }
86
87 //------------------------------------------------------------------------------------------------
90 {
91 return m_sCaption;
92 }
93
94 //------------------------------------------------------------------------------------------------
95 override bool CanCreateWidget()
96 {
97 PlatformKind localPlatform = GetGame().GetPlatformService().GetLocalPlatformKind();
98
99 if (localPlatform == m_eExcludedPlatform && localPlatform != PlatformKind.NONE)
100 return false;
101
102 return super.CanCreateWidget();
103 }
104}
ArmaReforgerScripted GetGame()
Definition game.c:1398
PlatformKind
Definition PlatformKind.c:8
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_CampaignMilitaryBaseComponent SCR_MilitaryBaseComponent SCR_BaseContainerCustomTitleResourceName("m_sBaseName", true)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Color.c:13
override void CreateWidget(notnull Widget parent)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute