3 [
Attribute(defvalue:
"1",
desc:
"How long it takes to toggle hovered entity automatically during entity transformation.")]
4 protected float m_fAutoEnterDuration;
6 [
Attribute(defvalue:
"0.2", uiwidget: UIWidgets.Slider,
"",
params:
"0 1 0.01")]
7 protected float m_fAutoEnterDelay;
15 protected float m_fAutoEnterCharge = -1;
16 protected bool m_bCanCharge =
true;
49 if (m_TransformingManager && m_TransformingManager.IsEditing(hoverEntity))
54 if (hoverEntity != m_AutoEnterTarget)
56 m_AutoEnterTarget = hoverEntity;
57 m_fAutoEnterCharge = 0;
62 protected void Clear()
64 m_fAutoEnterCharge = -1;
65 m_AutoEnterTarget =
null;
70 protected void ResetGracePeriod()
76 protected void OnMenuUpdate(
float tDelta)
79 if (m_fAutoEnterCharge >= 0)
82 m_fAutoEnterCharge += tDelta;
84 if (m_fAutoEnterCharge < m_fAutoEnterDelay)
90 if (m_RadialProgressUI)
91 m_RadialProgressUI.SetProgress(Math.InverseLerp(m_fAutoEnterDelay, 1, m_fAutoEnterCharge) / m_fAutoEnterDuration);
95 if (m_AutoEnterTarget.GetPos(worldPos))
97 vector screenPos =
GetGame().GetWorkspace().ProjWorldToScreen(worldPos, m_AutoEnterTarget.GetOwner().GetWorld());
98 FrameSlot.SetPos(
GetWidget(), screenPos[0], screenPos[1]);
102 if (m_fAutoEnterCharge > m_fAutoEnterDuration)
108 m_bCanCharge =
false;
109 GetGame().GetCallqueue().CallLater(ResetGracePeriod, 100);
115 override protected bool IsUnique()
121 override void HandlerAttachedScripted(Widget w)
123 super.HandlerAttachedScripted(w);
135 menu.GetOnMenuUpdate().Insert(OnMenuUpdate);
141 override void HandlerDeattached(Widget w)
143 super.HandlerDeattached(w);
150 menu.GetOnMenuUpdate().Remove(OnMenuUpdate);