Skip to content

Commit 021ef23

Browse files
committed
fix: InputsFocused checks for setting menu being open, as well as scene inputs
- Had to add a special case to allow for closing the menu again
1 parent 42c6d7a commit 021ef23

5 files changed

Lines changed: 27 additions & 14 deletions

File tree

Assets/Prefabs/UI/MainCanvas.prefab

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ MonoBehaviour:
196196
- {fileID: 0}
197197
- {fileID: 0}
198198
_whiteUIText: []
199-
_automaticControlPanelGameObject: {fileID: 0}
199+
_ephysCopilotPanelGameObject: {fileID: 0}
200+
_settingsPanel: {fileID: 341190943640726960}
200201
--- !u!1001 &313233569129278197
201202
PrefabInstance:
202203
m_ObjectHideFlags: 0

Assets/Scenes/TrajectoryPlanner.unity

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,15 +2205,15 @@ PrefabInstance:
22052205
objectReference: {fileID: 1703646459}
22062206
- target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
22072207
propertyPath: m_AnchorMax.y
2208-
value: 1
2208+
value: 0
22092209
objectReference: {fileID: 0}
22102210
- target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
22112211
propertyPath: m_AnchorMin.y
2212-
value: 1
2212+
value: 0
22132213
objectReference: {fileID: 0}
22142214
- target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
22152215
propertyPath: m_AnchoredPosition.x
2216-
value: 169.88
2216+
value: 0
22172217
objectReference: {fileID: 0}
22182218
- target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
22192219
propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target
@@ -2309,19 +2309,19 @@ PrefabInstance:
23092309
objectReference: {fileID: 1445581475}
23102310
- target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
23112311
propertyPath: m_AnchorMax.y
2312-
value: 1
2312+
value: 0
23132313
objectReference: {fileID: 0}
23142314
- target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
23152315
propertyPath: m_AnchorMin.y
2316-
value: 1
2316+
value: 0
23172317
objectReference: {fileID: 0}
23182318
- target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
23192319
propertyPath: m_AnchoredPosition.x
2320-
value: 354.84
2320+
value: 0
23212321
objectReference: {fileID: 0}
23222322
- target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
23232323
propertyPath: m_AnchoredPosition.y
2324-
value: -15
2324+
value: 0
23252325
objectReference: {fileID: 0}
23262326
- target: {fileID: 341190944083206642, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
23272327
propertyPath: m_Name
@@ -2545,19 +2545,19 @@ PrefabInstance:
25452545
objectReference: {fileID: 0}
25462546
- target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
25472547
propertyPath: m_AnchorMax.y
2548-
value: 1
2548+
value: 0
25492549
objectReference: {fileID: 0}
25502550
- target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
25512551
propertyPath: m_AnchorMin.y
2552-
value: 1
2552+
value: 0
25532553
objectReference: {fileID: 0}
25542554
- target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
25552555
propertyPath: m_AnchoredPosition.x
2556-
value: 384.91998
2556+
value: 0
25572557
objectReference: {fileID: 0}
25582558
- target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
25592559
propertyPath: m_AnchoredPosition.y
2560-
value: -15
2560+
value: 0
25612561
objectReference: {fileID: 0}
25622562
- target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
25632563
propertyPath: m_AnchorMax.y

Assets/Scripts/TrajectoryPlanner/TP_SettingsMenu.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public void ToggleSettingsMenu()
3838
foreach (TMP_InputField inputField in transform.GetComponentsInChildren<TMP_InputField>())
3939
{
4040
if (inputField.isFocused)
41+
{
42+
Debug.Log(inputField.name);
4143
return;
44+
}
4245
}
4346
_settingsMenuGo.SetActive(false);
4447
}

Assets/Scripts/TrajectoryPlanner/TrajectoryPlannerManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void Update()
225225
return;
226226
}
227227

228-
if (Input.GetKeyDown(KeyCode.H) && !UIManager.InputsFocused)
228+
if (Input.GetKeyDown(KeyCode.H))
229229
_settingsPanel.ToggleSettingsMenu();
230230

231231
if (Input.GetKeyDown(KeyCode.L) && !UIManager.InputsFocused)

Assets/Scripts/TrajectoryPlanner/UI/UIManager.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
public class UIManager : MonoBehaviour
88
{
9+
#region Static
10+
public static UIManager Instance;
11+
#endregion
12+
913
#region Components
1014

1115
[SerializeField] private List<TMP_InputField> _editorFocusableInputs;
@@ -16,6 +20,7 @@ public class UIManager : MonoBehaviour
1620
[SerializeField] private List<TMP_Text> _whiteUIText;
1721

1822
[SerializeField] private GameObject _ephysCopilotPanelGameObject;
23+
[SerializeField] private GameObject _settingsPanel;
1924

2025
#endregion
2126

@@ -29,13 +34,17 @@ public class UIManager : MonoBehaviour
2934

3035
private void Awake()
3136
{
37+
Instance = this;
38+
3239
FocusableInputs.UnionWith(_editorFocusableInputs);
3340
FocusableGOs.UnionWith(_editorFocusableGOs);
3441
}
3542

3643
public static bool InputsFocused
3744
{
38-
get { return FocusableInputs.Any(x => x != null && x.isFocused) || FocusableGOs.Any(x => x != null && x.activeSelf); }
45+
get {
46+
return Instance._settingsPanel.activeSelf || FocusableInputs.Any(x => x != null && x.isFocused) || FocusableGOs.Any(x => x != null && x.activeSelf);
47+
}
3948
}
4049

4150
public void EnableEphysCopilotPanel(bool enable = true)

0 commit comments

Comments
 (0)