Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CommentEditableEntityUIComponent.c
Go to the documentation of this file.
2 {
3  protected static const string WIDGET_TEXT = "Text"; //--- ToDo: Don't hardcode
4  protected static const string WIDGET_ICON = "Icon"; //--- ToDo: Don't hardcode
5  protected static const string WIDGET_EXTENDED_ICON = "Icon_ExtendablePrefabs";
6  protected SCR_ContentBrowserEditorComponent m_ContentBrowserComponent;
7 
8  protected Widget m_wExtendedIcon;
9 
10  //------------------------------------------------------------------------------------------------
12  {
13  Widget widget = GetWidget();
14  if (!widget)
15  return;
16 
17  GenericEntity owner = entity.GetOwner();
18  if (!owner)
19  return;
20 
21  SCR_EditableCommentComponent comment = SCR_EditableCommentComponent.Cast(entity);
22  if (!comment)
23  return;
24 
25  TextWidget textWidget = TextWidget.Cast(widget.FindAnyWidget(WIDGET_TEXT));
26  if (textWidget)
27  comment.ApplyTo(textWidget);
28 
29  ImageWidget iconWidget = ImageWidget.Cast(widget.FindAnyWidget(WIDGET_ICON));
30  if (iconWidget)
31  comment.ApplyTo(iconWidget);
32 
34  if (!m_ContentBrowserComponent)
35  return;
36 
37  m_wExtendedIcon = GetWidget().FindAnyWidget(WIDGET_EXTENDED_ICON);
38  if (!m_wExtendedIcon)
39  return;
40 
41  SCR_CompositionSlotManagerComponent slotManager = SCR_CompositionSlotManagerComponent.GetInstance();
42  if (slotManager)
43  slotManager.GetOnEntityChanged().Insert(OnEntityChanged);
44 
45  if (slotManager)
46  m_wExtendedIcon.SetVisible(!slotManager.IsOccupied(owner) && m_ContentBrowserComponent.IsExtendedEntity(entity));
47  else
48  m_wExtendedIcon.SetVisible(false);
49  }
50 
51  //------------------------------------------------------------------------------------------------
54  void OnEntityChanged(SCR_CompositionSlotManagerComponent slotManager, IEntity slot)
55  {
56  if (!m_ContentBrowserComponent)
57  return;
58 
59  if (slot == GetEntity().GetOwnerScripted() && m_wExtendedIcon)
60  m_wExtendedIcon.SetVisible(!slotManager.IsOccupied(slot) && m_ContentBrowserComponent.IsExtendedEntity(m_Entity));
61  }
62 }
SCR_EditableEntityBaseSlotUIComponent
Definition: SCR_EditableEntityBaseSlotUIComponent.c:6
m_Entity
enum EAITargetInfoCategory m_Entity
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_ContentBrowserEditorComponent
Definition: SCR_ContentBrowserEditorComponent.c:16
SCR_BaseEditorComponent
Definition: SCR_BaseEditorComponent.c:119
SCR_BaseEditableEntityUIComponent
Definition: SCR_BaseEditableEntityUIComponent.c:8
SCR_UIInfo
Definition: SCR_UIInfo.c:7
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
GetEntity
IEntity GetEntity()
Definition: SpectateTargetComponent.c:16
GetOwnerScripted
override GenericEntity GetOwnerScripted()
Definition: SCR_EditableWorldEntityComponent.c:21
GetWidget
protected Widget GetWidget()
Definition: SCR_VonDisplay.c:155
SCR_CommentEditableEntityUIComponent
Definition: SCR_CommentEditableEntityUIComponent.c:1