Beispiel #1
0
 public void updateAdded(GameLogState update)
 {
     if (broadcastToSpectators)
     {
         sendUpdate(update);
     }
 }
Beispiel #2
0
 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]);
     }
 }
Beispiel #4
0
    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++;
        }
    }
Beispiel #6
0
        protected override void displayNewUpdate(GameLogState update)
        {
            if (gameOver)
            {
                return;
            }

            BoardUpdate state = SnakeGameLogProtocol.parseGameState(update.log[0]);

            if (state.gameOver)
            {
                handleAdminGameOver(state);
            }
            else
            {
                handleBoardUpdate(state);
            }
        }
Beispiel #7
0
 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)
 {
 }