Beispiel #1
0
        private void PlayerGui([NotNull] VoicePlayerState p)
        {
            var message = string.Format("{0} {1} {2} {3}",
                                        p.Name,
                                        p.IsSpeaking ? "(speaking)" : "",
                                        !p.IsConnected ? "(disconnected)" : "",
                                        p.Tracker != null && p.Tracker.IsTracking ? "(positional)" : ""
                                        );

            using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                bool showListeningRooms;
                bool showSpeakingChannels;

                EditorGUILayout.LabelField(message);
                using (new EditorGUILayout.HorizontalScope())
                {
                    p.IsLocallyMuted = GUILayout.Toggle(p.IsLocallyMuted, new GUIContent("Mute", "Prevent this player from being heard locally"));

                    showListeningRooms = GUILayout.Toggle(_showRoomMembership.Contains(p.Name), new GUIContent("Show Rooms", "Show the set of rooms this player is listening to"));
                    if (showListeningRooms)
                    {
                        _showRoomMembership.Add(p.Name);
                    }
                    else
                    {
                        _showRoomMembership.Remove(p.Name);
                    }

                    showSpeakingChannels = GUILayout.Toggle(_showSpeakingChannels.Contains(p.Name), new GUIContent("Show Channels", "Show the set of channels this player is speaking to the local player through"));
                    if (showSpeakingChannels)
                    {
                        _showSpeakingChannels.Add(p.Name);
                    }
                    else
                    {
                        _showSpeakingChannels.Remove(p.Name);
                    }
                }

                if (showListeningRooms)
                {
                    using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                    {
                        EditorGUILayout.LabelField("Listening To:");
                        foreach (var room in p.Rooms)
                        {
                            EditorGUILayout.LabelField(" - " + room);
                        }
                    }
                }

                if (showSpeakingChannels)
                {
                    using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                    {
                        var l = new List <RemoteChannel>();
                        p.GetSpeakingChannels(l);

                        EditorGUILayout.LabelField("Speaking Through:");
                        foreach (var channel in l.OrderByDescending(a => a.Type))
                        {
                            EditorGUILayout.LabelField(string.Format(" - {0}: {1}", channel.Type, channel.TargetName));
                        }
                    }
                }
            }
        }