4 protected static const ref Color BUTTON_RED = Color.FromSRGBA(197, 75, 75, 255);
8 float m_fStartPointX, m_fStartPointY;
9 float m_fEndPointX, m_fEndPointY;
12 ImageWidget m_wLineImage;
13 Widget m_wDeleteButton;
16 SCR_MapDrawingUI m_OwnerComponent;
22 void CreateLine(notnull Widget rootW,
bool drawStart =
false)
35 m_wLine =
GetGame().GetWorkspace().CreateWidgets(
"{E8850FCD9219C411}UI/layouts/Map/MapDrawLine.layout", mapFrame);
38 m_wDeleteButton =
GetGame().GetWorkspace().CreateWidgets(
"{F486FAEEA00A5218}UI/layouts/Map/MapLineDeleteButton.layout", mapFrame);
52 protected void OnButtonClick()
62 protected void OnButtonFocus()
68 protected void OnButtonFocusLost(Widget w)
74 protected void OnMouseEnter(Widget w)
76 GetGame().GetWorkspace().SetFocusedWidget(w);
80 protected void OnMouseLeave(Widget w)
82 GetGame().GetWorkspace().SetFocusedWidget(
null);
87 void SetButtonVisible(
bool target)
96 void DestroyLine(
bool cacheDrawn =
false)
114 void UpdateLine(
bool updateEndPos)
120 m_MapEntity.GetMapCursorWorldPosition(m_fEndPointX, m_fEndPointY);
122 int screenX, screenY, endX, endY;
124 m_MapEntity.WorldToScreen(m_fStartPointX, m_fStartPointY, screenX, screenY,
true);
125 m_MapEntity.WorldToScreen(m_fEndPointX, m_fEndPointY, endX, endY,
true);
127 vector lineVector = vector.Zero;
131 vector angles = lineVector.VectorToAngles();
133 angles[1] = 180 - angles[1];
134 else if (angles[0] == 0)
135 angles[1] = 180 + angles[1];
139 lineVector =
m_MapEntity.GetMapWidget().SizeToPixels(lineVector);
142 FrameSlot.SetPos(m_wLine,
GetGame().GetWorkspace().DPIUnscale(screenX),
GetGame().GetWorkspace().DPIUnscale(screenY));
145 GetGame().GetWorkspace().DPIUnscale((screenX + endX) * 0.5),
146 GetGame().GetWorkspace().DPIUnscale((screenY + endY) * 0.5),
149 FrameSlot.SetPos(m_wDeleteButton, lineVector[0], lineVector[1]);
167 [
Attribute(
"editor", UIWidgets.EditBox,
desc:
"Toolmenu imageset quad name")]
168 string m_sToolMenuIconName;
183 protected ref array<ref MapLine>
m_aLines =
new array <ref MapLine>();
207 GetGame().GetInputManager().AddActionListener(
"MapSelect", EActionTrigger.UP,
OnMapClick);
218 GetGame().GetInputManager().RemoveActionListener(
"MapSelect", EActionTrigger.UP,
OnMapClick);
236 m_aLines[i].SetButtonVisible(
false);
254 protected void OnMapClick(
float value, EActionTrigger reason)
273 if (tracedW.Count() != expectedCount)
278 if (tracedW.IsIndexValid(0) && tracedW[0].GetName() == widgetName)
330 protected void OnMapPan(
float x,
float y,
bool adjustedPan)
370 super.OnMapOpen(config);
376 ScriptCallQueue callQueue =
GetGame().GetCallqueue();
383 m_aLines[i].SetButtonVisible(
false);
404 super.OnMapClose(config);