Network
- AllocateViewID
- CloseConnection
- connections
- connectionTesterIP
- connectionTesterPort
- Connect
- DestroyPlayerObjects
- Destroy
- Disconnect
- GetAveragePing
- GetLastPing
- HavePublicAddress
- incomingPassword
- InitializeSecurity
- InitializeServer
- Instantiate
- isClient
- isMessageQueueRunning
- isServer
- logLevel
- maxConnections
- minimumAllocatableViewIDs
- natFacilitatorIP
- natFacilitatorPort
- OnConnectedToServer
- OnDisconnectedFromServer
- OnFailedToConnectToM...
- OnFailedToConnect
- OnNetworkInstantiate
- OnPlayerConnected
- OnPlayerDisconnected
- OnSerializeNetworkView
- OnServerInitialized
- peerType
- player
- proxyIP
- proxyPassword
- proxyPort
- RemoveRPCsInGroup
- RemoveRPCs
- sendRate
- SetLevelPrefix
- SetReceivingEnabled
- SetSendingEnabled
- TestConnectionNAT
- TestConnection
- time
- useProxy
Network.Disconnect 断开
static function Disconnect (timeout : int = 200) : void
Description描述
Close all open connections and shuts down the network interface.
关闭所有开放的连接并关闭网络接口。
The timeout parameter indicates how much time the network interface gets to signal to others that it is disconnecting. The network state, like security and password, is also reset.
timeout参数表示网络接口在未收到信号的情况下,多长时间会断开。网络状态,如安全和密码,也会被重置。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnGUI() {
if (GUILayout.Button("Disconnect")) {
Network.Disconnect();
MasterServer.UnregisterHost();
}
}
}
function OnGUI() {
if (GUILayout.Button ("Disconnect")) {
Network.Disconnect();
MasterServer.UnregisterHost();
}
}
最后修改:2011年4月2日 Saturday 17:38