public override void OnInspectorGUI() { OSCEditorInterface.LogoLayout(); using (new EditorGUILayout.VerticalScope(OSCEditorStyles.Box)) { var openButton = GUILayout.Button(_openButton, GUILayout.Height(40)); if (openButton) { OSCWindowMapping.OpenBundle(_bundle); } } using (new EditorGUILayout.VerticalScope()) { if (_bundle.Messages.Count > 0) { var index = 0; foreach (var message in _bundle.Messages) { var types = message.Values.Select(v => v.Type.ToString()); using (new EditorGUILayout.HorizontalScope(OSCEditorStyles.Box)) { using (new EditorGUILayout.VerticalScope(OSCEditorStyles.Box)) { EditorGUILayout.LabelField((++index).ToString(), OSCEditorStyles.CenterBoldLabel, GUILayout.Width(40)); } using (new EditorGUILayout.VerticalScope(OSCEditorStyles.Box)) { EditorGUILayout.LabelField($"{message.Address} {string.Join(", ", types)}"); } } } } else { using (new EditorGUILayout.HorizontalScope(OSCEditorStyles.Box)) { GUILayout.Label(_emptyBundleContent, OSCEditorStyles.CenterLabel, GUILayout.Height(40)); } } } }
public override void OnInspectorGUI() { OSCEditorInterface.LogoLayout(); GUILayout.BeginVertical(OSCEditorStyles.Box); var openButton = GUILayout.Button(_openButton, GUILayout.Height(40)); if (openButton) { OSCWindowMapping.OpenBundle((OSCMapBundle)target); } GUILayout.EndVertical(); GUILayout.BeginVertical(); if (_bundle.Messages.Count > 0) { foreach (var message in _bundle.Messages) { GUILayout.BeginVertical(OSCEditorStyles.Box); GUILayout.BeginVertical(OSCEditorStyles.Box); EditorGUILayout.LabelField("Address: " + message.Address, EditorStyles.boldLabel); GUILayout.EndVertical(); foreach (var value in message.Values) { DrawValue(value); } GUILayout.EndVertical(); } } else { EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box); GUILayout.Label(_emptyBundleContent, OSCEditorStyles.CenterLabel, GUILayout.Height(40)); EditorGUILayout.EndHorizontal(); } GUILayout.EndVertical(); }
public override void OnInspectorGUI() { _defaultColor = GUI.color; serializedObject.Update(); EditorGUI.BeginChangeCheck(); // LOGO OSCEditorInterface.LogoLayout(); EditorGUILayout.LabelField("Active: " + _transmitter.IsStarted, EditorStyles.boldLabel); using (new GUILayout.VerticalScope(OSCEditorStyles.Box)) { // SETTINGS BLOCK EditorGUILayout.LabelField(_transmitterSettingsContent, EditorStyles.boldLabel); using (new GUILayout.VerticalScope(OSCEditorStyles.Box)) { EditorGUILayout.PropertyField(_remoteHostProperty, _hostContent); EditorGUILayout.PropertyField(_remotePortProperty, _portContent); EditorGUILayout.PropertyField(_mapBundleProperty, _mapBundleContent); GUI.color = _useBundleProperty.boolValue ? Color.green : Color.red; if (GUILayout.Button(_useBundleContent)) { _useBundleProperty.boolValue = !_useBundleProperty.boolValue; } GUI.color = _defaultColor; } // PROPERTIES BLOCK using (new GUILayout.HorizontalScope(OSCEditorStyles.Box)) { GUI.color = _autoConnectProperty.boolValue ? Color.green : Color.red; if (GUILayout.Button(_autoConnectContent)) { _autoConnectProperty.boolValue = !_autoConnectProperty.boolValue; } GUI.color = _closeOnPauseProperty.boolValue ? Color.green : Color.red; if (GUILayout.Button(_closeOnPauseContent)) { _closeOnPauseProperty.boolValue = !_closeOnPauseProperty.boolValue; } GUI.color = _defaultColor; } // ADVANCED BLOCK EditorGUILayout.LabelField(_advancedContent, EditorStyles.boldLabel); using (new GUILayout.VerticalScope(OSCEditorStyles.Box)) { if (EditorUserBuildSettings.selectedBuildTargetGroup == BuildTargetGroup.WSA) { GUI.color = Color.yellow; EditorGUILayout.HelpBox(_advancedHelp, MessageType.Info); GUI.color = _defaultColor; } EditorGUILayout.PropertyField(_sourceReceiverProperty, _sourceReceiverContent); var sourceReceiver = _transmitter.SourceReceiver; if (sourceReceiver != null) { var localHost = sourceReceiver.LocalHostMode == OSCLocalHostMode.Any ? _localHostCache : sourceReceiver.LocalHost; var localPort = sourceReceiver.LocalPort.ToString(); using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField(_localHostContent, GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(localHost, GUILayout.Height(EditorGUIUtility.singleLineHeight)); } using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField(_localPortContent, GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(localPort, GUILayout.Height(EditorGUIUtility.singleLineHeight)); } } else { EditorGUILayout.LabelField(_orContent, EditorStyles.boldLabel); // LOCAL HOST MODE EditorGUILayout.PropertyField(_localHostModeProperty, _localHostModeContent); if (_transmitter.LocalHostMode == OSCLocalHostMode.Any) { using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField(_localHostContent, GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(_localHostCache, GUILayout.Height(EditorGUIUtility.singleLineHeight)); } } else { EditorGUILayout.PropertyField(_localHostProperty, _localHostContent); } // LOCAL PORT MODE EditorGUILayout.PropertyField(_localPortModeProperty, _localPortModeContent); if (_transmitter.LocalPortMode == OSCLocalPortMode.FromRemotePort) { // LOCAL FROM REMOTE PORT using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField(_localPortContent, GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(_transmitter.RemotePort.ToString(), GUILayout.Height(EditorGUIUtility.singleLineHeight)); } } else if (_transmitter.LocalPortMode == OSCLocalPortMode.FromReceiver) { GUI.color = Color.red; EditorGUILayout.HelpBox(_fromReceiverHelp, MessageType.Warning); GUI.color = _defaultColor; } else if (_transmitter.LocalPortMode == OSCLocalPortMode.Custom) { EditorGUILayout.PropertyField(_localPortProperty, _localPortContent); } } } // CONTROLS EditorGUILayout.LabelField(Application.isPlaying ? _inGameContent : _inEditorContent, EditorStyles.boldLabel); using (new GUILayout.HorizontalScope(OSCEditorStyles.Box)) { if (Application.isPlaying) { InGameControls(); } else { InEditorControls(); } } } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } }
public override void OnInspectorGUI() { _defaultColor = GUI.color; serializedObject.Update(); EditorGUI.BeginChangeCheck(); // LOGO OSCEditorInterface.LogoLayout(); // INSPECTOR EditorGUILayout.LabelField("Active: " + _receiver.IsStarted, EditorStyles.boldLabel); using (new GUILayout.VerticalScope(OSCEditorStyles.Box)) { // SETTINGS BLOCK EditorGUILayout.LabelField(_receiverSettingsContent, EditorStyles.boldLabel); using (new GUILayout.VerticalScope(OSCEditorStyles.Box)) { if (_receiver.LocalHostMode == OSCLocalHostMode.Any) { using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField(_localHostContent, GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(_localHostCache, GUILayout.Height(EditorGUIUtility.singleLineHeight)); } } else { EditorGUILayout.PropertyField(_localHostProperty, _localHostContent); } EditorGUILayout.PropertyField(_localPortProperty, _localPortContent); EditorGUILayout.PropertyField(_mapBundleProperty, _mapBundleContent); } // PARAMETERS BLOCK using (new GUILayout.HorizontalScope(OSCEditorStyles.Box)) { GUI.color = _autoConnectProperty.boolValue ? Color.green : Color.red; if (GUILayout.Button(_autoConnectContent)) { _autoConnectProperty.boolValue = !_autoConnectProperty.boolValue; } GUI.color = _closeOnPauseProperty.boolValue ? Color.green : Color.red; if (GUILayout.Button(_closeOnPauseContent)) { _closeOnPauseProperty.boolValue = !_closeOnPauseProperty.boolValue; } GUI.color = _defaultColor; } // ADVANCED BLOCK EditorGUILayout.LabelField(_advancedContent, EditorStyles.boldLabel); using (new GUILayout.VerticalScope(OSCEditorStyles.Box)) { if (EditorUserBuildSettings.selectedBuildTargetGroup == BuildTargetGroup.WSA) { GUI.color = Color.yellow; EditorGUILayout.HelpBox(_advancedSettingsText, MessageType.Info); GUI.color = _defaultColor; } EditorGUILayout.PropertyField(_localHostModeProperty, _localHostModeContent); } // CONTROLS EditorGUILayout.LabelField(Application.isPlaying ? _inGameContent : _inEditorContent, EditorStyles.boldLabel); using (new GUILayout.HorizontalScope(OSCEditorStyles.Box)) { if (Application.isPlaying) { InGameControls(); } else { InEditorControls(); } } } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } }