本文整理汇总了C#中NetworkConnection.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkConnection.Dispose方法的具体用法?C# NetworkConnection.Dispose怎么用?C# NetworkConnection.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkConnection
的用法示例。
在下文中一共展示了NetworkConnection.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}