当前位置: 首页>>代码示例>>C#>>正文


C# NetworkConnection.Disconnect方法代码示例

本文整理汇总了C#中UnityEngine.Networking.NetworkConnection.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkConnection.Disconnect方法的具体用法?C# NetworkConnection.Disconnect怎么用?C# NetworkConnection.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Networking.NetworkConnection的用法示例。


在下文中一共展示了NetworkConnection.Disconnect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnServerConnect

 // override for when a new client connects to the server
 public override void OnServerConnect(NetworkConnection conn)
 {
     if (this.numPlayers >= this.maxPlayers)
     conn.Disconnect();
       else if (Application.loadedLevelName != this.m_LobbyScene) // this will prevent players from joining after game is already started
       {
     conn.Disconnect();
       }
       else // otherwise we continue the process
       {
     base.OnServerConnect(conn);
     this.OnLobbyServerConnect(conn);
       }
 }
开发者ID:Kitabalef,项目名称:Unet-Decompiles,代码行数:15,代码来源:NetworkLobbyManager.cs

示例2: OnServerConnect

    public override void OnServerConnect(NetworkConnection conn)
    {
        if (numPlayers >= maxPlayers)
        {
            conn.Disconnect();
            return;
        }

        // cannot join game in progress
        if (HasGameStarted())
        {
            conn.Disconnect();
            return;
        }

        base.OnServerConnect(conn);
        OnLobbyServerConnect(conn);
    }
开发者ID:hengineer,项目名称:CaptainsMess,代码行数:18,代码来源:CaptainsMessLobbyManager.cs

示例3: OnServerConnect

 public override void OnServerConnect(NetworkConnection conn)
 {
     if (base.numPlayers >= this.maxPlayers)
     {
         conn.Disconnect();
     }
     else if (Application.loadedLevelName != this.m_LobbyScene)
     {
         conn.Disconnect();
     }
     else
     {
         base.OnServerConnect(conn);
         this.OnLobbyServerConnect(conn);
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:16,代码来源:NetworkLobbyManager.cs

示例4: OnServerConnect

    //Called on the server when a new client connects.
    public override void OnServerConnect(NetworkConnection conn){
        Debug.Log("OnServerConnect " + conn.connectionId);
        int i = 0;
		for(; i < maxPlayers; i++){
			if(lobbyPlayerArray[i] == null){
				break;
			}
		}
		if(i >= maxPlayers) {
			conn.Disconnect();
            conn.Dispose();
            Debug.Log("**********************OnServerConnect Disconnect the Client**********************");
            Debug.Log("**********************OnServerConnect Disconnect the Client**********************");
            Debug.Log("**********************OnServerConnect Disconnect the Client**********************");

            //tell the client
        }
        base.OnServerConnect(conn);
        //ask client to change panel
        ServerMessage sm = new ServerMessage();
        sm.currentMode = currentMode;
        sm.isCreatePlayer = true;
        NetworkServer.SendToClient(conn.connectionId, ServerMessage.MsgType, sm);
    }
开发者ID:charmjunewonder,项目名称:RiverRun,代码行数:25,代码来源:NetworkManagerCustom.cs

示例5: OnServerConnect

    // ------------------------ server handlers ------------------------
    public override void OnServerConnect(NetworkConnection conn)
    {
        if (numPlayers >= maxPlayers)
        {
            conn.Disconnect();
            return;
        }

        // cannot join game in progress
        string loadedSceneName = SceneManager.GetSceneAt(0).name;
        if (loadedSceneName != m_LobbyScene)
        {
            conn.Disconnect();
            return;
        }

        base.OnServerConnect(conn);
    }
开发者ID:jakecoffman,项目名称:tanks-unity,代码行数:19,代码来源:LobbyManager.cs

示例6: KickPlayer

 public void KickPlayer(NetworkConnection conn)
 {
     conn.Disconnect();
 }
开发者ID:BomberinoMan,项目名称:CapstoneProject,代码行数:4,代码来源:LobbyManager.cs

示例7: OnServerConnect

 public override void OnServerConnect(NetworkConnection conn)
 {
   if (this.numPlayers >= this.maxPlayers)
     conn.Disconnect();
   else if (SceneManager.GetSceneAt(0).name != this.m_LobbyScene)
   {
     conn.Disconnect();
   }
   else
   {
     base.OnServerConnect(conn);
     this.OnLobbyServerConnect(conn);
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:14,代码来源:NetworkLobbyManager.cs

示例8: ClientRefuse

		public void ClientRefuse(NetworkConnection nc)
		{
			// TODO: Add anti-spam support
			common.printConsole (tag, "Refusing peer: " + nc.address, true);
			nc.Disconnect();
		}
开发者ID:Johannesolof,项目名称:DoDGame,代码行数:6,代码来源:Server.cs


注:本文中的UnityEngine.Networking.NetworkConnection.Disconnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。