void Update()
    {
        if (Input.GetButtonDown("ShowNetworkGUI"))
        {
            PhotonStatsGui statsGui = GameObject.FindObjectOfType <PhotonStatsGui>();
            if (statsGui == null)
            {
                GameObject go = new GameObject("PhotonStatsGUI");
                statsGui = go.AddComponent <PhotonStatsGui>();
            }
            else
            {
                statsGui.enabled = !statsGui.enabled;
            }
        }

        if (Input.GetButtonDown("ShowLagSimulation"))
        {
            PhotonLagSimulationGui lagSimulationGui = GameObject.FindObjectOfType <PhotonLagSimulationGui>();
            if (lagSimulationGui == null)
            {
                GameObject go = new GameObject("PhotonLagSimulationGUI");
                lagSimulationGui = go.AddComponent <PhotonLagSimulationGui>();
            }
            else
            {
                lagSimulationGui.enabled = !lagSimulationGui.enabled;
            }
        }
    }
Example #2
0
        private void Awake()
        {
            if (FindObjectOfType <PhotonSingletonManager>() == null)
            {
                return;
            }

            if (Application.isEditor)
            {
                m_FullscreenButton.interactable  = false;
                m_ScreenResolutions.interactable = false;
            }
            else
            {
                m_ScreenWidth          = Screen.width;
                m_ScreenHeight         = Screen.height;
                m_FullScreenResolution = Screen.currentResolution;

                PlayerPrefs.SetInt("Screenmanager Resolution Width", m_ScreenWidth);
                PlayerPrefs.SetInt("Screenmanager Resolution Height", m_ScreenHeight);
                PlayerPrefs.SetInt("Screenmanager Is Fullscreen mode", Screen.fullScreen ? 1 : 0);

                m_FullscreenButton.onClick.AddListener(OnFullScreenButtonClick);
                m_ScreenResolutions.onValueChanged.AddListener(OnResolutionChange);
                SetStartValueOfScreenResolutions();
            }
            m_DisconnectButton.onClick.AddListener(DisconnectFromServer);
            m_DisconnectButton.interactable = false;

            m_StastGUIToggle.onValueChanged.AddListener(OnStatsGuiToggleClick);
            m_LagSimGUIToggle.onValueChanged.AddListener(OnLagSimGuiToggleClick);

            m_StatsGUI          = GetComponent <PhotonStatsGui>();
            m_LaggSimulationGUI = GetComponent <PhotonLagSimulationGui>();

            UpdateClientStateText(shownState);
        }