Skip to content

Commit 0a4b2f2

Browse files
committed
Add localPositions for the various panels in the Master UI Example Factory. Keeps them from appearing on top of each other.
1 parent f85973b commit 0a4b2f2

File tree

3 files changed

+28819
-28789
lines changed

3 files changed

+28819
-28789
lines changed

Assets/CreateThis/Scripts/Example/Editor/ExampleMasterUIFactoryEditor.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ public class ExampleMasterUIFactoryEditor : BaseFactoryEditor {
1010
SerializedProperty parent;
1111
SerializedProperty skyboxManager;
1212
SerializedProperty touchPadMenuController;
13+
SerializedProperty toolsLocalPosition;
14+
SerializedProperty keyboardLocalPosition;
15+
SerializedProperty fileOpenLocalPosition;
16+
SerializedProperty fileSaveAsLocalPosition;
1317

1418
protected override void OnEnable() {
1519
base.OnEnable();
1620
parent = serializedObject.FindProperty("parent");
1721
skyboxManager = serializedObject.FindProperty("skyboxManager");
1822
touchPadMenuController = serializedObject.FindProperty("touchPadMenuController");
23+
toolsLocalPosition = serializedObject.FindProperty("toolsLocalPosition");
24+
keyboardLocalPosition = serializedObject.FindProperty("keyboardLocalPosition");
25+
fileOpenLocalPosition = serializedObject.FindProperty("fileOpenLocalPosition");
26+
fileSaveAsLocalPosition = serializedObject.FindProperty("fileSaveAsLocalPosition");
1927
}
2028

2129
protected override void BuildGenerateButton() {
@@ -35,6 +43,10 @@ protected override void AdditionalProperties() {
3543
EditorGUILayout.PropertyField(parent);
3644
EditorGUILayout.PropertyField(skyboxManager);
3745
EditorGUILayout.PropertyField(touchPadMenuController);
46+
EditorGUILayout.PropertyField(toolsLocalPosition);
47+
EditorGUILayout.PropertyField(keyboardLocalPosition);
48+
EditorGUILayout.PropertyField(fileOpenLocalPosition);
49+
EditorGUILayout.PropertyField(fileSaveAsLocalPosition);
3850
}
3951
}
4052
}

Assets/CreateThis/Scripts/Example/ExampleMasterUIFactory.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ public class ExampleMasterUIFactory : BaseFactory {
1818
public GameObject parent;
1919
public ExampleSkyboxManager skyboxManager;
2020
public TouchPadMenuController touchPadMenuController;
21+
public Vector3 fileOpenLocalPosition = new Vector3(-1.329f, 0, 0);
22+
public Vector3 fileSaveAsLocalPosition = new Vector3(-0.754f, 0, 0);
23+
public Vector3 toolsLocalPosition = new Vector3(-0.3367146f, 0.3599027f, 0);
24+
public Vector3 keyboardLocalPosition = new Vector3(0.357f, 0, 0);
2125

2226
private GameObject disposable;
2327
private GameObject keyboardInstance;
@@ -33,6 +37,9 @@ private GameObject CreateKeyboard() {
3337
factory.parent = parent;
3438
GameObject panel = factory.Generate();
3539
keyboardInstance = panel;
40+
Vector3 localPosition = keyboardInstance.transform.localPosition;
41+
localPosition.x = keyboardLocalPosition.x;
42+
keyboardInstance.transform.localPosition = localPosition;
3643
keyboard = keyboardInstance.GetComponent<Keyboard>();
3744
return panel;
3845
}
@@ -43,6 +50,8 @@ private GameObject CreateFileSaveAs() {
4350
factory.keyboard = keyboard;
4451
GameObject panel = factory.Generate();
4552
fileSaveAsInstance = panel;
53+
GameObject fileSaveAsContainer = panel.transform.parent.gameObject;
54+
fileSaveAsContainer.transform.localPosition = fileSaveAsLocalPosition;
4655
fileSaveAs = fileSaveAsInstance.transform.Find("DrivesPanel").GetComponent<FileSaveAs>();
4756
return panel;
4857
}
@@ -52,6 +61,8 @@ private GameObject CreateFileOpen() {
5261
factory.parent = parent;
5362
GameObject panel = factory.Generate();
5463
fileOpenInstance = panel;
64+
GameObject fileOpenContainer = panel.transform.parent.gameObject;
65+
fileOpenContainer.transform.localPosition = fileOpenLocalPosition;
5566
fileOpen = fileOpenInstance.transform.Find("DrivesPanel").GetComponent<FileOpen>();
5667
return panel;
5768
}
@@ -64,6 +75,9 @@ private GameObject CreateToolsPanel() {
6475
factory.skyboxManager = skyboxManager;
6576
GameObject panel = factory.Generate();
6677
toolsInstance = panel;
78+
Vector3 localPosition = toolsInstance.transform.localPosition;
79+
localPosition.x = toolsLocalPosition.x;
80+
toolsInstance.transform.localPosition = localPosition;
6781

6882
#if UNITY_EDITOR
6983
var touchPadButtons = touchPadMenuController.touchPadButtons;

0 commit comments

Comments
 (0)