public void EndMatch() { Broadcast("match_end", new NullMessage()); ManagerComponent.Get().StartCoroutine(Delete()); var gameServerHandler = GameServerHandler.Get(); gameServerHandler.SendMm("match_end", new MatchEndMessage(matchId)); }
public Match(Func <Match, ServerGameMaster> createGameMaster, string createMatchMessage) { gameMaster = createGameMaster(this); gameMaster.CreateMatch(createMatchMessage); blobAssetStore = new BlobAssetStore(); nbPlayers = gameMaster.nbPlayers; players = new List <Player> (); handler = GameServerHandler.Get(); InitWorld(matchId.ToString()); gameMaster.OnMatchReady(); }
public IEnumerator Delete() { var gameServerHandler = GameServerHandler.Get(); foreach (var p in players) { gameServerHandler.clients.Remove(p.client.ep.ToString()); } gameMaster.OnEveryPlayerLeaved(); blobAssetStore.Dispose(); world.QuitUpdate = true; ScriptBehaviourUpdateOrder.SetPlayerLoop(PlayerLoop.GetDefaultPlayerLoop()); world.EntityManager.CompleteAllJobs(); world.EntityManager.DestroyEntity(world.EntityManager.GetAllEntities()); yield return(new WaitForEndOfFrame()); world.Dispose(); gameServerHandler.matches.Remove(matchId); }