10 class SCR_CompareGroupRadioFreq : SCR_SortCompare<SCR_AIGroup>
14 return left.GetRadioFrequency() < right.GetRadioFrequency();
23 const ref Color ORANGE =
new Color(1.0, 0.5, 0, 0.05);
25 protected Widget m_wFrequencyDisplay;
27 protected TextWidget m_aChannelDisplay[3];
28 protected ImageWidget m_aIconDisplay[3];
29 protected TextWidget m_aFrequencyDisplay[3];
31 protected Widget m_wSizeLayout;
33 protected IEntity m_Item;
42 if (!groupManager || !factionManager)
44 SetFrequenciesVisible(
false);
48 Faction playerFaction = factionManager.GetLocalPlayerFaction();
51 SetFrequenciesVisible(
false);
55 array<SCR_AIGroup> playableGroups = {};
56 array<SCR_AIGroup> playableGroupsOrigin = groupManager.GetPlayableGroupsByFaction(playerFaction);
57 if (!playableGroupsOrigin)
59 SetFrequenciesVisible(
false);
63 int groupCount = playableGroups.Copy(playableGroupsOrigin);
64 SCR_Sorting<SCR_AIGroup, SCR_CompareGroupRadioFreq>.HeapSort(playableGroups);
68 if (!milFaction || milFaction.GetFactionRadioFrequency() == 0 || groupCount == 0)
70 SetFrequenciesVisible(
false);
74 int frequency = entry.GetEntryFrequency();
76 if (milFaction.GetFactionRadioFrequency() == frequency)
78 m_aChannelDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ORANGE);
79 m_aIconDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ORANGE);
80 m_aFrequencyDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ORANGE);
88 if (group.GetRadioFrequency() == frequency)
90 m_aChannelDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ORANGE);
91 m_aIconDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ORANGE);
92 m_aFrequencyDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ORANGE);
102 SetFrequencyDisplay(
EVONMenuTable.PREVIOUS,
null, milFaction);
103 SetFrequencyDisplay(
EVONMenuTable.CURRENT, playableGroups[0]);
110 m_aChannelDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ENABLED);
111 m_aIconDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ENABLED);
112 m_aFrequencyDisplay[
EVONMenuTable.CURRENT].SetColor(GUIColors.ENABLED);
121 SetFrequencyDisplay(
EVONMenuTable.PREVIOUS,
null, milFaction);
131 SetFrequencyDisplay(
EVONMenuTable.PREVIOUS, playableGroups[matchID - 1]);
133 if (groupCount > matchID + 1)
134 SetFrequencyDisplay(
EVONMenuTable.NEXT, playableGroups[matchID + 1]);
149 m_aChannelDisplay[line].SetText(
"#AR-Comm_PlatoonChannel");
150 m_aFrequencyDisplay[line].SetText((milFaction.GetFactionRadioFrequency() * 0.001).ToString() +
" #AR-VON_FrequencyUnits_MHz");
154 string company, platoon, squad, character, format;
155 group.GetCallsigns(company, platoon, squad, character, format);
156 m_aChannelDisplay[line].SetTextFormat(format, company, platoon, squad, character);
157 m_aFrequencyDisplay[line].SetText((group.GetRadioFrequency()*0.001).ToString() +
" #AR-VON_FrequencyUnits_MHz ");
160 m_aChannelDisplay[line].SetVisible(
true);
161 m_aIconDisplay[line].SetVisible(
true);
162 m_aFrequencyDisplay[line].SetVisible(
true);
168 m_aChannelDisplay[line].SetVisible(
false);
169 m_aIconDisplay[line].SetVisible(
false);
170 m_aFrequencyDisplay[line].SetVisible(
false);
176 void MarkSegmentBackground(
int id)
180 comp.GetBackgroundWidget().SetColor(Color.FromInt(Color.BLACK));
183 if (m_aSegments.IsIndexValid(
id))
184 m_aSegments[id].GetBackgroundWidget().SetColor(
ORANGE);
189 void SetPreviewItem(IEntity item)
192 m_wPreviewItem.SetVisible(item !=
null);
203 ItemPreviewManagerEntity manager = world.GetItemPreviewManager();
208 SetupPreviewAttributes(m_PreviewAttributes);
209 manager.SetPreviewItem(m_wPreviewItem, item, m_PreviewAttributes);
210 m_wPreviewItem.SetResolutionScale(1, 1);
228 void FadeItemPreview(
bool state =
true)
232 m_wPreviewItem.SetOpacity(0);
233 AnimateWidget.Opacity(m_wPreviewItem, 1, 1/0.3);
239 void SetFrequenciesVisible(
bool state)
242 AnimateWidget.Opacity(m_wFrequencyDisplay, 1, 1/0.3);
244 AnimateWidget.Opacity(m_wFrequencyDisplay, 0, 1/0.3);
252 if (m_wSelectedIndicatorFeedback)
254 m_wSelectedIndicatorFeedback.SetOpacity(0);
256 if (!AnimateWidget.IsAnimating(m_wSelectedIndicatorFeedback))
258 WidgetAnimationOpacity anim = AnimateWidget.Opacity(m_wSelectedIndicatorFeedback, CHANGE_CONTENT_OPACITY,
UIConstants.FADE_RATE_FAST);
259 anim.SetRepeat(
true);
260 anim.GetOnCycleCompleted().Insert(OnEntrySizeAnimCycleCompleted);
266 override void DisplayStartDraw(IEntity owner)
268 super.DisplayStartDraw(owner);
270 m_wFrequencyDisplay =
GetRootWidget().FindAnyWidget(
"FrequencyDisplay");
272 m_aChannelDisplay[
EVONMenuTable.PREVIOUS] = TextWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"ChannelUp"));
273 m_aChannelDisplay[
EVONMenuTable.CURRENT] = TextWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"ChannelCurrent"));
274 m_aChannelDisplay[
EVONMenuTable.NEXT] = TextWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"ChannelDown"));
276 m_aIconDisplay[
EVONMenuTable.PREVIOUS] = ImageWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"IconUp"));
277 m_aIconDisplay[
EVONMenuTable.CURRENT] = ImageWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"IconCurrent"));
278 m_aIconDisplay[
EVONMenuTable.NEXT] = ImageWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"IconDown"));
280 m_aFrequencyDisplay[
EVONMenuTable.PREVIOUS] = TextWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"FrequencyUp"));
281 m_aFrequencyDisplay[
EVONMenuTable.CURRENT] = TextWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"FrequencyCurrent"));
282 m_aFrequencyDisplay[
EVONMenuTable.NEXT] = TextWidget.Cast(m_wFrequencyDisplay.FindAnyWidget(
"FrequencyDown"));
287 SetFrequenciesVisible(
false);