Added DrawingObjectArtillery serialization and deserialization

This commit is contained in:
Сергей Полевой 2022-11-20 22:27:21 +04:00
parent ade75a5dc3
commit 8d4407de4c
2 changed files with 13 additions and 0 deletions

View File

@ -38,4 +38,16 @@ public class DrawingObjectArtillery implements IDrawingObject {
public void drawingObject(Graphics2D g) { public void drawingObject(Graphics2D g) {
_artillery.drawTransport(g); _artillery.drawTransport(g);
} }
public String getInfo() {
if (_artillery == null) {
return null;
}
return ArtillerySerde.serialize(_artillery);
}
public static IDrawingObject create(String data) {
return new DrawingObjectArtillery(ArtillerySerde.deserialize(data));
}
} }

View File

@ -6,4 +6,5 @@ public interface IDrawingObject {
void moveObject(Direction direction); void moveObject(Direction direction);
void drawingObject(Graphics2D g); void drawingObject(Graphics2D g);
float[] getCurrentPosition(); float[] getCurrentPosition();
String getInfo();
} }