4 protected bool m_bIsInit;
5 protected Widget m_wOwnSquadBackground;
6 protected Widget m_wOwnSquadIcon;
7 protected Widget m_wOwnSquadIconGlow;
8 protected Widget m_wGroupInfo;
9 protected Widget m_wGroupInfoList;
10 protected TextWidget m_wGroupFrequency;
12 protected ref array<Widget> m_aGroupMemberEntries = {};
14 [
Attribute(
"{CCD81F58E9D6EEA6}UI/layouts/Map/MapMarkerGroupInfo.layout",
desc:
"group info layout")]
15 protected ResourceName m_sGroupInfoLayout;
17 [
Attribute(
"{B09864CA15145CD3}UI/layouts/Map/MapMarkerGroupInfoLine.layout",
desc:
"group info line layout")]
18 protected ResourceName m_sLineLayout;
21 protected string m_sLineTextWidgetName;
24 protected string m_sLineIconWidgetName;
27 protected int m_iGroupInfoOffset;
32 void SetGroupActive(
bool state,
string factionName =
string.Empty)
34 Color iconColor = Color.FromInt(Color.BLACK);
50 m_wOwnSquadBackground.SetVisible(
false);
51 m_wOwnSquadIcon.SetVisible(
false);
52 m_wOwnSquadIconGlow.SetVisible(
false);
63 void UpdateGroupInfoPosition(
int screenX,
int screenY)
66 FrameSlot.SetPos(m_wGroupInfo,
GetGame().GetWorkspace().DPIUnscale(screenX),
GetGame().GetWorkspace().DPIUnscale(screenY) - m_iGroupInfoOffset);
70 override bool OnMouseButtonDown(Widget w,
int x,
int y,
int button)
81 override bool OnMouseEnter(Widget w,
int x,
int y)
83 m_MarkerEnt.LayerChangeLogic(0);
85 SCR_AIGroup group = SCR_MapMarkerSquadLeader.Cast(m_MarkerEnt).GetGroup();
90 m_wGroupInfo =
GetGame().GetWorkspace().CreateWidgets(m_sGroupInfoLayout,
m_wRoot.GetParent());
94 m_wGroupInfoList = m_wGroupInfo.FindAnyWidget(
"groupInfoList");
95 m_wGroupFrequency = TextWidget.Cast(m_wGroupInfo.FindAnyWidget(
"groupFrequency"));
97 int capacity = group.GetMaxMembers();
99 for (
int i = 0; i < capacity; i++)
101 m_aGroupMemberEntries.Insert(
GetGame().GetWorkspace().CreateWidgets(m_sLineLayout, m_wGroupInfoList));
107 float fFrequency = Math.Round(group.GetRadioFrequency() * 0.1) * 0.01;
108 m_wGroupFrequency.SetText(fFrequency.ToString(3, 1));
110 int playerCount = group.GetPlayerCount();
111 array<int> membersCopy = {};
112 membersCopy.Copy(group.GetPlayerIDs());
115 int leaderID = group.GetLeaderID();
118 foreach (
int id : membersCopy)
122 Widget entry = m_aGroupMemberEntries[0];
123 TextWidget txtW = TextWidget.Cast(entry.FindWidget(m_sLineTextWidgetName));
124 txtW.SetText(pManager.GetPlayerName(
id));
125 entry.SetVisible(
true);
128 txtW.SetColor(GUIColors.ORANGE);
130 txtW.SetColor(GUIColors.DEFAULT);
132 ImageWidget imgW = ImageWidget.Cast(entry.FindWidget(m_sLineIconWidgetName));
135 membersCopy.RemoveItem(
id);
141 foreach (
int i, Widget entry : m_aGroupMemberEntries)
148 TextWidget txtW = TextWidget.Cast(entry.FindWidget(m_sLineTextWidgetName));
149 txtW.SetText(pManager.GetPlayerName(membersCopy[i-1]));
150 entry.SetVisible(
true);
153 txtW.SetColor(GUIColors.ORANGE);
155 txtW.SetColor(GUIColors.DEFAULT);
157 ImageWidget imgW = ImageWidget.Cast(entry.FindWidget(m_sLineIconWidgetName));
163 entry.SetVisible(
false);
166 m_wGroupInfo.SetVisible(
true);
175 override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
177 m_wGroupInfo.SetVisible(
false);
180 m_MarkerEnt.LayerChangeLogic(m_iLayerID);
186 override void HandlerAttached(Widget w)
188 super.HandlerAttached(w);
190 m_wOwnSquadBackground =
m_wRoot.FindAnyWidget(
"OwnSquadBackground");
191 m_wOwnSquadIcon =
m_wRoot.FindAnyWidget(
"OwnSquadIcon");
192 m_wOwnSquadIconGlow =
m_wRoot.FindAnyWidget(
"OwnSquadIconGlow");