Skip to content

Commit 9ac2e58

Browse files
committed
api: Fix names.
1 parent ae02439 commit 9ac2e58

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

VisualPinball.Engine.PinMAME.Unity/Editor/PinMameGamelogicEngineInspector.cs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
using PinMame;
2323
using UnityEditor;
2424
using UnityEngine;
25-
using VisualPinball.Engine.Common;
26-
using VisualPinball.Engine.Game.Engines;
2725
using VisualPinball.Engine.PinMAME.Games;
2826
using VisualPinball.Unity;
2927
using VisualPinball.Unity.Editor;
@@ -43,7 +41,7 @@ public class PinMameGamelogicEngineInspector : UnityEditor.Editor
4341
private int _selectedGameIndex;
4442
private int _selectedRomIndex;
4543

46-
private TableAuthoring _tableAuthoring;
44+
private TableComponent _tableComponent;
4745

4846
private PinMameRom Rom => _gle.Game.Roms[_selectedRomIndex];
4947

@@ -62,7 +60,7 @@ private void OnEnable()
6260
.ToArray();
6361

6462
if (_gle != null) {
65-
_tableAuthoring = _gle.gameObject.GetComponentInParent<TableAuthoring>();
63+
_tableComponent = _gle.gameObject.GetComponentInParent<TableComponent>();
6664
}
6765

6866
if (IsGameSet) {
@@ -124,13 +122,13 @@ public override void OnInspectorGUI()
124122
//EditorGUI.BeginDisabledGroup(!IsGameSet || Application.isPlaying);
125123
if (GUILayout.Button("Populate Hardware")) {
126124
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")) {
127-
_tableAuthoring.RepopulateHardware(_gle);
125+
_tableComponent.RepopulateHardware(_gle);
128126
TableSelector.Instance.TableUpdated();
129127
SceneView.RepaintAll();
130128
}
131129
}
132130
if (GUILayout.Button("Create Displays")) {
133-
var sceneDisplays = FindObjectsOfType<DisplayAuthoring>();
131+
var sceneDisplays = FindObjectsOfType<DisplayComponent>();
134132
if (sceneDisplays.Length > 0) {
135133
if (EditorUtility.DisplayDialog("PinMAME", "This will re-position all your displays, if you have any. You sure you want to do that?", "Yes", "No")) {
136134
CreateDisplays(sceneDisplays);
@@ -144,24 +142,24 @@ public override void OnInspectorGUI()
144142
//EditorGUI.EndDisabledGroup();
145143
}
146144

147-
private void CreateDisplays(IEnumerable<DisplayAuthoring> sceneDisplays)
145+
private void CreateDisplays(IEnumerable<DisplayComponent> sceneDisplays)
148146
{
149147
// retrieve layouts from pinmame
150148
var pinMame = PinMame.PinMame.Instance(AudioSettings.outputSampleRate);
151149
var displayLayouts = pinMame.GetAvailableDisplays(_gle.romId);
152150

153151
// retrieve already existing displays from scene
154-
var displayGameObjects = new Dictionary<string, DisplayAuthoring>();
152+
var displayGameObjects = new Dictionary<string, DisplayComponent>();
155153
foreach (var displays in sceneDisplays) {
156154
displayGameObjects[displays.Id] = displays;
157155
}
158-
var ta = _gle.GetComponentInParent<TableAuthoring>();
159-
var pa = _gle.GetComponentInChildren<PlayfieldAuthoring>();
156+
var ta = _gle.GetComponentInParent<TableComponent>();
157+
var pa = _gle.GetComponentInChildren<PlayfieldComponent>();
160158
var tableHeight = 0f;
161159
var tableWidth = 1f;
162160
if (ta) {
163-
tableHeight = pa.GlassHeight * PlayfieldAuthoring.GlobalScale;
164-
tableWidth = pa.Width * PlayfieldAuthoring.GlobalScale;
161+
tableHeight = pa.GlassHeight * PlayfieldComponent.GlobalScale;
162+
tableWidth = pa.Width * PlayfieldComponent.GlobalScale;
165163
}
166164

167165
// get total height
@@ -195,8 +193,8 @@ private void CreateDisplays(IEnumerable<DisplayAuthoring> sceneDisplays)
195193

196194
if (layout.IsDmd) {
197195
var auth = !displayGameObjects.ContainsKey(id)
198-
? go.AddComponent<DotMatrixDisplayAuthoring>()
199-
: go.GetComponent<DotMatrixDisplayAuthoring>();
196+
? go.AddComponent<DotMatrixDisplayComponent>()
197+
: go.GetComponent<DotMatrixDisplayComponent>();
200198

201199
auth.Id = id;
202200
auth.Width = layout.Width;
@@ -208,8 +206,8 @@ private void CreateDisplays(IEnumerable<DisplayAuthoring> sceneDisplays)
208206

209207
} else {
210208
var auth = !displayGameObjects.ContainsKey(id)
211-
? go.AddComponent<SegmentDisplayAuthoring>()
212-
: go.GetComponent<SegmentDisplayAuthoring>();
209+
? go.AddComponent<SegmentDisplayComponent>()
210+
: go.GetComponent<SegmentDisplayComponent>();
213211

214212
auth.Id = id;
215213
auth.NumChars = layout.Length;

VisualPinball.Engine.PinMAME.Unity/Runtime/PinMameGamelogicEngine.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@
2020

2121
using System;
2222
using System.Collections.Generic;
23-
using System.IO;
24-
using System.Diagnostics;
25-
using System.IO;
2623
using System.Linq;
2724
using System.Runtime.InteropServices;
2825
using NLog;
2926
using PinMame;
3027
using UnityEngine;
3128
using VisualPinball.Engine.Game.Engines;
3229
using VisualPinball.Unity;
33-
using Debug = UnityEngine.Debug;
3430
using Logger = NLog.Logger;
3531

3632
namespace VisualPinball.Engine.PinMAME
@@ -57,7 +53,7 @@ public PinMameGame Game {
5753
public GamelogicEngineSwitch[] AvailableSwitches {
5854
get {
5955
UpdateCaches();
60-
return _game?.AvailableSwitches ?? new GamelogicEngineSwitch[0];
56+
return _game?.AvailableSwitches ?? Array.Empty<GamelogicEngineSwitch>();
6157
}
6258
}
6359
public GamelogicEngineCoil[] AvailableCoils {
@@ -118,7 +114,7 @@ private void Start()
118114
{
119115
UpdateCaches();
120116

121-
_lastAudioFrame = new float[0];
117+
_lastAudioFrame = Array.Empty<float>();
122118
_lastAudioFrameOffset = 0;
123119
}
124120

@@ -357,7 +353,7 @@ private void OnAudioFilterRead(float[] data, int channels)
357353
Buffer.BlockCopy(_lastAudioFrame, _lastAudioFrameOffset * size, data, 0, lastFrameSize * size);
358354
dataOffset += lastFrameSize;
359355
}
360-
_lastAudioFrame = new float[0];
356+
_lastAudioFrame = Array.Empty<float>();
361357
_lastAudioFrameOffset = 0;
362358

363359
lock (_audioQueue) {

0 commit comments

Comments
 (0)