public void updateAdded(GameLogState update) { if (broadcastToSpectators) { sendUpdate(update); } }
private SpectatorGameLog generateLogMsg(GameLogState update) { return(new SpectatorGameLog() { broadcastID = broadcastID, gameLog = new GameLogState[] { update } }); }
public override void HandleNewLogEvents(List<string> newLogEvents, GameLogState log) { for (int i = 0; i < newLogEvents.Count; i++) { try { newLogEvents[i] = newLogEvents[i].Remove(0, 11); } catch { System.Diagnostics.Debug.WriteLine("error at cleartimestamps: " + newLogEvents[i]); } System.Diagnostics.Debug.WriteLine(newLogEvents[i]); } }
public void pushToRawLog(string[] data) { GameLogState newUpdate = new GameLogState() { updateNumber = updateCounter, log = data }; rawGameLog.Add(newUpdate); updateCounter++; spectatorModule.updateAdded(newUpdate); }
private void runAllGameHistory() { for (int i = updateCounter; i < historyLog.Count; i++) { GameLogState state = historyLog[i]; if (state.updateNumber != updateCounter) { requestMissingUpdates(); return; } displayNewUpdate(state); updateCounter++; } }
protected override void displayNewUpdate(GameLogState update) { if (gameOver) { return; } BoardUpdate state = SnakeGameLogProtocol.parseGameState(update.log[0]); if (state.gameOver) { handleAdminGameOver(state); } else { handleBoardUpdate(state); } }
private void sendUpdate(GameLogState update) { try { Msf.Connection.SendMessage((short)CustomMasterServerMSG.spectateLogUpdate, generateLogMsg(update), handleBroadcastResponse); } catch { Debug.LogError("Failed to send update msg"); } }
protected virtual void displayNewUpdate(GameLogState update) { }