vooga.replay.core
Class VoogaSave

java.lang.Object
  extended by vooga.replay.core.VoogaSave
All Implemented Interfaces:
java.io.Serializable

public class VoogaSave
extends java.lang.Object
implements java.io.Serializable

VoogaSave is responsible for saving information about the game such as the game state and user actions. A VoogaSave should be constructed for every game being played and resumed.

Author:
Carrie Ho, Tom Donnelly, Van Dang
See Also:
Serialized Form

Constructor Summary
VoogaSave(java.lang.String user, java.lang.String gameName)
          Constructor for when the game is first played.
 
Method Summary
 void addReplayPoint()
          Adds a replay point to the map
 long getCurrentTime()
          Gets the latest time that the game was running
 java.lang.String getGameName()
          Gets the game name
 java.util.TreeMap<java.lang.Long,java.lang.String> getReplayPointsMap()
          Gets a map containing the replay points.
 java.lang.String getUniqueGameName()
           
 java.lang.String getUser()
          Gets the user
 java.util.Collection<UserAction> getUserActions()
          Gets the saved user actions
 void saveReplayObject(java.lang.Object replayObject, long time, boolean isFromNetwork)
          This method stores the information necessary to replay the game.
 void saveReplayPoint(long time)
          This method is called whenever the user hits the button to mark a convenient replay point.
 void saveTime(long inputTime)
          This method is called by the Game Engine group so that we have the current game time every game loop iteration.
 void serialize()
          This method serializes the maps and the list of games to resume.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VoogaSave

public VoogaSave(java.lang.String user,
                 java.lang.String gameName)
Constructor for when the game is first played.

Parameters:
users -
Method Detail

saveReplayObject

public void saveReplayObject(java.lang.Object replayObject,
                             long time,
                             boolean isFromNetwork)
This method stores the information necessary to replay the game. (i.e. This method should be called every time there is user input)

Parameters:
object - to save

saveTime

public void saveTime(long inputTime)
This method is called by the Game Engine group so that we have the current game time every game loop iteration.

Parameters:
inputTime - This parameter is the current game time passed from the game.F engine

saveReplayPoint

public void saveReplayPoint(long time)
This method is called whenever the user hits the button to mark a convenient replay point.

Parameters:
gameState -
time -

serialize

public void serialize()
This method serializes the maps and the list of games to resume. This method is called when the game is finished or when the game is exited.

Parameters:
gameState -
fileName -

getUserActions

public java.util.Collection<UserAction> getUserActions()
Gets the saved user actions

Returns:
Collection

getReplayPointsMap

public java.util.TreeMap<java.lang.Long,java.lang.String> getReplayPointsMap()
Gets a map containing the replay points. It maps the time of the replay point to the label for the replay point.

Returns:
map of time to replay point label

addReplayPoint

public void addReplayPoint()
Adds a replay point to the map

Parameters:
time -

getCurrentTime

public long getCurrentTime()
Gets the latest time that the game was running

Returns:

getUser

public java.lang.String getUser()
Gets the user

Returns:
the user name

getGameName

public java.lang.String getGameName()
Gets the game name

Returns:
the game name

getUniqueGameName

public java.lang.String getUniqueGameName()