Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_StatesEditorComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Editor", description: "", icon: "WBData/ComponentEditorProps/componentEditor.png")]
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;
19 protected bool m_bIsSafeDialog;
20
26 {
27 return m_State == m_DefaultState;
28 }
29
34 {
35 return m_State;
36 }
37
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 }
54
59 {
60 if (m_State == state) SetState(m_DefaultState);
61 }
62
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 }
88
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 }
113
119 {
120 return m_bIsWaiting;
121 }
122
126 void SetSafeDialog(bool value)
127 {
128 m_bIsSafeDialog = value
129 }
130
136 {
137 return Event_OnStateChange;
138 }
139
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};
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
int Type
proto external bool IsActive()
void SCR_BaseEditorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
bool CanSet(EEditorState state)
void UnsetState(EEditorState state)
bool SetState(EEditorState state)
override void EOnEditorDebug(array< string > debugTexts)
SCR_FieldOfViewSettings Attribute
EEditorState
Unique editor state.
Definition EEditorState.c:6
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134