示例#1
0
    public override void OnInspectorGUI()
    {
        NetworkInterface network = target as NetworkInterface;

        if (!network)
        {
            return;
        }
        DrawDefaultInspector();
        EditorGUI.BeginDisabledGroup(network.UseLocalGenerator);

        if (network.Connected)
        {
            if (GUILayout.Button("Disconnect"))
            {
                network.Disconnect();
            }
        }
        else
        {
            if (GUILayout.Button("Connect"))
            {
                network.Connect();
            }
        }

        EditorGUI.EndDisabledGroup();
    }
    void Lobby_OnDisconnected()
    {
        MessageBox_N.CancelMask(MsgInfoType.LobbyLoginMask);

        if (LogFilter.logDebug)
        {
            Debug.Log("Disconnected from lobby server");
        }

        if (null != OnLobbyDisconnectedEvent)
        {
            OnLobbyDisconnectedEvent();
        }

        Cursor.lockState = Screen.fullScreen? CursorLockMode.Confined: CursorLockMode.None;
        Cursor.visible   = true;
        PeCamera.SetVar("ForceShowCursor", true);

        NetworkInterface.Disconnect();
        if (Pathea.PeFlowMgr.Instance != null && Pathea.PeFlowMgr.Instance.curScene != Pathea.PeFlowMgr.EPeScene.MainMenuScene)
        {
            Pathea.PeFlowMgr.Instance.LoadScene(Pathea.PeFlowMgr.EPeScene.MainMenuScene, false);
        }
    }
 public static void Disconnect()
 {
     OnDisconnectEvent -= OnDisconnectFromServer;
     NetworkInterface.Disconnect();
 }