public void cleanupOldPreGames() { foreach (PreGame p in AlbotPreGameModule.getAllGames().Where(p => p.getPeers().Count == 0)) { AlbotPreGameModule.removeGame(p, p.specs.roomID); } }
public override void Initialize(IServer server) { singleton = this; server.SetHandler((short)ServerCommProtocl.CreatePreGame, handleCreatePreGame); server.SetHandler((short)ServerCommProtocl.RequestJoinPreGame, handleRequestJoinPreGame); server.SetHandler((short)ServerCommProtocl.UpdatePreGame, handlePlayerReadyUpdate); server.SetHandler((short)ServerCommProtocl.StartPreGame, handleStartPreGame); server.SetHandler((short)ServerCommProtocl.RestartTrainingGame, handleRestartGame); server.SetHandler((short)ServerCommProtocl.SlotTypeChanged, handleSlotTypeChanged); server.SetHandler((short)ServerCommProtocl.StartSinglePlayerGame, handleStartSingleplayerGame); server.SetHandler((short)ServerCommProtocl.PlayerLeftPreGame, handlePlayerLeft); server.SetHandler((short)CustomMasterServerMSG.RunningGameInfo, handleRunningGamesInfoMsg); server.SetHandler((short)CustomMasterServerMSG.gameOverResult, handleGameOverMsg); spectatorModule.initPreGames(activeGames, allGamesDict, allGames); StartCoroutine(removeOldgames()); }
public void peerLeft(PreGamePeer p) { p.playerSlots.ForEach(i => setplayerSlotEmpty(i)); p.clearReferences(); lock (playerLock) connectedPeers.Remove(p); lock (playerLock) { if (connectedPeers.Count == 0) //Check if Game should be terminated { AlbotPreGameModule.removeGame(this, specs.roomID); } else { broadcastUpdate(); } } }