51 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/day_z_map.layout");
63 m_MapToolsContainer = layoutRoot.FindAnyWidget(
"Map_Tools_Container");
64 m_MapToolsContainer.GetScript(m_LegendResizer);
66 m_MapWidgetInstance =
MapWidget.Cast(layoutRoot.FindAnyWidget(
"Map"));
67 m_GPSMarker = layoutRoot.FindAnyWidget(
"GPSMarkerCircle");
68 m_GPSMarkerArrow =
ImageWidget.Cast(layoutRoot.FindAnyWidget(
"GPSMarkerArrow"));
69 m_UpperLegendContainer = layoutRoot.FindAnyWidget(
"Tools_Extra");
71 m_ToolsCompassBase = layoutRoot.FindAnyWidget(
"Tools_Compass_Base");
72 m_ToolsCompassArrow =
ImageWidget.Cast(layoutRoot.FindAnyWidget(
"Tools_Compass_Arrow"));
73 m_ToolsCompassAzimuth =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"Tools_Compass_Azimuth"));
74 m_ToolsGPSXText =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"Tools_GPS_X_Value"));
75 m_ToolsGPSYText =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"Tools_GPS_Y_Value"));
76 m_ToolsGPSElevationText =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"Tools_GPS_Elevation_Value"));
77 m_ToolsScaleContourText =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"Tools_Scale_Contour_Value"));
78 m_ToolsScaleCellSizeText =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"Tools_Scale_CellSize_Value"));
79 m_ToolsScaleCellSizeCanvas =
CanvasWidget.Cast(layoutRoot.FindAnyWidget(
"Tools_Scale_CellSize_Canvas"));
80 m_ToolbarPanel = layoutRoot.FindAnyWidget(
"toolbar_bg");
83 m_ToolsScaleCellSizeCanvas.GetSize(m_ToolScaleCellSizeCanvasWidth,
canvasHeight);
85 if (m_MapWidgetInstance)
97 m_MapWidgetInstance.SetScale(scale);
103 SetGPSMarkerVisibility(
false);
104 SetGPSDirectionVisibility(
false);
105 SetCompassUIVisibility(
false);
106 SetUpperLegendVisibility(
true);
110 m_MapNavigationBehaviour =
player.GetMapNavigationBehaviour();
111 if (m_MapNavigationBehaviour)
122 SetUpperLegendVisibility(
true);
125 SetGPSMarkerVisibility(
true);
126 m_MapWidgetInstance.SetMapPos(m_MapNavigationBehaviour.GetPositionReal());
132 SetCompassUIVisibility(
true);
133 SetUpperLegendVisibility(
true);
135 SetGPSDirectionVisibility(
true);
140 SetUpperLegendVisibility(
false);
144 m_MapMenuHandler =
new MapHandler(m_MapWidgetInstance);
154 m_MapToolsContainer.GetScreenPos(
x,
y);
155 m_ToolsContainerPos0[0] =
x;
156 m_ToolsContainerPos0[1] =
y;
218 m_ToolsScaleCellSizeCanvas.Clear();
222 if (m_MapWidgetInstance)
225 m_MapWidgetInstance.RemoveChild(m_Images);
229 m_ToolsScaleContourText.SetText(
string.Format(
"%1 m", m_MapWidgetInstance.GetContourInterval()));
236 if (m_MapNavigationBehaviour)
238 vector mapPos = m_MapWidgetInstance.MapToScreen(m_MapNavigationBehaviour.GetPositionReal());
239 float scale = 1 - m_MapWidgetInstance.GetScale();
248 m_GPSMarkerArrow.SetRotation(0, 0,
angle);
249 m_ToolsCompassArrow.SetRotation(0, 0,
angle);
250 m_ToolsCompassAzimuth.SetText(
string.Format(
"%1°",
angle));
256 m_GPSMarker.SetSize(scale * 100, scale * 100);
257 m_GPSMarkerArrow.SetSize(scale * 100, scale * 100);
265 if (
coords.Count() == m_MapNavigationBehaviour.DISPLAY_GRID_POS_MAX_CHARS_COUNT * 2 &&
coords[0] >= 0)
267 m_ToolsGPSXText.SetText(
string.Format(COORD_FORMAT,
coords[0],
coords[1],
coords[2]));
268 m_ToolsGPSYText.SetText(
string.Format(COORD_FORMAT,
coords[3],
coords[4],
coords[5]));
272 m_ToolsGPSXText.SetText(
"-.--");
273 m_ToolsGPSYText.SetText(
"-.--");
276 m_ToolsGPSElevationText.SetText(
string.Format(
"%1m",
Math.
Round(
player.GetPosition()[1])));
280 m_ToolsGPSXText.SetText(
"-.--");
281 m_ToolsGPSYText.SetText(
"-.--");
282 m_ToolsGPSElevationText.SetText(
"----m");
291 player.SetLastMapInfo(m_MapWidgetInstance.GetScale(), m_MapWidgetInstance.GetMapPos());
296 m_IsOpenning =
false;
392 float segmentLength = m_ToolScaleCellSizeCanvasWidth / SCALE_RULER_NUM_SEGMENTS;
395 for (
int i = 1;
i <= SCALE_RULER_NUM_SEGMENTS;
i++)
403 else if (
i == SCALE_RULER_NUM_SEGMENTS)
proto native vector Vector(float x, float y, float z)
Vector constructor from components.