public void StartLANHost()
    {
        this.PreInitialization();

        this.networkManager.StartHost();
        this.initialMenu.SetActive(false);
        this.optionsMenu.SetActive(false);
        this.LANClientReady.SetActive(false);
        this.LANClientNotReady.SetActive(false);
        this.LANHost.SetActive(true);
        this.LANClientNotConnected.SetActive(false);
        EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();

        if (enableEditorObj != null)
        {
            enableEditorObj.TurnOffCanvasGroup();
        }

        this.PreUnitAttributesInitialization();

        MinimapStuffs stuffs = GameObject.FindObjectOfType <MinimapStuffs>();

        if (stuffs != null)
        {
            Camera minimapCamera = stuffs.GetComponent <Camera>();
            minimapCamera.enabled      = true;
            stuffs.playerCameraPanning = Camera.main.GetComponent <CameraPanning>();
        }

        string name = this.playerNameField.text;

        if (name.Length > 0)
        {
            GameMetricLogger.instance.playerName = name;
        }
        else
        {
            GameMetricLogger.instance.playerName = "Player";
        }

        if (Taskbar.Instance != null)
        {
            Taskbar.Instance.ShowTaskbar(true);
        }

        GameMetricLogger.instance.difficultyEquations = this.difficultyDropdown.options[this.difficultyDropdown.value].text;
        GameMetricLogger.SetGameLogger(GameLoggerOptions.StartGameMetrics);
    }
    public void StopLANHost()
    {
        //NOTE(Thompson): This is the official method of resetting the LAN session if the
        //player wants to play a new LAN session after ending a previous LAN session.
        SceneManager.LoadScene("new_multiplayer");

        //NOTE(Thompson): When reloading a scene, the GUIs are not reset to its initial states. Therefore
        //the following reinitialization codes are necessary.
        this.networkManager.StopHost();
        this.LANHost.SetActive(false);
        this.LANClientReady.SetActive(false);
        this.LANClientNotReady.SetActive(false);
        this.LANClientNotConnected.SetActive(false);
        this.initialMenu.SetActive(true);
        this.optionsMenu.SetActive(true);
        EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();

        if (enableEditorObj != null && enableEditorObj.isCustomOptionSelected)
        {
            enableEditorObj.TurnOnCanvasGroup();
        }

        MinimapStuffs stuffs = GameObject.FindObjectOfType <MinimapStuffs>();

        if (stuffs != null)
        {
            stuffs.playerCameraPanning = Camera.main.GetComponent <CameraPanning>();
            Camera minimapCamera = stuffs.GetComponent <Camera>();
            minimapCamera.enabled = false;
        }

        if (Taskbar.Instance != null)
        {
            Taskbar.Instance.ShowTaskbar(false);
        }

        GameMetricLogger.DisableLoggerHotkey();
        //GameMetricLogger.SetGameLogger(GameLoggerOptions.StopGameMetrics);
    }
    public void SetClientReady()
    {
        if (!ClientScene.ready)
        {
            if (ClientScene.Ready(this.networkManager.client.connection))
            {
                Camera       cam      = Camera.main.GetComponent <Camera>();
                PostRenderer renderer = cam.GetComponent <PostRenderer>();
                if (renderer != null)
                {
                    renderer.enabled = true;
                }
                MinimapStuffs stuffs = GameObject.FindObjectOfType <MinimapStuffs>();
                if (stuffs != null)
                {
                    Camera minimapCamera = stuffs.GetComponent <Camera>();
                    minimapCamera.enabled      = true;
                    stuffs.playerCameraPanning = Camera.main.GetComponent <CameraPanning>();
                }
                this.LANClientReady.SetActive(false);
                this.LANClientNotReady.SetActive(false);

                GameMetricLogger.EnableLoggerHotkey();

                NewSpawner[] spawners = GameObject.FindObjectsOfType <NewSpawner>();
                foreach (NewSpawner spawn in spawners)
                {
                    if (spawn != null && spawn.hasAuthority)
                    {
                        NewSpawner.Instance.CmdSetReadyFlag(ClientScene.ready && !NetworkServer.active);
                    }
                }

                GameMetricLogger.SetGameLogger(GameLoggerOptions.StartGameMetrics);
            }
            else
            {
                this.LANClientReady.SetActive(false);
                this.LANClientNotReady.SetActive(true);
            }
            if (ClientScene.localPlayers.Count == 0)
            {
                ClientScene.AddPlayer(0);
            }
        }
        else
        {
            this.LANClientReady.SetActive(false);
            this.LANClientNotReady.SetActive(false);

            Camera       cam      = Camera.main.GetComponent <Camera>();
            PostRenderer renderer = cam.GetComponent <PostRenderer>();
            if (renderer != null)
            {
                renderer.enabled = true;
            }
            MinimapStuffs stuffs = GameObject.FindObjectOfType <MinimapStuffs>();
            if (stuffs != null)
            {
                Camera minimapCamera = stuffs.GetComponent <Camera>();
                minimapCamera.enabled      = true;
                stuffs.playerCameraPanning = Camera.main.GetComponent <CameraPanning>();
            }

            this.LANClientReady.SetActive(false);
            this.LANClientNotReady.SetActive(false);

            string name = this.playerNameField.text;
            if (name.Length > 0)
            {
                GameMetricLogger.instance.playerName = name;
            }
            else
            {
                GameMetricLogger.instance.playerName = "Player";
            }
            GameMetricLogger.instance.difficultyEquations = this.difficultyDropdown.options[this.difficultyDropdown.value].text;
            GameMetricLogger.EnableLoggerHotkey();

            NewSpawner[] spawners = GameObject.FindObjectsOfType <NewSpawner>();
            foreach (NewSpawner spawn in spawners)
            {
                if (spawn != null && spawn.hasAuthority)
                {
                    NewSpawner.Instance.CmdSetReadyFlag(ClientScene.ready && !NetworkServer.active);
                }
            }

            GameMetricLogger.SetGameLogger(GameLoggerOptions.StartGameMetrics);
        }

        Canvas         canvas = GameObject.FindObjectOfType <Canvas>();
        TooltipLocator loc    = canvas.GetComponent <TooltipLocator>();

        if (loc != null)
        {
            loc.tooltip.SetToolTipHidden(true);
        }
    }