コード例 #1
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
コード例 #2
0
        public void AwakeChat()
        {
            if (instance != null && instance != this)
            {
                Destroy(this);
                Debug.LogError("Only one instance of VoiceChatRecorder can exist");
                return;
            }
            instance = this;

            foreach (VoiceChatPlayer player in voiceChatPlayers)
            {
                player.StartChat();
            }

            Application.RequestUserAuthorization(UserAuthorization.Microphone);

            if (Microphone.devices.Length == 0)
            {
                Debug.LogError("Mic not found");
                return;
            }
            // VoiceChatSettings.Preset = VoiceChatPreset.Speex_8K;
            VoiceChatClient.StartClient();
        }
コード例 #3
0
 void OnDisable()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
コード例 #4
0
        void OnEnable()
        {
            if (instance != null && instance != this)
            {
                MonoBehaviour.Destroy(this);
                Debug.LogError("Only one instance of VoiceChatRecorder can exist");
                return;
            }

            Application.RequestUserAuthorization(UserAuthorization.Microphone);
            instance = this;
        }
コード例 #5
0
        public override void OnInspectorGUI()
        {
            VoiceChatRecorder recorder = target as VoiceChatRecorder;

            if (Application.isPlaying && Network.isClient)
            {
                EditorGUILayout.LabelField("Available Devices", EditorStyles.boldLabel);

                foreach (string device in recorder.AvailableDevices)
                {
                    EditorGUILayout.LabelField(device);
                }

                EditorGUILayout.LabelField("Selected Device", EditorStyles.boldLabel);

                int      index = Mathf.Clamp(Array.IndexOf(recorder.AvailableDevices, recorder.Device), 0, Int32.MaxValue) + 1;
                string[] devices = new string[1] {
                    "Default"
                }.Concat(recorder.AvailableDevices).ToArray();

                index = EditorGUILayout.Popup(index, devices);

                if (index != 0)
                {
                    recorder.Device = devices[index];
                }
                else
                {
                    recorder.Device = null;
                }

                if (recorder.IsRecording)
                {
                    if (GUILayout.Button("Stop Recording"))
                    {
                        recorder.StopRecording();
                    }
                }
                else
                {
                    if (GUILayout.Button("Start Recording"))
                    {
                        recorder.StartRecording();
                    }
                }
            }
            else
            {
                DrawDefaultInspector();
            }
        }
コード例 #6
0
 void Start()
 {
     if (instance != null && instance != this)
     {
         Debug.Log(instance.name);
         MonoBehaviour.Destroy(this);
         Debug.LogError("Only one instance of VoiceChatRecorder can exist");
         return;
     }
     // if (!Application.HasUserAuthorization(UserAuthorization.Microphone))
     // {
     //  Application.RequestUserAuthorization(UserAuthorization.Microphone);
     // }
     instance = this;
 }
コード例 #7
0
 void OnDestroy()
 {
     instance = null;
 }
コード例 #8
0
 void OnDisable()
 {
     instance = null;
 }
コード例 #9
0
        void OnEnable()
        {
            if (instance != null && instance != this)
            {
                MonoBehaviour.Destroy(this);
                Debug.LogError("Only one instance of VoiceChatRecorder can exist");
                return;
            }

            Application.RequestUserAuthorization(UserAuthorization.Microphone);
            instance = this;
        }
コード例 #10
0
 void OnDestroy()
 {
     instance = null;
 }
コード例 #11
0
 void OnDisable()
 {
     instance = null;
 }
コード例 #12
0
 void OnDisable()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
コード例 #13
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }