Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_StatesEditorComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Editor", description: "", icon: "WBData/ComponentEditorProps/componentEditor.png")]
3 {
4 };
5 
10 {
11  [Attribute(desc: "Default state set every time other state is finished.", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EEditorState))]
12  private EEditorState m_DefaultState;
13 
14  private EEditorState m_State;
15  private bool m_bIsWaiting;
16  private ref ScriptInvoker Event_OnStateChange = new ScriptInvoker;
17  private ref ScriptInvoker Event_OnIsWaitingChange = new ScriptInvoker;
18  protected MenuBase m_MenuUponWaiting;
19  protected bool m_bIsSafeDialog;
20 
25  bool IsDefaultState()
26  {
27  return m_State == m_DefaultState;
28  }
33  EEditorState GetState()
34  {
35  return m_State;
36  }
41  bool SetState(EEditorState state)
42  {
43  if (state == m_State) return true;
44 
45  if (CanSet(state))
46  {
47  EEditorState statePrev = state;
48  m_State = state;
49  Event_OnStateChange.Invoke(state, statePrev);
50  return true;
51  }
52  return false;
53  }
58  void UnsetState(EEditorState state)
59  {
60  if (m_State == state) SetState(m_DefaultState);
61  }
66  bool CanSet(EEditorState state)
67  {
68  if (state == m_DefaultState) return true; //--- Always allow setting default
69  switch (state)
70  {
71  case EEditorState.NONE:
72  return true;
73 
74  case EEditorState.SELECTING:
75  return true;
76 
77  case EEditorState.MULTI_SELECTING:
78  return (m_State != EEditorState.PLACING && m_State != EEditorState.TRANSFORMING);
79 
80  case EEditorState.PLACING:
81  return true;
82 
83  case EEditorState.TRANSFORMING:
84  return (m_State != EEditorState.PLACING && m_State != EEditorState.MULTI_SELECTING);
85  }
86  return false;
87  }
93  bool SetIsWaiting(bool isWaiting)
94  {
95  if (isWaiting == m_bIsWaiting)
96  return true;
97 
98  bool result = true;
99  if (isWaiting)
100  {
101  m_MenuUponWaiting = GetGame().GetMenuManager().GetTopMenu();
102  }
103  else
104  {
105  result = (m_bIsSafeDialog || !GetGame().GetMenuManager().IsAnyDialogOpen()) && m_MenuUponWaiting == GetGame().GetMenuManager().GetTopMenu();
106  m_MenuUponWaiting = null;
107  }
108 
109  m_bIsWaiting = isWaiting;
110  Event_OnIsWaitingChange.Invoke(isWaiting);
111  return result;
112  }
118  bool IsWaiting()
119  {
120  return m_bIsWaiting;
121  }
126  void SetSafeDialog(bool value)
127  {
128  m_bIsSafeDialog = value
129  }
130 
135  ScriptInvoker GetOnStateChange()
136  {
137  return Event_OnStateChange;
138  }
143  ScriptInvoker GetOnIsWaitingChange()
144  {
145  return Event_OnIsWaitingChange;
146  }
147 
148  override void EOnEditorDebug(array<string> debugTexts)
149  {
150  if (!IsActive()) return;
151  debugTexts.Insert(string.Format("Editor State: %1", Type().EnumToString(EEditorState, m_State)));
152  }
153 };
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
EEditorState
EEditorState
Unique editor state.
Definition: EEditorState.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_BaseEditorComponent
Definition: SCR_BaseEditorComponent.c:119
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_BaseEditorComponentClass
Definition: SCR_BaseEditorComponent.c:2
m_State
private EEditableEntityState m_State
Definition: SCR_BaseEntitiesEditorUIEffect.c:3
SCR_StatesEditorComponent
Definition: SCR_StatesEditorComponent.c:9
SCR_StatesEditorComponentClass
Definition: SCR_StatesEditorComponent.c:2
IsActive
bool IsActive()
Definition: SCR_LoadoutSaveBlackListHolder.c:82
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180