11 const float ADJUST_COOLDOWN = 0.175;
13 protected bool m_bIsDisabled;
14 protected bool m_bIsModifierActive;
15 protected float m_fAdjustCooldown;
16 protected float m_FrequencyListTimer;
21 protected SCR_VONController m_VONController;
30 void SetMenuDisabled(
bool state)
39 static string GetKnownChannel(
int frequency)
46 if (milFaction && milFaction.GetFactionRadioFrequency() == frequency)
47 return "#AR-Comm_PlatoonChannel";
50 if (!milFaction || !groupManager)
53 array<SCR_AIGroup> playableGroups = groupManager.GetPlayableGroupsByFaction(milFaction);
59 if (group.GetRadioFrequency() == frequency)
61 string company, platoon, squad, character, format;
62 group.GetCallsigns(company, platoon, squad, character, format);
64 return WidgetManager.Translate(format, company, platoon, squad, character);
75 entry.SetName(entry.GetDisplayText());
89 entry.SetName(entry.GetName());
99 array<ref SCR_VONEntry> entries = {};
102 BaseRadioComponent radioComp = entry.GetTransceiver().GetRadio();
106 if (entry == entryVON)
110 if (radioEntry && radioEntry.GetTransceiver().GetRadio() == radioComp)
119 protected array<SCR_VONEntryRadio> GetGroupedEntries(notnull
SCR_VONEntryRadio entry)
121 array<SCR_VONEntryRadio> grouped = {};
122 array<ref SCR_VONEntry> entries = {};
125 BaseRadioComponent radioComp = entry.GetTransceiver().GetRadio();
129 if (entry == entryVON)
133 if (radioEntry && radioEntry.GetTransceiver().GetRadio() == radioComp)
134 grouped.Insert(radioEntry);
162 m_RadialController.SetEnableControl(
false);
166 m_RadialController.SetEnableControl(
true);
172 m_RadialController.SetEnableControl(
false);
179 m_RadialController.SetEnableControl(
false);
185 array<ref SCR_VONEntry> entries = {};
190 AddRadialEntry(entry);
197 dummy.SetIcon(
"{FDD5423E69D007F8}UI/Textures/Icons/icons_wrapperUI-128.imageset",
"VON_radio");
198 AddRadialEntry(dummy);
226 InputManager inputMgr =
GetGame().GetInputManager();
227 inputMgr.AddActionListener(
"VONMenuTuneFrequency", EActionTrigger.VALUE, ActionTuneFrequency);
228 inputMgr.AddActionListener(
"VONMenuCycleChannel", EActionTrigger.VALUE, ActionCycleChannel);
229 inputMgr.AddActionListener(
"VONMenuAction", EActionTrigger.DOWN, OnMenuToggle);
236 InputManager inputMgr =
GetGame().GetInputManager();
237 inputMgr.RemoveActionListener(
"VONMenuTuneFrequency", EActionTrigger.VALUE, ActionTuneFrequency);
238 inputMgr.RemoveActionListener(
"VONMenuCycleChannel", EActionTrigger.VALUE, ActionCycleChannel);
239 inputMgr.RemoveActionListener(
"VONMenuAction", EActionTrigger.DOWN, OnMenuToggle);
256 m_SelectedEntry.SetSelected(
false);
260 m_SelectedEntry.SetSelected(
true);
265 int grouped = GetGroupedRadioIndex(selected);
266 m_Display.MarkSegmentBackground(grouped);
267 m_Display.UpdateFrequencyList(selected);
269 if (!m_LastSelectedEntry || m_LastSelectedEntry.GetTransceiver().GetRadio() != selected.GetTransceiver().GetRadio())
271 m_Display.SetPreviewItem(selected.GetGadget().GetOwner());
272 m_Display.FadeItemPreview();
275 m_LastSelectedEntry = selected;
279 m_Display.MarkSegmentBackground(-1);
280 m_Display.SetFrequenciesVisible(
false);
282 m_Display.SetPreviewItem(
null);
283 m_LastSelectedEntry =
null;
291 protected void OnActiveEntriesChanged(
SCR_VONEntry entry,
bool isActive)
299 protected void OnAdjustEntry(
int input,
bool isModif)
304 m_Display.SetFrequenciesVisible(
true);
305 m_FrequencyListTimer = 3;
310 entry.AdjustEntryModif(input);
312 entry.AdjustEntry(input);
318 m_Display.UpdateFrequencyList(radioEntry);
319 radioEntry.SetChannelText(GetKnownChannel(radioEntry.GetEntryFrequency()));
326 protected void ActionTuneFrequency(
float value, EActionTrigger reason)
332 OnAdjustEntry(-1,
true);
334 OnAdjustEntry(1,
true);
339 protected void ActionCycleChannel(
float value, EActionTrigger reason)
345 OnAdjustEntry(-1,
false);
347 OnAdjustEntry(1,
false);
352 protected void OnMenuToggle(
float value, EActionTrigger reason)
362 GetGame().GetCallqueue().CallLater(UpdateEntries, 150);
366 array<SCR_VONEntryRadio> grouped = GetGroupedEntries(radioEntry);
375 protected void UpdateEntries()
382 void Update(
float timeSlice)
390 m_fAdjustCooldown -= timeSlice;
392 if (m_FrequencyListTimer > 0)
394 m_FrequencyListTimer -= timeSlice;
395 if (m_FrequencyListTimer <= 0)
396 m_Display.SetFrequenciesVisible(
false);
402 void Init(SCR_VONController controllerVON)
406 m_VONController.GetOnEntriesActiveChangedInvoker().Insert(OnActiveEntriesChanged);
408 m_RadialController.GetOnInputOpen().Insert(OnInputOpenMenu);
409 m_RadialController.GetOnTakeControl().Insert(OnControllerTakeControl);
410 m_RadialController.GetOnControllerChanged().Insert(OnControllerChanged);