8 protected float m_fMinMultiplier;
11 protected float m_fMaxMultiplier;
14 protected ResourceName m_Layout;
17 protected float m_fLayoutDuration;
19 protected float m_fMultiplier = 1;
20 protected TextWidget m_Widget;
21 protected float m_fWidgetAlpha;
22 protected ref ScriptInvoker m_OnSpeedChange =
new ScriptInvoker();
27 ScriptInvoker GetOnSpeedChange()
29 return m_OnSpeedChange;
33 protected void OnInputDeviceIsGamepad(
bool isGamepad)
37 m_Widget.SetVisible(
false);
41 protected void ManualCameraSpeedReset(
float value, EActionTrigger trigger)
51 protected void UpdateWidget()
53 if (!m_Widget)
return;
60 dec = Math.Round(1.0 / Math.Clamp(m_fMinMultiplier, 0.0, 1.0));
62 m_Widget.SetTextFormat(
"#AR-ValueUnit_Short_Multiplier", Math.Round(
m_fMultiplier * dec) / dec);
63 m_Widget.SetVisible(
true);
64 m_fWidgetAlpha = 1 + m_fLayoutDuration;
68 protected void FadeOutWidget(
float timeSlice)
70 if (!m_Widget || !m_Widget.IsVisible())
return;
72 m_fWidgetAlpha -= timeSlice;
73 if (m_fWidgetAlpha > 0)
75 m_Widget.SetOpacity(Math.Clamp(m_fWidgetAlpha, 0, 1));
79 m_Widget.SetVisible(
false);
92 if (
data.m_aValues && !
data.m_aValues.IsEmpty())
102 if (!param.isManualInputEnabled)
105 m_Widget.SetVisible(
false);
113 float inputValue =
GetInputManager().GetActionValue(
"ManualCameraSpeedAdjust");
116 inputValue = Math.Clamp(1 + inputValue * param.timeSlice, 0.5, 2);
127 FadeOutWidget(param.timeSlice);
131 override bool EOnCameraInit()
133 if (m_fMinMultiplier > 1 || m_fMaxMultiplier < 1)
135 Print(
"Value range in SCR_AdjustSpeedManualCameraComponent must contain 1!", LogLevel.ERROR);
137 GetGame().OnInputDeviceIsGamepadInvoker().Insert(OnInputDeviceIsGamepad);
139 GetInputManager().AddActionListener(
"ManualCameraSpeedReset", EActionTrigger.DOWN, ManualCameraSpeedReset);
146 override void EOnCameraExit()
148 GetGame().OnInputDeviceIsGamepadInvoker().Remove(OnInputDeviceIsGamepad);
150 GetInputManager().RemoveActionListener(
"ManualCameraSpeedReset", EActionTrigger.DOWN, ManualCameraSpeedReset);
152 if (m_Widget) m_Widget.RemoveFromHierarchy();