Skip to content

Commit 8251713

Browse files
Add _ prefix to private and protected fields
1 parent 4607e42 commit 8251713

26 files changed

+246
-258
lines changed

Editor/BcpInterfaceInspector.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ namespace FutureBoxSystems.MpfMediaController
88
public class BcpInterfaceInspector : Editor
99
{
1010
[SerializeField]
11-
private VisualTreeAsset bcpInterfaceInspectorXml;
11+
private VisualTreeAsset _bcpInterfaceInspectorXml;
1212

13-
private TextField connectionStateField;
14-
private BcpInterface bcpInterface;
13+
private TextField _connectionStateField;
14+
private BcpInterface _bcpInterface;
1515

1616
public override VisualElement CreateInspectorGUI()
1717
{
18-
var ui = bcpInterfaceInspectorXml.Instantiate();
19-
connectionStateField = ui.Q<TextField>("connection-state");
20-
bcpInterface = target as BcpInterface;
21-
UpdateConnectionStateField(bcpInterface.ConnectionState);
22-
bcpInterface.ConnectionStateChanged += OnConnectionStateChanged;
18+
var ui = _bcpInterfaceInspectorXml.Instantiate();
19+
_connectionStateField = ui.Q<TextField>("connection-state");
20+
_bcpInterface = target as BcpInterface;
21+
UpdateConnectionStateField(_bcpInterface.ConnectionState);
22+
_bcpInterface.ConnectionStateChanged += OnConnectionStateChanged;
2323
return ui;
2424
}
2525

2626
private void OnDisable()
2727
{
28-
bcpInterface.ConnectionStateChanged -= OnConnectionStateChanged;
28+
_bcpInterface.ConnectionStateChanged -= OnConnectionStateChanged;
2929
}
3030

3131
private void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs args)
@@ -35,7 +35,7 @@ private void OnConnectionStateChanged(object sender, ConnectionStateChangedEvent
3535

3636
private void UpdateConnectionStateField(ConnectionState state)
3737
{
38-
connectionStateField.value = state.ToString();
38+
_connectionStateField.value = state.ToString();
3939
}
4040
}
4141
}

Editor/BcpInterfaceInspector.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/BcpInterfaceInspector.uxml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
22
<ui:TextField picking-mode="Ignore" label="Connection state" focusable="true" readonly="true" name="connection-state" class="unity-base-field__aligned" />
3-
<uie:PropertyField name="port" binding-path="port" label="Port" tooltip="The TCP port to use for communication with MPF" />
4-
<uie:PropertyField name="frame-time-budget-ms" binding-path="frameTimeBudgetMs" label="Frame Time Budget (Ms)" tooltip="Maximum time to spend handling messages from MPF per frame. Mostly to avoid freezing in case of a feedback loop." />
5-
<uie:PropertyField name="log-received-messages" binding-path="logReceivedMessages" label="Log Received Messages" />
6-
<uie:PropertyField name="log-sent-messages" binding-path="logSentMessages" label="Log Sent Messages" />
3+
<uie:PropertyField name="port" binding-path="_port" label="Port" tooltip="The TCP port to use for communication with MPF" />
4+
<uie:PropertyField name="frame-time-budget-ms" binding-path="_frameTimeBudgetMs" label="Frame Time Budget (Ms)" tooltip="Maximum time to spend handling messages from MPF per frame. Mostly to avoid freezing in case of a feedback loop." />
5+
<uie:PropertyField name="log-received-messages" binding-path="_logReceivedMessages" label="Log Received Messages" />
6+
<uie:PropertyField name="log-sent-messages" binding-path="_logSentMessages" label="Log Sent Messages" />
77
</ui:UXML>

Runtime/BcpInterface.prefab

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ MonoBehaviour:
6060
m_Script: {fileID: 11500000, guid: bf919a90a2e4ed040b8913ce8901228b, type: 3}
6161
m_Name:
6262
m_EditorClassIdentifier:
63-
bcpInterface: {fileID: 3405300645593462295}
63+
_bcpInterface: {fileID: 3405300645593462295}
6464
--- !u!114 &2199375185222848247
6565
MonoBehaviour:
6666
m_ObjectHideFlags: 0
@@ -73,7 +73,7 @@ MonoBehaviour:
7373
m_Script: {fileID: 11500000, guid: 6f9bc1ba9f51a604db49e1a6e7f59a86, type: 3}
7474
m_Name:
7575
m_EditorClassIdentifier:
76-
bcpInterface: {fileID: 3405300645593462295}
76+
_bcpInterface: {fileID: 3405300645593462295}
7777
--- !u!114 &615776641453573451
7878
MonoBehaviour:
7979
m_ObjectHideFlags: 0
@@ -86,7 +86,7 @@ MonoBehaviour:
8686
m_Script: {fileID: 11500000, guid: 7fd1ee0333546544b9c3dea71e6c20a7, type: 3}
8787
m_Name:
8888
m_EditorClassIdentifier:
89-
bcpInterface: {fileID: 3405300645593462295}
89+
_bcpInterface: {fileID: 3405300645593462295}
9090
--- !u!114 &1824319182504738973
9191
MonoBehaviour:
9292
m_ObjectHideFlags: 0
@@ -99,7 +99,7 @@ MonoBehaviour:
9999
m_Script: {fileID: 11500000, guid: 359cce4f412e2f24cad70a4f570fac5e, type: 3}
100100
m_Name:
101101
m_EditorClassIdentifier:
102-
bcpInterface: {fileID: 3405300645593462295}
102+
_bcpInterface: {fileID: 3405300645593462295}
103103
--- !u!114 &3006042140711521680
104104
MonoBehaviour:
105105
m_ObjectHideFlags: 0
@@ -112,7 +112,7 @@ MonoBehaviour:
112112
m_Script: {fileID: 11500000, guid: 63f2dd8dbb07c27498726c42cff3d4e7, type: 3}
113113
m_Name:
114114
m_EditorClassIdentifier:
115-
bcpInterface: {fileID: 3405300645593462295}
115+
_bcpInterface: {fileID: 3405300645593462295}
116116
--- !u!114 &4146686170121310886
117117
MonoBehaviour:
118118
m_ObjectHideFlags: 0
@@ -125,7 +125,7 @@ MonoBehaviour:
125125
m_Script: {fileID: 11500000, guid: 587867a0f90cc0947a58c70dd2a7eff6, type: 3}
126126
m_Name:
127127
m_EditorClassIdentifier:
128-
bcpInterface: {fileID: 3405300645593462295}
128+
_bcpInterface: {fileID: 3405300645593462295}
129129
--- !u!114 &7019407901035039939
130130
MonoBehaviour:
131131
m_ObjectHideFlags: 0
@@ -138,7 +138,7 @@ MonoBehaviour:
138138
m_Script: {fileID: 11500000, guid: 88948b8ed19a20e40a42d16e46c70610, type: 3}
139139
m_Name:
140140
m_EditorClassIdentifier:
141-
bcpInterface: {fileID: 3405300645593462295}
141+
_bcpInterface: {fileID: 3405300645593462295}
142142
--- !u!114 &642617651384461981
143143
MonoBehaviour:
144144
m_ObjectHideFlags: 0
@@ -151,7 +151,7 @@ MonoBehaviour:
151151
m_Script: {fileID: 11500000, guid: cdf1f7f6d8df17345ba92944c4fd5214, type: 3}
152152
m_Name:
153153
m_EditorClassIdentifier:
154-
bcpInterface: {fileID: 3405300645593462295}
154+
_bcpInterface: {fileID: 3405300645593462295}
155155
--- !u!114 &4203975233253439991
156156
MonoBehaviour:
157157
m_ObjectHideFlags: 0
@@ -164,7 +164,7 @@ MonoBehaviour:
164164
m_Script: {fileID: 11500000, guid: b65129ea85086ae47af878a4f30e9e69, type: 3}
165165
m_Name:
166166
m_EditorClassIdentifier:
167-
bcpInterface: {fileID: 3405300645593462295}
167+
_bcpInterface: {fileID: 3405300645593462295}
168168
--- !u!114 &3090677156515762911
169169
MonoBehaviour:
170170
m_ObjectHideFlags: 0
@@ -177,7 +177,7 @@ MonoBehaviour:
177177
m_Script: {fileID: 11500000, guid: 11f6680fde0db0b47a34525af2715218, type: 3}
178178
m_Name:
179179
m_EditorClassIdentifier:
180-
bcpInterface: {fileID: 3405300645593462295}
180+
_bcpInterface: {fileID: 3405300645593462295}
181181
--- !u!114 &7662757724108484360
182182
MonoBehaviour:
183183
m_ObjectHideFlags: 0
@@ -190,7 +190,7 @@ MonoBehaviour:
190190
m_Script: {fileID: 11500000, guid: 2f12a6315c31b7e4a89904664714c88d, type: 3}
191191
m_Name:
192192
m_EditorClassIdentifier:
193-
bcpInterface: {fileID: 3405300645593462295}
193+
_bcpInterface: {fileID: 3405300645593462295}
194194
--- !u!114 &7963542148954742278
195195
MonoBehaviour:
196196
m_ObjectHideFlags: 0
@@ -203,7 +203,7 @@ MonoBehaviour:
203203
m_Script: {fileID: 11500000, guid: 35edded1d3e1dbf43abd87fd5af57e9c, type: 3}
204204
m_Name:
205205
m_EditorClassIdentifier:
206-
bcpInterface: {fileID: 3405300645593462295}
206+
_bcpInterface: {fileID: 3405300645593462295}
207207
--- !u!114 &491971619498350422
208208
MonoBehaviour:
209209
m_ObjectHideFlags: 0
@@ -216,7 +216,7 @@ MonoBehaviour:
216216
m_Script: {fileID: 11500000, guid: dab47b28efdc1874687cf7a107bab2c5, type: 3}
217217
m_Name:
218218
m_EditorClassIdentifier:
219-
bcpInterface: {fileID: 3405300645593462295}
219+
_bcpInterface: {fileID: 3405300645593462295}
220220
--- !u!114 &3968882011461727216
221221
MonoBehaviour:
222222
m_ObjectHideFlags: 0
@@ -229,7 +229,7 @@ MonoBehaviour:
229229
m_Script: {fileID: 11500000, guid: ed407e67f76aac446b42c742d66192d9, type: 3}
230230
m_Name:
231231
m_EditorClassIdentifier:
232-
bcpInterface: {fileID: 3405300645593462295}
232+
_bcpInterface: {fileID: 3405300645593462295}
233233
--- !u!114 &2727910698276087158
234234
MonoBehaviour:
235235
m_ObjectHideFlags: 0
@@ -242,7 +242,7 @@ MonoBehaviour:
242242
m_Script: {fileID: 11500000, guid: 5e17d18c78dff5746ae1c03a10b14cb9, type: 3}
243243
m_Name:
244244
m_EditorClassIdentifier:
245-
bcpInterface: {fileID: 3405300645593462295}
245+
_bcpInterface: {fileID: 3405300645593462295}
246246
--- !u!114 &1282676592095372013
247247
MonoBehaviour:
248248
m_ObjectHideFlags: 0
@@ -255,7 +255,7 @@ MonoBehaviour:
255255
m_Script: {fileID: 11500000, guid: 5f766cbe8cf3bc84f9686435c4834e79, type: 3}
256256
m_Name:
257257
m_EditorClassIdentifier:
258-
bcpInterface: {fileID: 3405300645593462295}
258+
_bcpInterface: {fileID: 3405300645593462295}
259259
--- !u!114 &3837697693617585428
260260
MonoBehaviour:
261261
m_ObjectHideFlags: 0
@@ -268,7 +268,7 @@ MonoBehaviour:
268268
m_Script: {fileID: 11500000, guid: 6b62026304519d541a9a1381c23cbe3c, type: 3}
269269
m_Name:
270270
m_EditorClassIdentifier:
271-
bcpInterface: {fileID: 3405300645593462295}
271+
_bcpInterface: {fileID: 3405300645593462295}
272272
--- !u!1 &7214112112941309933
273273
GameObject:
274274
m_ObjectHideFlags: 0
@@ -315,10 +315,10 @@ MonoBehaviour:
315315
m_Script: {fileID: 11500000, guid: 51b9336ad819de34399a83bd1df10416, type: 3}
316316
m_Name:
317317
m_EditorClassIdentifier:
318-
port: 5050
319-
frameTimeBudgetMs: 1
320-
logReceivedMessages: 0
321-
logSentMessages: 0
318+
_port: 5050
319+
_frameTimeBudgetMs: 1
320+
_logReceivedMessages: 0
321+
_logSentMessages: 0
322322
--- !u!1 &8567879373765849912
323323
GameObject:
324324
m_ObjectHideFlags: 0
@@ -330,7 +330,6 @@ GameObject:
330330
- component: {fileID: 146168304089640666}
331331
- component: {fileID: 2143735940723918985}
332332
- component: {fileID: 6877878494961934022}
333-
- component: {fileID: 4783129044812347161}
334333
m_Layer: 0
335334
m_Name: Behaviours
336335
m_TagString: Untagged
@@ -365,8 +364,8 @@ MonoBehaviour:
365364
m_Script: {fileID: 11500000, guid: d38f5f799b1bc354c9f85833a5c6c3ba, type: 3}
366365
m_Name:
367366
m_EditorClassIdentifier:
368-
bcpInterface: {fileID: 3405300645593462295}
369-
helloHandler: {fileID: 8178360348569921075}
367+
_bcpInterface: {fileID: 3405300645593462295}
368+
_helloHandler: {fileID: 8178360348569921075}
370369
--- !u!114 &6877878494961934022
371370
MonoBehaviour:
372371
m_ObjectHideFlags: 0
@@ -379,18 +378,5 @@ MonoBehaviour:
379378
m_Script: {fileID: 11500000, guid: cf6e722a91a3eed43b7d8f5cf8f929ac, type: 3}
380379
m_Name:
381380
m_EditorClassIdentifier:
382-
bcpInterface: {fileID: 3405300645593462295}
383-
goodbyeHandler: {fileID: 2199375185222848247}
384-
--- !u!114 &4783129044812347161
385-
MonoBehaviour:
386-
m_ObjectHideFlags: 0
387-
m_CorrespondingSourceObject: {fileID: 0}
388-
m_PrefabInstance: {fileID: 0}
389-
m_PrefabAsset: {fileID: 0}
390-
m_GameObject: {fileID: 8567879373765849912}
391-
m_Enabled: 1
392-
m_EditorHideFlags: 0
393-
m_Script: {fileID: 11500000, guid: 63b1e8e36b98108428c60d300b17dc3d, type: 3}
394-
m_Name:
395-
m_EditorClassIdentifier:
396-
bcpInterface: {fileID: 3405300645593462295}
381+
_bcpInterface: {fileID: 3405300645593462295}
382+
_goodbyeHandler: {fileID: 2199375185222848247}

Runtime/Behaviours/DisconnectOnGoodbyeReceived.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ namespace FutureBoxSystems.MpfMediaController.Behaviours
66
public class DisconnectOnGoodbyeReceived : MonoBehaviour
77
{
88
[SerializeField]
9-
BcpInterface bcpInterface;
9+
BcpInterface _bcpInterface;
1010

1111
[SerializeField]
12-
GoodbyeMessageHandler goodbyeHandler;
12+
GoodbyeMessageHandler _goodbyeHandler;
1313

1414
private void OnEnable()
1515
{
16-
goodbyeHandler.Received += GoodbyeMessageReceived;
16+
_goodbyeHandler.Received += GoodbyeMessageReceived;
1717
}
1818

1919
private void OnDisable()
2020
{
21-
if (goodbyeHandler != null)
22-
goodbyeHandler.Received -= GoodbyeMessageReceived;
21+
if (_goodbyeHandler != null)
22+
_goodbyeHandler.Received -= GoodbyeMessageReceived;
2323
}
2424

2525
private void GoodbyeMessageReceived(object sender, GoodbyeMessage message)
2626
{
27-
bcpInterface.RequestDisconnect();
27+
_bcpInterface.RequestDisconnect();
2828
}
2929
}
3030
}

Runtime/Behaviours/HelloResponse.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ namespace FutureBoxSystems.MpfMediaController.Behaviours
77
public class HelloResponse : MonoBehaviour
88
{
99
[SerializeField]
10-
private BcpInterface bcpInterface;
10+
private BcpInterface _bcpInterface;
1111

1212
[SerializeField]
13-
private HelloMessageHandler helloHandler;
13+
private HelloMessageHandler _helloHandler;
1414

1515
private void OnEnable()
1616
{
17-
helloHandler.Received += HelloMessageReceived;
17+
_helloHandler.Received += HelloMessageReceived;
1818
}
1919

2020
private void OnDisable()
2121
{
22-
if (helloHandler != null)
23-
helloHandler.Received -= HelloMessageReceived;
22+
if (_helloHandler != null)
23+
_helloHandler.Received -= HelloMessageReceived;
2424
}
2525

2626
private void HelloMessageReceived(object sender, HelloMessage message)
@@ -42,7 +42,7 @@ private void HelloMessageReceived(object sender, HelloMessage message)
4242
commandThatCausedError: originalHelloMessage
4343
);
4444
}
45-
bcpInterface.EnqueueMessage(response);
45+
_bcpInterface.EnqueueMessage(response);
4646
}
4747
}
4848
}

0 commit comments

Comments
 (0)