Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EntityToolbarItemEditorUIComponent.c
Go to the documentation of this file.
2{
3 [Attribute()]
4 protected string m_sIconWidgetName;
5
6 [Attribute()]
7 protected string m_sNameWidgetName;
8
11
12 //------------------------------------------------------------------------------------------------
13 override void InitToolbarItem(Widget widget)
14 {
15 }
16
17 //------------------------------------------------------------------------------------------------
22 {
23 if (slotManager)
24 {
25 Widget slotWidget = widget.FindAnyWidget(m_sIconWidgetName);
26 if (slotWidget)
27 {
29 if (slot)
30 slotManager.InsertSlotExternal(entity, slot);
31 }
32 }
33 else
34 {
35 Debug.Error2(ToString(), string.Format("SCR_EditableEntitySlotManagerUIComponent UI component is missing on %1!", widget.GetName()));
36 }
37
38 SCR_UIInfo info = entity.GetInfo();
39 if (info)
40 {
41 m_NameWidget = TextWidget.Cast(widget.FindAnyWidget(m_sNameWidgetName));
42 if (m_NameWidget)
43 {
44 //--- Set name after a delay - GetPlayerID() would return incorrect value for newly created players
45 GetGame().GetCallqueue().CallLater(SetName, 1, false, entity);
46
47 //--- Add refresh event (e.g., when group identity changes)
48 if (entity.GetOnUIRefresh())
49 {
50 entity.GetOnUIRefresh().Insert(RefreshName);
51 m_Entity = entity;
52 }
53 }
54 }
55 }
56
57 //------------------------------------------------------------------------------------------------
58 protected void SetName(SCR_EditableEntityComponent entity)
59 {
60 int playerID = entity.GetPlayerID();
61 if (playerID > 0)
62 {
63 m_NameWidget.SetText(SCR_PlayerNamesFilterCache.GetInstance().GetPlayerDisplayName(playerID));
64 }
65 else
66 {
67 SCR_UIInfo info = entity.GetInfo();
68 if (info)
69 info.SetNameTo(m_NameWidget);
70 }
71 }
72
73 //------------------------------------------------------------------------------------------------
74 protected void RefreshName()
75 {
77 }
78
79 //------------------------------------------------------------------------------------------------
80 override void HandlerDeattached(Widget w)
81 {
82 super.HandlerDeattached(w);
83
84 if (m_Entity)
85 m_Entity.GetOnUIRefresh().Remove(RefreshName);
86 }
87}
ArmaReforgerScripted GetGame()
Definition game.c:1398
Definition Debug.c:13
SCR_UIInfo GetInfo(IEntity owner=null)
void InsertSlotExternal(SCR_EditableEntityComponent entity, SCR_EditableEntityBaseSlotUIComponent slot)
void SetEntity(SCR_EditableEntityComponent entity, Widget widget, SCR_EditableEntitySlotManagerUIComponent slotManager)
SCR_FieldOfViewSettings Attribute
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.