10 [
Attribute(
desc:
"Quad name from imageset defined on MapWidget.")]
11 protected string m_sImageDef;
14 protected ref Color m_IconColor;
17 protected ref Color m_ViewConeColor;
19 [
Attribute(
"0.375", uiwidget: UIWidgets.Slider,
"Icon size coefficient.",
params:
"0 1 0.125")]
20 protected float m_fIconScale;
22 [
Attribute(
"1000",
desc:
"Maximum length of the view cone (and also maximum distance of tracing method).")]
23 protected float m_fMaxViewConeLength;
25 [
Attribute(
"ManualCamera",
desc:
"Name of canvas widget in which view cone will be rendered.")]
26 protected string m_sMapCanvasWidgetName;
29 protected ref
MapItem m_MapItem;
30 protected CanvasWidget m_MapCanvas;
31 protected ref PolygonDrawCommand m_DrawLine =
new PolygonDrawCommand();
32 protected ref array<ref CanvasWidgetCommand> m_MapDrawCommands = { m_DrawLine };
34 protected WorkspaceWidget m_Workspace;
35 protected BaseWorld m_World;
36 protected ref TraceParam m_Trace =
new TraceParam();
44 void TraceScreenPos(
float width,
float height, out vector dir, out
float traceCoef)
47 dir *= m_fMaxViewConeLength;
49 TraceParam trace =
new TraceParam();
51 m_Trace.End = pos + dir;
53 traceCoef = Math.Max(
m_World.TraceMove(m_Trace,
null), traceCoef);
63 m_MapItem.SetPos(param.transform[3][0], param.transform[3][2]);
64 m_MapItem.SetAngle(param.rotOriginal[0] + param.rotDelta[0]);
68 m_MapCanvas = CanvasWidget.Cast(
m_MapEntity.GetMapMenuRoot().FindWidget(m_sMapCanvasWidgetName));
78 vector dirLeft, dirRight;
79 TraceScreenPos(widthLeft, height, dirLeft, traceCoef);
80 TraceScreenPos(widthRight, height, dirRight, traceCoef);
83 vector posCam = param.transform[3];
84 vector posLeft = posCam + dirLeft * traceCoef;
85 vector posRight = posCam + dirRight * traceCoef;
87 int posCamX, posCamY, posLeftX, posLeftY, posRightX, posRightY;
89 m_MapEntity.WorldToScreenCustom(posCam[0], posCam[2], posCamX, posCamY, mapZoom,
true);
90 m_MapEntity.WorldToScreenCustom(posLeft[0], posLeft[2], posLeftX, posLeftY, mapZoom,
true);
91 m_MapEntity.WorldToScreenCustom(posRight[0], posRight[2], posRightX, posRightY, mapZoom,
true);
94 m_DrawLine.m_Vertices = {posCamX, posCamY, posLeftX, posLeftY, posRightX, posRightY};
95 m_MapCanvas.SetDrawCommands(m_MapDrawCommands);
99 override bool EOnCameraInit()
110 props.SetFrontColor(m_IconColor);
111 props.SetOutlineColor(Color.FromInt(Color.BLACK));
112 props.SetIconSize(1, m_fIconScale, m_fIconScale);
113 props.Activate(
true);
116 m_DrawLine.m_iColor = m_ViewConeColor.PackToInt();
120 m_Trace =
new TraceParam();
121 m_Trace.Flags = TraceFlags.WORLD | TraceFlags.OCEAN;
127 override void EOnCameraExit()