4 [
Attribute(defvalue:
"20", uiwidget: UIWidgets.Slider,
params:
"0 100 10")]
5 protected int m_iPaddingTop;
7 [
Attribute(defvalue:
"75", uiwidget: UIWidgets.Slider,
params:
"0 100 5")]
8 protected int m_iWidthPercentage;
10 [
Attribute(defvalue:
"2", uiwidget: UIWidgets.Slider,
params:
"0 10 1")]
11 protected int m_iThickness;
13 [
Attribute(defvalue:
"20", uiwidget: UIWidgets.Slider,
params:
"0 100 10")]
14 protected int m_iPaddingBottom;
16 [
Attribute(defvalue:
"{B998E3D32F62BE60}UI/layouts/Menus/FieldManual/Pieces/FieldManual_Piece_Separator.layout", uiwidget: UIWidgets.EditBoxWithButton,
params:
"layout")]
17 protected ResourceName m_Layout;
20 override void CreateWidget(notnull Widget parent)
22 WorkspaceWidget workspace =
GetGame().GetWorkspace();
24 Widget createdWidget = workspace.CreateWidgets(
m_Layout, parent);
27 Print(
"could not create image widget | " + FilePath.StripPath(__FILE__) +
":" + __LINE__, LogLevel.WARNING);
31 LayoutSlot.SetPadding(createdWidget, 0, m_iPaddingTop, 0, m_iPaddingBottom);
33 ImageWidget separator = ImageWidget.Cast(createdWidget.FindAnyWidget(
"Separator"));
39 if (m_iWidthPercentage < 1)
43 separator.SetSize(32, m_iThickness);
45 FrameWidget spaceLeft = FrameWidget.Cast(createdWidget.FindAnyWidget(
"SpaceLeft"));
46 FrameWidget spaceRight = FrameWidget.Cast(createdWidget.FindAnyWidget(
"SpaceRight"));
47 if (spaceLeft !=
null && spaceRight !=
null)
49 float remainder = (100.0 - m_iWidthPercentage) / 2;
50 LayoutSlot.SetFillWeight(spaceLeft, remainder);
51 LayoutSlot.SetFillWeight(separator, m_iWidthPercentage);
52 LayoutSlot.SetFillWeight(spaceRight, remainder);