private void ConfigurePlayer(Dictionary <string, IMainComponent> components) { // add the player script and default game engine _tableGo.AddComponent <Player>(); _tableGo.AddComponent <BallRollerComponent>(); var dga = _tableGo.AddComponent <DefaultGamelogicEngine>(); // populate hardware _tableComponent.RepopulateHardware(dga); }
public override void OnInspectorGUI() { // game dropdown //_gle.romId = EditorGUILayout.TextField("ROM ID", _gle.romId); EditorGUI.BeginChangeCheck(); _selectedGameIndex = EditorGUILayout.Popup("Game", _selectedGameIndex, _gameNames); if (EditorGUI.EndChangeCheck()) { _selectedRomIndex = 0; if (_selectedGameIndex > 0) { _gle.Game = _games[_selectedGameIndex - 1]; _gle.romId = Rom.Id; _romNames = _gle.Game.Roms.Select(g => g.ToString()).ToArray(); } else { _gle.Game = null; _gle.romId = string.Empty; _romNames = Array.Empty <string>(); } } //rom dropdown EditorGUI.BeginDisabledGroup(_gle.Game == null); EditorGUI.BeginChangeCheck(); _selectedRomIndex = EditorGUILayout.Popup("ROM", _selectedRomIndex, _romNames); if (EditorGUI.EndChangeCheck()) { _gle.romId = Rom.Id; } // info label EditorGUILayout.LabelField("ROM ID", _gle.romId); EditorGUI.EndDisabledGroup(); GUILayout.BeginVertical(); if (_toggleStartup = EditorGUILayout.BeginFoldoutHeaderGroup(_toggleStartup, "Startup")) { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(_disableMechsProperty, new GUIContent("Disable Mechs")); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } EditorGUI.BeginChangeCheck(); var cellRect = EditorGUILayout.GetControlRect(); var labelRect = cellRect; labelRect.x += labelRect.width - 20; labelRect.width = 20; var fieldRect = cellRect; fieldRect.width -= 25; EditorGUI.PropertyField(fieldRect, _solenoidDelayProperty, new GUIContent("Solenoid Delay")); GUI.Label(labelRect, "ms"); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } EditorGUI.indentLevel--; } EditorGUILayout.EndFoldoutHeaderGroup(); if (_toggleDebug = EditorGUILayout.BeginFoldoutHeaderGroup(_toggleDebug, "Debug")) { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(_disableAudioProperty, new GUIContent("Disable Audio")); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } EditorGUI.indentLevel--; } EditorGUILayout.EndFoldoutHeaderGroup(); GUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.Separator(); //EditorGUI.BeginDisabledGroup(!IsGameSet || Application.isPlaying); if (GUILayout.Button("Populate Hardware")) { if (EditorUtility.DisplayDialog("PinMAME", "This will clear all linked switches, coils and lamps and re-populate them. You sure you want to do that?", "Yes", "No")) { _tableComponent.RepopulateHardware(_gle); TableSelector.Instance.TableUpdated(); SceneView.RepaintAll(); } } if (GUILayout.Button("Create Displays")) { var sceneDisplays = FindObjectsOfType <DisplayComponent>(); if (sceneDisplays.Length > 0) { if (EditorUtility.DisplayDialog("PinMAME", "This will re-position all your displays, if you have any. You sure you want to do that?", "Yes", "No")) { CreateDisplays(sceneDisplays); SceneView.RepaintAll(); } } else { CreateDisplays(sceneDisplays); SceneView.RepaintAll(); } } //EditorGUI.EndDisabledGroup(); }