Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MenuLayoutEditorComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Editor", description: "Layout for in-game editor. Works only with SCR_EditorBaseEntity!", icon: "WBData/ComponentEditorProps/componentEditor.png")]
3 {
4  [Attribute(category: "Editable Entity UI")]
5  protected ref SCR_EditableEntityUIConfig m_EditableEntityUI;
6 
7  SCR_EditableEntityUIConfig GetEditableEntityUI()
8  {
9  return m_EditableEntityUI;
10  }
11 };
12 
16 {
17  [Attribute("", UIWidgets.ResourceNamePicker, "", "layout")]
18  protected ResourceName m_AlwaysShownLayout;
19 
20  [Attribute("", UIWidgets.ResourceNamePicker, "", "layout")]
21  protected ResourceName m_HideableLayout;
22 
23  protected Widget m_AlwaysShownWidget;
24  protected Widget m_HideableWidget;
25  protected SCR_CursorEditorUIComponent m_CursorComponent;
26 
31  SCR_EditableEntityUIConfig GetEditableEntityUI()
32  {
34  if (prefabData)
35  return prefabData.GetEditableEntityUI();
36  else
37  return null;
38  }
39 
46  bool GetCursorWorldPos(out vector worldPos, TraceFlags flags = -1)
47  {
49  return m_CursorComponent.GetCursorWorldPos(worldPos, flags: flags);
50  else
51  return false;
52  }
58  IEntity GetTraceEntity()
59  {
61  return m_CursorComponent.GetTraceEntity();
62  else
63  return null;
64  }
65 
66  override void EOnEditorPostActivate()
67  {
69  if (!menuEditor)
70  {
71  Print("SCR_MenuLayoutEditorComponent requires SCR_MenuEditorComponent!", LogLevel.ERROR);
72  return;
73  }
74 
75  EditorMenuBase menu = menuEditor.GetMenu();
76  if (!menu) return;
77 
78  WorkspaceWidget workspace = GetGame().GetWorkspace();
79  if (!workspace) return;
80 
81  //--- Find widget which is parent for hiding - layout will be created under it, so it's hidden as well
82  m_AlwaysShownWidget = workspace.CreateWidgets(m_AlwaysShownLayout, menuEditor.GetMenuComponent().GetAlwaysShownWidget());
83  FrameSlot.SetAnchorMin(m_AlwaysShownWidget, 0, 0);
84  FrameSlot.SetAnchorMax(m_AlwaysShownWidget, 1, 1);
85  FrameSlot.SetOffsets(m_AlwaysShownWidget, 0, 0, 0, 0);
86 
87  m_HideableWidget = workspace.CreateWidgets(m_HideableLayout, menuEditor.GetMenuComponent().GetHideableWidget());
88  FrameSlot.SetAnchorMin(m_HideableWidget, 0, 0);
89  FrameSlot.SetAnchorMax(m_HideableWidget, 1, 1);
90  FrameSlot.SetOffsets(m_HideableWidget, 0, 0, 0, 0);
91 
92  //--- Get cursor component
93  m_CursorComponent = SCR_CursorEditorUIComponent.Cast(menu.GetRootComponent().FindComponent(SCR_CursorEditorUIComponent));
94 
95  //--- Fade in
96  //m_Widget.SetOpacity(0);
97  //AnimateWidget.Opacity(m_Widget, 1, 5);
98  }
99 
100  override void EOnEditorPostDeactivate()
101  {
102  if (m_AlwaysShownWidget)
103  {
104  m_AlwaysShownWidget.RemoveFromHierarchy();
105  m_AlwaysShownWidget = null;
106  }
107  if (m_HideableWidget)
108  {
109  m_HideableWidget.RemoveFromHierarchy();
110  m_HideableWidget = null;
111  }
112  }
113 };
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
SCR_CursorEditorUIComponent
Definition: SCR_CursorEditorUIComponent.c:3
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_MenuLayoutEditorComponentClass
Definition: SCR_MenuLayoutEditorComponent.c:2
SCR_BaseEditorComponent
Definition: SCR_BaseEditorComponent.c:119
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_MenuLayoutEditorComponent
Definition: SCR_MenuLayoutEditorComponent.c:15
EditorMenuBase
Definition: EditorMenuBase.c:7
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
SCR_BaseEditorComponentClass
Definition: SCR_BaseEditorComponent.c:2
m_CursorComponent
protected SCR_CursorEditorUIComponent m_CursorComponent
Definition: SCR_EntitiesEditorUIComponent.c:16
SCR_MenuEditorComponent
Definition: SCR_MenuEditorComponent.c:8
SCR_EditableEntityUIConfig
Definition: SCR_EntitiesEditorUIConfig.c:7
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180