4 protected static const int IMAGE_INDEX = 0;
6 [
Attribute(uiwidget: UIWidgets.ResourcePickerThumbnail,
params:
"edds imageset")]
7 protected ResourceName m_ImagePath;
10 protected string m_sImageSetName;
13 ref Color m_ImageColor;
16 protected string m_sCaption;
18 [
Attribute(defvalue:
"{68553AA626CD1A41}UI/layouts/Menus/FieldManual/Pieces/FieldManual_Piece_Image.layout", uiwidget: UIWidgets.EditBoxWithButton,
params:
"layout")]
19 protected ResourceName m_Layout;
22 override void CreateWidget(notnull Widget parent)
24 if (m_ImagePath.IsEmpty() && m_sCaption.IsEmpty())
26 Print(
"Empty image entry, skipping widget creation | " + FilePath.StripPath(__FILE__) +
":" + __LINE__, LogLevel.DEBUG);
30 WorkspaceWidget workspace =
GetGame().GetWorkspace();
32 Widget createdWidget = workspace.CreateWidgets(
m_Layout, parent);
35 Print(
"could not create image widget | " + FilePath.StripPath(__FILE__) +
":" + __LINE__, LogLevel.WARNING);
39 ImageWidget imageWidget = ImageWidget.Cast(createdWidget.FindAnyWidget(
"Image"));
42 if (!m_ImagePath.IsEmpty())
44 if (m_ImagePath.EndsWith(
"imageset") && !m_sImageSetName.IsEmpty())
46 imageWidget.LoadImageFromSet(IMAGE_INDEX, m_ImagePath, m_sImageSetName);
50 imageWidget.LoadImageTexture(IMAGE_INDEX, m_ImagePath);
54 imageWidget.SetColor(m_ImageColor);
58 TextWidget textWidget = TextWidget.Cast(createdWidget.FindAnyWidget(
"Caption"));
60 textWidget.SetText(m_sCaption);
65 ResourceName GetImagePath()
74 return m_sImageSetName;
81 return Color.FromInt(m_ImageColor.PackToInt());
86 ResourceName GetCaption()