Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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")]
7  protected ResourceName m_ImagePath;
8 
9  [Attribute()]
10  protected string m_sImageSetName;
11 
12  [Attribute(defvalue: "1 1 1 1")]
13  ref Color m_ImageColor;
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")]
19  protected ResourceName m_Layout;
20 
21  //------------------------------------------------------------------------------------------------
22  override void CreateWidget(notnull Widget parent)
23  {
24  if (m_ImagePath.IsEmpty() && m_sCaption.IsEmpty())
25  {
26  Print("Empty image entry, skipping widget creation | " + FilePath.StripPath(__FILE__) + ":" + __LINE__, LogLevel.DEBUG);
27  return;
28  }
29 
30  WorkspaceWidget workspace = GetGame().GetWorkspace();
31 
32  Widget createdWidget = workspace.CreateWidgets(m_Layout, parent);
33  if (!createdWidget)
34  {
35  Print("could not create image widget | " + FilePath.StripPath(__FILE__) + ":" + __LINE__, LogLevel.WARNING);
36  return;
37  }
38 
39  ImageWidget imageWidget = ImageWidget.Cast(createdWidget.FindAnyWidget("Image"));
40  if (imageWidget)
41  {
42  if (!m_ImagePath.IsEmpty())
43  {
44  if (m_ImagePath.EndsWith("imageset") && !m_sImageSetName.IsEmpty())
45  {
46  imageWidget.LoadImageFromSet(IMAGE_INDEX, m_ImagePath, m_sImageSetName);
47  }
48  else
49  {
50  imageWidget.LoadImageTexture(IMAGE_INDEX, m_ImagePath);
51  }
52  SCR_WidgetHelper.ResizeToImage(imageWidget, IMAGE_INDEX);
53  if (m_ImageColor)
54  imageWidget.SetColor(m_ImageColor);
55  }
56  }
57 
58  TextWidget textWidget = TextWidget.Cast(createdWidget.FindAnyWidget("Caption"));
59  if (textWidget)
60  textWidget.SetText(m_sCaption);
61  }
62 
63  //------------------------------------------------------------------------------------------------
65  ResourceName GetImagePath()
66  {
67  return m_ImagePath;
68  }
69 
70  //------------------------------------------------------------------------------------------------
72  string GetSetName()
73  {
74  return m_sImageSetName;
75  }
76 
77  //------------------------------------------------------------------------------------------------
79  Color GetImageColor()
80  {
81  return Color.FromInt(m_ImageColor.PackToInt());
82  }
83 
84  //------------------------------------------------------------------------------------------------
86  ResourceName GetCaption()
87  {
88  return m_sCaption;
89  }
90 }
SCR_BaseContainerCustomTitleResourceName
SCR_CampaignMilitaryBaseComponent SCR_MilitaryBaseComponent SCR_BaseContainerCustomTitleResourceName("m_sBaseName", true)
Definition: SCR_CampaignMilitaryBaseComponent.c:2522
SCR_FieldManualPiece
Definition: SCR_FieldManualPiece.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_Layout
ResourceName m_Layout
Definition: SCR_ActionsToolbarEditorUIComponent.c:6
SCR_WidgetHelper
Definition: SCR_WidgetHelper.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_FieldManualPiece_Image
Definition: SCR_FieldManualPiece_Image.c:2
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468