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");
	}
}
Page last updated: 2011-1-2