Beispiel #1
0
func (this *Crossdomain) init() {
	this.serverSocket = tbs.CreateServerSocket()
	this.dispatcher = tbs.SharedDispatcher()

	var cb1 tbs.EventCallback = this.onServerStarted
	var cb2 tbs.EventCallback = this.onAccept

	this.dispatcher.AddEventListener(tbs.ServerStarted, &cb1)
	this.dispatcher.AddEventListener(tbs.Accept, &cb2)
}
Beispiel #2
0
func (this *GameMain) init() {
	m := md5.New()
	m.Write([]byte("jsj092"))
	println(hex.EncodeToString(m.Sum(nil)))

	model.SharedPlayerModel()

	this.serverSocket = tbs.CreateServerSocket()

	this.ClientMap = make(map[int32]*Client)

	this.dispatcher = tbs.SharedDispatcher()

	var cb1 tbs.EventCallback = this.onServerStarted
	var cb2 tbs.EventCallback = this.onAccept

	this.dispatcher.AddEventListener(tbs.ServerStarted, &cb1)
	this.dispatcher.AddEventListener(tbs.Accept, &cb2)
}