MonoBehaviour
- Awake
- CancelInvoke
- FixedUpdate
- InvokeRepeating
- Invoke
- IsInvoking
- LateUpdate
- OnApplicationFocus
- OnApplicationPause
- OnApplicationQuit
- OnBecameInvisible
- OnBecameVisible
- OnCollisionEnter
- OnCollisionExit
- OnCollisionStay
- OnConnectedToServer
- OnControllerColliderHit
- OnDestroy
- OnDisable
- OnDisconnectedFromServer
- OnDrawGizmosSelected
- OnDrawGizmos
- OnEnable
- OnFailedToConnectToM...
- OnFailedToConnect
- OnGUI
- OnJointBreak
- OnLevelWasLoaded
- OnMasterServerEvent
- OnMouseDown
- OnMouseDrag
- OnMouseEnter
- OnMouseExit
- OnMouseOver
- OnMouseUpAsButton
- OnMouseUp
- OnNetworkInstantiate
- OnParticleCollision
- OnPlayerConnected
- OnPlayerDisconnected
- OnPostRender
- OnPreCull
- OnPreRender
- OnRenderImage
- OnRenderObject
- OnSerializeNetworkView
- OnServerInitialized
- OnTriggerEnter
- OnTriggerExit
- OnTriggerStay
- OnWillRenderObject
- Reset
- StartCoroutine
- Start
- StopAllCoroutines
- StopCoroutine
- Update
- useGUILayout
MonoBehaviour.OnMasterServerEvent 当主服务器事件
function OnMasterServerEvent (msEvent : MasterServerEvent) : void
Description描述
Called on clients or servers when reporting events from the MasterServer.
当报告事件来自主服务器时在客户端或服务器端调用。
Like, for example, when a host list has been received or host registration succeeded.
例如:当一个客户列表接收完成或客户注册成功后被调用。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Start() {
Network.InitializeServer(32, 25000);
}
void OnServerInitialized() {
MasterServer.RegisterHost("MyGameVer1.0.0_42", "My Game Instance", "This is a comment and place to store data");
}
void OnMasterServerEvent(MasterServerEvent msEvent) {
if (msEvent == MasterServerEvent.RegistrationSucceeded)
Debug.Log("Server registered");
}
}
function Start () {
Network.InitializeServer (32, 25000);
}
function OnServerInitialized() {
MasterServer.RegisterHost ( "MyGameVer1.0.0_42"
, "My Game Instance"
, "This is a comment and place to store data");
}
function OnMasterServerEvent(msEvent: MasterServerEvent ) {
if (msEvent == MasterServerEvent.RegistrationSucceeded ) {
Debug.Log ("Server registered");
}
}
最后修改:2011年1月2日 Sunday 18:50