Example #1
0
 // Transparent overlay GUI to show who is talking
 public void overlayGUI(int ID)
 {
     try
     {
         GUILayout.BeginVertical();
         if (MicEF.threadID != -1) // This sees if your mic is on
         {
             GUILayout.Label("<b>(" + PhotonNetwork.player.ID + ") </b>" + PhotonNetwork.player.customProperties["name"].ToString().hexColor());
             //RPCList.add("<b>(" + PhotonNetwork.player.ID + ") </b>" + PhotonNetwork.player.customProperties["name"].ToString().hexColor());
         }
         foreach (KeyValuePair <int, MicPlayer> entry in MicEF.users)
         {
             MicPlayer player = entry.Value;
             if (player.clipProcess)
             {
                 GUILayout.Label("<b>(" + entry.Key + ") </b>" + entry.Value.name);
             }
         }
         GUILayout.EndVertical();
     }
     catch (Exception e)
     {
         //RPCList.add(e.Message + " ~ " + e.StackTrace);
     }
 }
Example #2
0
    // Resets the player stuff on restarts
    private void OnLevelWasLoaded(int level)
    {
        if (Camera.main.gameObject.GetComponent <AudioSource>() == null)
        {
            Camera.main.gameObject.AddComponent <AudioSource>();
        }
        foreach (KeyValuePair <int, MicPlayer> entry in MicEF.users)
        {
            MicPlayer player = entry.Value;

            player.refreshInformation();
        }
    }
Example #3
0
 // Transparent overlay GUI to show who is talking
 public void DrawOverlayGUI(int ID)
 {
     try
     {
         GUILayout.BeginVertical();
         if (MicEF.ThreadId != -1) // This sees if your mic is on
         {
             GUILayout.Label("<b>(" + PhotonNetwork.player.Id + ") </b>" + PhotonNetwork.player.customProperties["name"].ToString().NGUIToUnity());
         }
         foreach (KeyValuePair <int, MicPlayer> entry in MicEF.Users)
         {
             MicPlayer player = entry.Value;
             if (player.Processing)
             {
                 GUILayout.Label("<b>(" + entry.Key + ") </b>" + entry.Value.Name);
             }
         }
         GUILayout.EndVertical();
     }
     catch (Exception e)
     {
         print(e);
     }
 }
Example #4
0
    public void DrawMainGUI(int ID)
    {
        GUILayout.BeginVertical();

        GUILayout.BeginArea(micOptionsRect);
        GUILayout.BeginHorizontal();

        // Button Options
        if (GUILayout.Button("User List", buttonStyle))
        {
            selection = 0;
            dropDown  = false;
        }
        else if (GUILayout.Button("Options", buttonStyle))
        {
            selection = 1;
            dropDown  = false;
        }
        else if (GUILayout.Button("Credits", buttonStyle))
        {
            selection = 2;
            dropDown  = false;
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        GUILayout.BeginArea(micAreaRect, areaStyle);

        switch (selection)
        {
        case 0:
        {         // User list
            vSliderValue = GUILayout.BeginScrollView(vSliderValue);
            foreach (KeyValuePair <int, MicPlayer> entry in MicEF.Users)
            {
                MicPlayer player = entry.Value;

                GUILayout.BeginHorizontal();

                GUILayout.Label(player.Name, GUILayout.Width(labelLength));
                Color oldCol = buttonStyle.normal.textColor;

                if (player.MutedYou)
                {
                    buttonStyle.normal.textColor = Color.yellow;
                }
                else if (!player.isMuted)
                {
                    buttonStyle.normal.textColor = Color.green;
                }
                else
                {
                    buttonStyle.normal.textColor = Color.red;
                }

                if (GUILayout.Button("M", buttonStyle))         // Speaker Icon
                {
                    player.Mute(!player.isMuted);
                }

                buttonStyle.normal.textColor = oldCol;

                if (GUILayout.Button("V", buttonStyle))         // Volume
                {
                    player.changingVolume = !player.changingVolume;
                }

                GUILayout.EndHorizontal();
                if (player.changingVolume)
                {
                    player.volume = GUILayout.HorizontalSlider(player.volume, 0f, 4f, new GUILayoutOption[0]);
                    if (!player.isMuted && player.volume == 0f)
                    {
                        player.Mute(true);
                    }
                    else if (player.isMuted)
                    {
                        player.Mute(false);
                    }
                }
            }
            GUILayout.EndScrollView();
            break;
        }

        case 1:
        {         // Options
            controlSlider = GUILayout.BeginScrollView(controlSlider);
            GUILayout.BeginVertical();

            // Voice Assignment
            GUILayout.BeginHorizontal();
            GUILayout.Label("Push To talk:");
            string buttonText = MicEF.PushToTalk.ToString();
            if (changingKeys == 0)
            {
                buttonText = "Waiting...";
                for (int i = 1; i <= 429; i++)
                {
                    KeyCode code = (KeyCode)(i);
                    if (Input.GetKeyDown(code))
                    {
                        MicEF.PushToTalk = code;
                        changingKeys     = -1;
                        PlayerPrefs.SetInt("pushToTalk", (int)code);
                    }
                }
            }
            if (GUILayout.Button(buttonText, buttonStyle))
            {
                if (changingKeys == -1)
                {
                    changingKeys = 0;
                }
            }
            GUILayout.EndHorizontal();


            // GUI Assignment
            GUILayout.BeginHorizontal();
            GUILayout.Label("Voice GUI Key:");
            buttonText = guiKey.ToString();
            if (changingKeys == 1)
            {
                buttonText = "Waiting...";
                for (int i = 1; i <= 429; i++)
                {
                    KeyCode code = (KeyCode)i;
                    if (Input.GetKeyDown(code))
                    {
                        guiKey       = code;
                        changingKeys = -1;
                        PlayerPrefs.SetInt("voiceKey", (int)code);
                    }
                }
            }
            if (GUILayout.Button(buttonText, buttonStyle))
            {
                if (changingKeys == -1)
                {
                    changingKeys = 1;
                }
            }
            GUILayout.EndHorizontal();


            // Volume
            GUILayout.Label("Volume Multiplier: " + MicEF.VolumeMultiplier);
            float oldVol = MicEF.VolumeMultiplier;
            MicEF.VolumeMultiplier = GUILayout.HorizontalSlider(MicEF.VolumeMultiplier, 0f, 3f, new GUILayoutOption[0]);
            if (oldVol != MicEF.VolumeMultiplier)
            {
                PlayerPrefs.SetFloat("volumeMultiplier", MicEF.VolumeMultiplier);
            }


            // Device Name
            GUILayout.BeginHorizontal();

            GUILayout.Label("Microphone: ");

            string micButtonText = "Default";
            if (MicEF.DeviceName.Length > 0)
            {
                micButtonText = MicEF.DeviceName;
                if (micButtonText.StartsWith("Microphone ("))
                {
                    micButtonText = micButtonText.Remove(0, 12);
                    micButtonText = micButtonText.Substring(0, micButtonText.Length - 1);
                }
            }

            if (GUILayout.Button(micButtonText, buttonStyle))
            {
                clickPos   = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
                deviceRect = new Rect(clickPos.x - micAreaRect.width / 5f, clickPos.y + 5, micAreaRect.width / 2.5f, micAreaRect.height);
                dropDown   = !dropDown;
            }

            GUILayout.EndHorizontal();


            //Auto Mute People On Join
            GUILayout.BeginHorizontal();
            GUILayout.Label("Auto Mute People On Join:");
            bool autoMute = MicEF.AutoMute;
            MicEF.AutoMute = GUILayout.Toggle(autoMute, "On");
            if (autoMute != MicEF.AutoMute)
            {
                PlayerPrefs.SetString("voiceAutoMute", MicEF.AutoMute + string.Empty);
            }
            GUILayout.EndHorizontal();


            // Auto Connect
            GUILayout.BeginHorizontal();
            GUILayout.Label("Auto Connect:");
            bool autoConnect = MicEF.AutoConnect;
            MicEF.AutoConnect = GUILayout.Toggle(autoConnect, "On");
            if (autoConnect != MicEF.AutoConnect)
            {
                PlayerPrefs.SetString("voiceAutoConnect", MicEF.AutoConnect + string.Empty);
            }
            GUILayout.EndHorizontal();


            // Toggle Mic
            GUILayout.BeginHorizontal();
            GUILayout.Label("Toggle Mic:");
            bool toggleMic = MicEF.ToggleMic;
            MicEF.ToggleMic = GUILayout.Toggle(toggleMic, "On");
            if (toggleMic != MicEF.ToggleMic)
            {
                PlayerPrefs.SetString("voiceToggleMic", MicEF.ToggleMic + string.Empty);
            }
            GUILayout.EndHorizontal();


            // Disconnect Button
            buttonText = "Disconnect From Voice";
            if (MicEF.Disconnected)
            {
                buttonText = "Connect To Voice";
            }

            Color oldCol = buttonStyle.normal.textColor;

            if (MicEF.Disconnected)
            {
                buttonStyle.normal.textColor = Color.green;
            }
            else
            {
                buttonStyle.normal.textColor = Color.red;
            }

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(buttonText, buttonStyle))
            {
                if (!MicEF.Disconnected)
                {
                    PhotonNetwork.RaiseEvent((byte)173, new byte[] { (byte)253 }, true, new RaiseEventOptions
                        {
                            Receivers = ReceiverGroup.Others
                        });
                    MicEF.Disconnected = true;
                }
                else
                {
                    PhotonNetwork.RaiseEvent((byte)173, new byte[0], true, new RaiseEventOptions
                        {
                            Receivers = ReceiverGroup.Others
                        });
                    MicEF.Disconnected = false;
                }
            }

            // Reset settings button
            buttonStyle.normal.textColor = Color.white;
            if (GUILayout.Button("Reset Settings", buttonStyle))
            {
                MicEF.PushToTalk = KeyCode.V;
                PlayerPrefs.SetInt("pushToTalk", (int)KeyCode.V);
                guiKey = KeyCode.Backslash;
                PlayerPrefs.SetInt("voiceKey", (int)KeyCode.Backslash);
                MicEF.DeviceName = string.Empty;
                PlayerPrefs.SetString("micDevice", string.Empty);
                MicEF.VolumeMultiplier = 1f;
                PlayerPrefs.SetFloat("volumeMultiplier", 1f);
                MicEF.AutoMute = false;
                PlayerPrefs.SetString("voiceAutoMute", "false");
                MicEF.AutoConnect = true;
                PlayerPrefs.SetString("voiceAutoConnect", "false");
                MicEF.ToggleMic = false;
                PlayerPrefs.SetString("voiceToggleMic", "false");

                foreach (MicPlayer player in MicEF.Users.Values)
                {
                    player.volume = 1f;
                    player.Mute(false);
                }
            }
            GUILayout.EndHorizontal();

            buttonStyle.normal.textColor = oldCol;

            GUILayout.EndVertical();
            GUILayout.EndScrollView();
            break;
        }

        case 3:     // Credits to Kevin and Sadico
            GUILayout.Label("Main Developer: Elite Future(Kevin) - Discord:Elite Future#1043");
            GUILayout.Label("Data Compression: Sadico");
            break;
        }

        GUILayout.EndArea();
        GUILayout.EndVertical();
        if ((!Input.GetKey(KeyCode.Mouse0) || !Input.GetKey(KeyCode.Mouse1)) && !Input.GetKey(KeyCode.C) && (IN_GAME_MAIN_CAMERA.CameraMode == CameraType.WOW || IN_GAME_MAIN_CAMERA.CameraMode == CameraType.Original))
        {
            GUI.DragWindow();
        }
    }
Example #5
0
 private void MicPlayback(object sender, RoutedEventArgs e)
 {
     player = new MicPlayer();
     player.MicPlayback();
 }
Example #6
0
 private void ClientClicked(object sender, RoutedEventArgs e)
 {
     player = new MicPlayer();
     player.MicToServer("134.115.93.89", 1090);
 }
Example #7
0
        private void StartClicked(object sender, RoutedEventArgs e)
        {
            player = new MicPlayer();

            player.NetworkPlaybackServer("134.115.93.89", 1090);
        }