protected override void onLobbyItemAdded(PartygameLobbyMmoItem item) { mmoItem = item; long arg = item.GetTimeStartedInSecondsSinceEpoc() + item.GetTimeToLiveInSeconds() - BufferLobbyStartTime; LobbyStartedAction.InvokeSafe(arg); }
private IEnumerator triggerTubeRace(PartyGameLobbyMmoItemTeamDefinition lobbyData, int templateId, int minutesBetweenLaunches, TubeRaceDefinition raceDefinition) { while (true) { yield return(new WaitForSeconds(minutesBetweenLaunches * 60 - lobbyData.LobbyLengthInSeconds)); PartygameLobbyMmoItem cpItem = new PartygameLobbyMmoItem { CreatorId = -1L, gameTemplateId = templateId, Id = new CPMMOItemId(generateMMOItemId(), CPMMOItemId.CPMMOItemParent.WORLD), playerData = "{\"Players\":[]}", timeStartedInSeconds = DateTime.UtcNow.GetTimeInSeconds(), timeToLive = lobbyData.LobbyLengthInSeconds }; processEvent(GameServerEvent.SERVER_ITEM_ADDED, cpItem); CPMMOItemPosition position = default(CPMMOItemPosition); position.Id = cpItem.Id; position.Position = lobbyData.LobbyLocation; processEvent(GameServerEvent.SERVER_ITEM_MOVED, position); TubeRaceWorldObject worldObject = new TubeRaceWorldObject(cpItem, processEvent, partyGameSessionManager, raceDefinition); worldObjects.Add(worldObject); yield return(new WaitForSeconds(lobbyData.LobbyLengthInSeconds)); worldObject.StartRace(); worldObjects.Remove(worldObject); processEvent(GameServerEvent.SERVER_ITEM_REMOVED, cpItem.Id); } }
public TubeRaceWorldObject(PartygameLobbyMmoItem cpItem, Action <GameServerEvent, object> processEvent, OfflineGameServerClient.PartyGameSessionManager partyGameSessionManager, TubeRaceDefinition raceDefinition) { this.cpItem = cpItem; this.processEvent = processEvent; this.partyGameSessionManager = partyGameSessionManager; this.raceDefinition = raceDefinition; usersInRace = new List <long>(); }
public TubeRaceGameSession(List <long> usersInRace, PartygameLobbyMmoItem cpItem, Action <GameServerEvent, object> processEvent, OfflineGameServerClient.PartyGameSessionManager partyGameSessionManager, TubeRaceDefinition raceDefinition) { userScores = new Dictionary <long, int>(); foreach (long item in usersInRace) { userScores.Add(item, 0); } this.cpItem = cpItem; this.processEvent = processEvent; this.partyGameSessionManager = partyGameSessionManager; this.raceDefinition = raceDefinition; timer = new Stopwatch(); }
protected override void onLobbyItemRemoved(PartygameLobbyMmoItem item) { mmoItem = null; LobbyEndedAction.InvokeSafe(); }
protected override void onLobbyItemUpdated(PartygameLobbyMmoItem item, PartyGamePlayerCollection players) { mmoItem = item; LobbyPlayersUpdatedAction.InvokeSafe(players); }