@@ -29,16 +29,17 @@ public class MpfGamelogicEngine : MonoBehaviour, IGamelogicEngine
29
29
{
30
30
public string Name { get ; } = "Mission Pinball Framework" ;
31
31
32
- public GamelogicEngineSwitch [ ] AvailableSwitches => availableSwitches ;
33
- public GamelogicEngineCoil [ ] AvailableCoils => availableCoils ;
34
- public GamelogicEngineLamp [ ] AvailableLamps => availableLamps ;
32
+ public GamelogicEngineSwitch [ ] RequestedSwitches => requiredSwitches ;
33
+ public GamelogicEngineCoil [ ] RequestedCoils => requiredCoils ;
34
+ public GamelogicEngineLamp [ ] RequestedLamps => requiredLamps ;
35
35
public GamelogicEngineWire [ ] AvailableWires => availableWires ;
36
+
36
37
public event EventHandler < EventArgs > OnStarted ;
37
38
public event EventHandler < LampEventArgs > OnLampChanged ;
38
39
public event EventHandler < LampsEventArgs > OnLampsChanged ;
39
40
public event EventHandler < LampColorEventArgs > OnLampColorChanged ;
40
41
public event EventHandler < CoilEventArgs > OnCoilChanged ;
41
- public event EventHandler < AvailableDisplays > OnDisplaysAvailable ;
42
+ public event EventHandler < RequestedDisplays > OnDisplaysRequested ;
42
43
public event EventHandler < DisplayFrameData > OnDisplayFrame ;
43
44
public event EventHandler < SwitchEventArgs2 > OnSwitchChanged ;
44
45
@@ -47,9 +48,9 @@ public class MpfGamelogicEngine : MonoBehaviour, IGamelogicEngine
47
48
48
49
public string machineFolder ;
49
50
50
- [ SerializeField ] private GamelogicEngineSwitch [ ] availableSwitches = Array . Empty < GamelogicEngineSwitch > ( ) ;
51
- [ SerializeField ] private GamelogicEngineCoil [ ] availableCoils = Array . Empty < GamelogicEngineCoil > ( ) ;
52
- [ SerializeField ] private GamelogicEngineLamp [ ] availableLamps = Array . Empty < GamelogicEngineLamp > ( ) ;
51
+ [ SerializeField ] private GamelogicEngineSwitch [ ] requiredSwitches = Array . Empty < GamelogicEngineSwitch > ( ) ;
52
+ [ SerializeField ] private GamelogicEngineCoil [ ] requiredCoils = Array . Empty < GamelogicEngineCoil > ( ) ;
53
+ [ SerializeField ] private GamelogicEngineLamp [ ] requiredLamps = Array . Empty < GamelogicEngineLamp > ( ) ;
53
54
[ SerializeField ] private GamelogicEngineWire [ ] availableWires = Array . Empty < GamelogicEngineWire > ( ) ;
54
55
55
56
private Player _player ;
@@ -68,16 +69,16 @@ public void OnInit(Player player, TableApi tableApi, BallManager ballManager)
68
69
{
69
70
_player = player ;
70
71
_switchIds . Clear ( ) ;
71
- foreach ( var sw in availableSwitches ) {
72
+ foreach ( var sw in requiredSwitches ) {
72
73
_switchIds [ sw . Id ] = sw . InternalId ;
73
74
_switchNames [ sw . InternalId . ToString ( ) ] = sw . Id ;
74
75
}
75
76
_coilNames . Clear ( ) ;
76
- foreach ( var coil in availableCoils ) {
77
+ foreach ( var coil in requiredCoils ) {
77
78
_coilNames [ coil . InternalId . ToString ( ) ] = coil . Id ;
78
79
}
79
80
_lampNames . Clear ( ) ;
80
- foreach ( var lamp in availableLamps ) {
81
+ foreach ( var lamp in requiredLamps ) {
81
82
_lampNames [ lamp . InternalId . ToString ( ) ] = lamp . Id ;
82
83
}
83
84
_api = new MpfApi ( machineFolder ) ;
@@ -144,9 +145,9 @@ public void GetMachineDescription()
144
145
}
145
146
146
147
if ( md != null ) {
147
- availableSwitches = md . GetSwitches ( ) . ToArray ( ) ;
148
- availableCoils = md . GetCoils ( ) . ToArray ( ) ;
149
- availableLamps = md . GetLights ( ) . ToArray ( ) ;
148
+ requiredSwitches = md . GetSwitches ( ) . ToArray ( ) ;
149
+ requiredCoils = md . GetCoils ( ) . ToArray ( ) ;
150
+ requiredLamps = md . GetLights ( ) . ToArray ( ) ;
150
151
}
151
152
}
152
153
@@ -271,8 +272,8 @@ private void OnDmdFrame(object sender, SetDmdFrameRequest frame)
271
272
foreach ( var dmd in config . Dmds ) {
272
273
Logger . Info ( $ "[MPF] Announcing display \" { dmd . Name } \" @ { dmd . Width } x{ dmd . Height } ") ;
273
274
lock ( _dispatchQueue ) {
274
- _dispatchQueue . Enqueue ( ( ) => OnDisplaysAvailable ? . Invoke ( this ,
275
- new AvailableDisplays ( new DisplayConfig ( dmd . Name , dmd . Width , dmd . Height , true ) ) ) ) ;
275
+ _dispatchQueue . Enqueue ( ( ) => OnDisplaysRequested ? . Invoke ( this ,
276
+ new RequestedDisplays ( new DisplayConfig ( dmd . Name , dmd . Width , dmd . Height , true ) ) ) ) ;
276
277
}
277
278
}
278
279
Logger . Info ( "[MPF] Displays announced." ) ;
0 commit comments