MasterServer.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年9月16日 Friday 15:02