本文整理汇总了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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例6: KickPlayer
public void KickPlayer(NetworkConnection conn)
{
conn.Disconnect();
}
示例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);
}
}
示例8: ClientRefuse
public void ClientRefuse(NetworkConnection nc)
{
// TODO: Add anti-spam support
common.printConsole (tag, "Refusing peer: " + nc.address, true);
nc.Disconnect();
}