protected override void OnTick(float delta) { base.OnTick(delta); if (needMapLoadName != null) { string name = needMapLoadName; needMapLoadName = null; ServerOrSingle_MapLoad(name, EntitySystemWorld.Instance.DefaultWorldType, false); } if (needMapCreateForDynamicMapExample) { needMapCreateForDynamicMapExample = false; DynamicCreatedMapExample.ServerOrSingle_MapCreate(); } if (needWorldLoadName != null) { string name = needWorldLoadName; needWorldLoadName = null; WorldLoad(name); } if (EngineConsole.Instance != null) { EngineConsole.Instance.DoTick(delta); } controlManager.DoTick(delta); //update server GameNetworkServer server = GameNetworkServer.Instance; if (server != null) { server.Update(); } //update client GameNetworkClient client = GameNetworkClient.Instance; if (client != null) { client.Update(); //check for disconnection if (client_AllowCheckForDisconnection) { if (client.Status == NetworkConnectionStatuses.Disconnected) { Client_DisconnectFromServer(); Log.Error("Disconnected from server.\n\nReason: \"{0}\"", client.DisconnectionReason); } } } }
void Client_EntitySystemService_WorldCreateEnd(EntitySystemClientNetworkService sender) { //dynamic created map example if (string.IsNullOrEmpty(Map.Instance.VirtualFileName)) { DynamicCreatedMapExample.Client_CreateEntities(); } //play music if (GameMap.Instance != null) { GameMusic.MusicPlay(GameMap.Instance.GameMusic, true); } CreateGameWindowForMap(); }