/** * Deserialize recorded data. */ public void deserializeRecordAndReplayData() { String recordingPath = PathManager.getInstance().getRecordingPath(recordAndReplayUtils.getGameTitle()).toString(); deserializeRecordedEvents(recordingPath); Gson gson = new GsonBuilder().create(); deserializeFileAmount(gson, recordingPath); deserializeCharacterStateEventPositonMap(gson, recordingPath); deserializeAttackEventExtraRecorder(gson, recordingPath); }
/** * Serialize the recorded data. */ public void serializeRecordAndReplayData() { String recordingPath = PathManager.getInstance().getRecordingPath(recordAndReplayUtils.getGameTitle()).toString(); serializeRecordedEvents(recordingPath); Gson gson = new GsonBuilder().create(); serializeFileAmount(gson, recordingPath); serializeCharacterStateEventPositonMap(gson, recordingPath); serializeAttackEventExtraRecorder(gson, recordingPath); }
CharacterStateEventPositionMap characterStateEventPositionMap = new CharacterStateEventPositionMap(); DirectionAndOriginPosRecorderList directionAndOriginPosRecorderList = new DirectionAndOriginPosRecorderList(); recordAndReplaySerializer = new RecordAndReplaySerializer(entityManager, recordedEventStore, recordAndReplayUtils, characterStateEventPositionMap, directionAndOriginPosRecorderList, moduleEnvironment); recordAndReplayCurrentStatus = context.get(RecordAndReplayCurrentStatus.class);
private void loadNextRecordedEventFile() { String recordingPath = PathManager.getInstance().getRecordingPath(recordAndReplayUtils.getGameTitle()).toString(); recordAndReplaySerializer.deserializeRecordedEvents(recordingPath); fillRecordedEvents(); }
@Override public boolean step() { //Activate record when the preparations are ready if (recordAndReplayCurrentStatus.getStatus() == RecordAndReplayStatus.PREPARING_RECORD) { recordAndReplayCurrentStatus.setStatus(RecordAndReplayStatus.RECORDING); } //Activate the replay when the preparations are ready if (recordAndReplayCurrentStatus.getStatus() == RecordAndReplayStatus.PREPARING_REPLAY) { recordAndReplaySerializer.deserializeRecordAndReplayData(); recordAndReplayCurrentStatus.setStatus(RecordAndReplayStatus.REPLAYING); } return true; }
CharacterStateEventPositionMap characterStateEventPositionMap = new CharacterStateEventPositionMap(); DirectionAndOriginPosRecorderList directionAndOriginPosRecorderList = new DirectionAndOriginPosRecorderList(); RecordAndReplaySerializer recordAndReplaySerializer = new RecordAndReplaySerializer(entityManager, eventStore, recordAndReplayUtils, characterStateEventPositionMap, directionAndOriginPosRecorderList, null); recordAndReplayCurrentStatus.setStatus(RecordAndReplayStatus.REPLAYING); entity = entityManager.create();
DirectionAndOriginPosRecorderList directionAndOriginPosRecorderList = new DirectionAndOriginPosRecorderList(); context.put(DirectionAndOriginPosRecorderList.class, directionAndOriginPosRecorderList); RecordAndReplaySerializer recordAndReplaySerializer = new RecordAndReplaySerializer(engineEntityManager, recordedEventStore, recordAndReplayUtils, characterStateEventPositionMap, directionAndOriginPosRecorderList, moduleManager.getEnvironment()); context.put(RecordAndReplaySerializer.class, recordAndReplaySerializer);
DirectionAndOriginPosRecorderList directionAndOriginPosRecorderList = context.get(DirectionAndOriginPosRecorderList.class); RecordedEventStore recordedEventStore = new RecordedEventStore(); RecordAndReplaySerializer recordAndReplaySerializer = new RecordAndReplaySerializer(entityManager, recordedEventStore, recordAndReplayUtils, characterStateEventPositionMap, directionAndOriginPosRecorderList, environment); context.put(RecordAndReplaySerializer.class, recordAndReplaySerializer);