7 [
Attribute(defvalue:
"0.8", uiwidget: UIWidgets.Slider,
params:
"0 1 0.01")]
8 protected float m_fLabelsDistance;
11 protected string m_sTextureWidgetName;
14 protected string m_sEastWidgetName;
17 protected string m_sSouthWidgetName;
20 protected string m_sWestWidgetName;
23 protected string m_sNorthWidgetName;
25 protected BaseWorld m_World;
26 protected ImageWidget m_TextureWidget;
27 protected ref map<Widget, float> m_Labels =
new map<Widget, float>;
33 void UpdateRotation(
float timeSlice)
36 m_World.GetCurrentCamera(transform);
37 float yaw = -Math3D.MatrixToAngles(transform)[0];
38 m_TextureWidget.SetRotation(yaw);
40 float yawRad = yaw * Math.DEG2RAD;
41 foreach (Widget label,
float angle: m_Labels)
45 m_fLabelsDistance * Math.Cos(yawRad + angle),
46 m_fLabelsDistance * Math.Sin(yawRad + angle)
51 override void HandlerAttachedScripted(Widget w)
59 m_TextureWidget = ImageWidget.Cast(w.FindAnyWidget(m_sTextureWidgetName));
60 if (!m_TextureWidget)
return;
62 m_Labels.Insert(w.FindAnyWidget(m_sEastWidgetName), 0);
63 m_Labels.Insert(w.FindAnyWidget(m_sSouthWidgetName), Math.PI * 0.5);
64 m_Labels.Insert(w.FindAnyWidget(m_sWestWidgetName), Math.PI);
65 m_Labels.Insert(w.FindAnyWidget(m_sNorthWidgetName), Math.PI * 1.5);
67 m_fLabelsDistance *= 0.5 * FrameSlot.GetSizeY(w);
69 menu.GetOnMenuUpdate().Insert(UpdateRotation);
71 override void HandlerDeattached(Widget w)
76 menu.GetOnMenuUpdate().Remove(UpdateRotation);