12 [
RplProp(onRplName:
"OnUpdateType")]
16 protected int m_iConfigID = -1;
18 [
RplProp(condition: RplCondition.NoOwner, onRplName:
"OnUpdatePosition")]
19 protected vector m_vPos;
21 [
RplProp(onRplName:
"OnUpdateVisibility")]
22 protected bool m_bIsGlobalVisible;
24 protected bool m_bIsLocalVisible =
true;
25 protected int m_iScreenX;
26 protected int m_iScreenY;
27 protected float m_fUpdateDelay = 1;
28 protected float m_fTimeTracker;
30 protected string m_sText;
31 protected ResourceName m_sImageset;
32 protected string m_sIconName;
35 protected Widget m_wRoot;
40 protected IEntity m_Target;
41 protected Faction m_MarkerFaction;
47 protected void OnUpdateType()
54 protected void OnUpdatePosition()
59 protected void OnUpdateVisibility()
62 if (!mapEnt || !mapEnt.IsOpen() || mapEnt.GetMapUIComponent(
SCR_MapMarkersUI) ==
null)
75 void SetLocalVisible(
bool state)
77 m_bIsLocalVisible = state;
88 int GetMarkerConfigID()
94 void SetText(
string text)
106 void SetImage(
string imageset,
string icon)
108 m_sImageset = imageset;
113 void GetImageResource(out ResourceName imageset, out
string imageQuad)
115 imageset = m_sImageset;
116 imageQuad = m_sIconName;
135 m_iConfigID = configID;
137 Replication.BumpMe();
141 void SetGlobalVisible(
bool state)
143 m_bIsGlobalVisible = state;
144 OnUpdateVisibility();
145 Replication.BumpMe();
157 void SetTarget(IEntity target)
162 SetEventMask(EntityEvent.FRAME);
164 ClearEventMask(EntityEvent.FRAME);
170 return m_MarkerFaction;
174 void SetFaction(
Faction faction)
176 SCR_MapMarkerManagerComponent markerMgr = SCR_MapMarkerManagerComponent.GetInstance();
180 m_MarkerFaction = faction;
182 markerMgr.SetMarkerStreamRules(
this);
188 protected bool IsVisible()
190 return m_bIsGlobalVisible && m_bIsLocalVisible;
195 void OnCreateMarker()
213 m_wRoot =
GetGame().GetWorkspace().CreateWidgets(m_ConfigEntry.GetMarkerLayout(), mapFrame);
218 m_MarkerWidgetComp.SetMarkerEntity(
this);
219 m_ConfigEntry.InitClientSettingsDynamic(
this, m_MarkerWidgetComp);
234 protected void OnMapClosed(MapConfiguration config)
241 protected void OnMapLayerChanged(
int layerID)
243 if (m_MarkerWidgetComp)
244 m_MarkerWidgetComp.SetLayerID(layerID);
246 LayerChangeLogic(layerID);
250 void LayerChangeLogic(
int layerID)
252 if (m_ConfigEntry && m_MarkerWidgetComp)
253 m_ConfigEntry.OnMapLayerChangedDynamic(m_MarkerWidgetComp, layerID);
263 m_MapEntity.WorldToScreen(m_vPos[0], m_vPos[2], m_iScreenX, m_iScreenY,
true);
264 FrameSlot.SetPos(
m_wRoot,
GetGame().GetWorkspace().DPIUnscale(m_iScreenX),
GetGame().GetWorkspace().DPIUnscale(m_iScreenY));
270 override protected void EOnInit(IEntity owner)
272 SCR_MapMarkerManagerComponent markerMgr = SCR_MapMarkerManagerComponent.GetInstance();
276 markerMgr.RegisterDynamicMarker(
this);
278 BaseRplComponent rplComp = BaseRplComponent.Cast(FindComponent(BaseRplComponent));
279 if (rplComp.IsOwner())
281 SetFlags(EntityFlags.ACTIVE,
true);
282 SetEventMask(EntityEvent.FRAME);
290 override protected void EOnFrame(IEntity owner,
float timeSlice)
295 m_fTimeTracker += timeSlice;
300 Replication.BumpMe();
307 SetEventMask(EntityEvent.INIT);
316 SCR_MapMarkerManagerComponent markerMgr = SCR_MapMarkerManagerComponent.GetInstance();
318 markerMgr.UnregisterDynamicMarker(
this);