private void CustomFromClientToCentralServer_RegisterServerMessages() { // In map-server there is client which connect to central-server, the field is `CentralAppServerRegister` // So developer may register `CentralAppServerRegister` messages here CentralAppServerRegister.RegisterMessage(10001, SampleHandleMsgFromCentralServer); // Server will receive this message from clients, then send it to central server by `CentralAppServerRegister` RegisterServerMessage(10001, SampleHandleMsgFromClient); }
protected override void Awake() { base.Awake(); if (useWebSocket) { if (centralTransportFactory == null || !centralTransportFactory.CanUseWithWebGL) { centralTransportFactory = gameObject.AddComponent <WebSocketTransportFactory>(); } } else { if (centralTransportFactory == null) { centralTransportFactory = gameObject.AddComponent <LiteNetLibTransportFactory>(); } } CentralAppServerRegister = new CentralAppServerRegister(CentralTransportFactory.Build(), this); CentralAppServerRegister.onAppServerRegistered = OnAppServerRegistered; CentralAppServerRegister.RegisterMessage(MMOMessageTypes.RequestSpawnMap, HandleRequestSpawnMap); this.InvokeInstanceDevExtMethods("OnInitCentralAppServerRegister"); }