Skip to content

Commit 5f9d08b

Browse files
Merge media controller code
2 parents 836e499 + 17f11dd commit 5f9d08b

File tree

214 files changed

+4524
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+4524
-2
lines changed

Editor/BcpInterfaceInspector.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
using UnityEngine.UIElements;
4+
5+
namespace FutureBoxSystems.MpfMediaController
6+
{
7+
[CustomEditor(typeof(BcpInterface))]
8+
public class BcpInterfaceInspector : Editor
9+
{
10+
[SerializeField]
11+
private VisualTreeAsset _bcpInterfaceInspectorXml;
12+
13+
private TextField _connectionStateField;
14+
private BcpInterface _bcpInterface;
15+
16+
public override VisualElement CreateInspectorGUI()
17+
{
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;
23+
return ui;
24+
}
25+
26+
private void OnDisable()
27+
{
28+
_bcpInterface.ConnectionStateChanged -= OnConnectionStateChanged;
29+
}
30+
31+
private void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs args)
32+
{
33+
UpdateConnectionStateField(args.CurrentState);
34+
}
35+
36+
private void UpdateConnectionStateField(ConnectionState state)
37+
{
38+
_connectionStateField.value = state.ToString();
39+
}
40+
}
41+
}

Editor/BcpInterfaceInspector.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/BcpInterfaceInspector.uxml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<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">
2+
<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" />
7+
</ui:UXML>

Editor/BcpInterfaceInspector.uxml.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)