This commit is contained in:
Кашин Максим 2022-12-13 20:50:52 +04:00
parent 906c5ab582
commit b126dd0068
2 changed files with 5 additions and 5 deletions

View File

@ -45,7 +45,7 @@ public class DrawingObjectGasolineTanker implements IDrawingObject {
} }
public static IDrawingObject Create(String data){ public static IDrawingObject Create(String data){
return new DrawingObjectGasolineTanker(ExtentionGasolineTanker.CreateDrawingWarship(data)); return new DrawingObjectGasolineTanker(ExtentionGasolineTanker.CreateDrawingGasolineTanker(data));
} }
public DrawingGasolineTanker GetGasolineTanker() { public DrawingGasolineTanker GetGasolineTanker() {

View File

@ -3,13 +3,13 @@ import java.awt.*;
public class ExtentionGasolineTanker { public class ExtentionGasolineTanker {
private static final char _separatorForObject=':'; private static final char _separatorForObject=':';
public static DrawingGasolineTanker CreateDrawingWarship(String info){ public static DrawingGasolineTanker CreateDrawingGasolineTanker(String info){
String[] strs = info.split(Character.toString(_separatorForObject)); String[] strs = info.split(Character.toString(_separatorForObject));
int spd=Integer.parseInt(strs[0]); int spd=Integer.parseInt(strs[0]);
float wght = Float.parseFloat(strs[1]); float wght = Float.parseFloat(strs[1]);
Color bodyClr=new Color(Integer.parseInt(strs[2])); Color bodyClr=new Color(Integer.parseInt(strs[2]));
IDrawningObjectWheels block = switch(strs[3]) { IDrawningObjectWheels wheels = switch(strs[3]) {
case "DrawingWheels" -> new DrawingWheels(Integer.parseInt(strs[4])); case "DrawingWheels" -> new DrawingWheels(Integer.parseInt(strs[4]));
case "DrawingOrnamentWheelsFirst" -> new DrawingOrnamentWheelsFirst(Integer.parseInt(strs[4])); case "DrawingOrnamentWheelsFirst" -> new DrawingOrnamentWheelsFirst(Integer.parseInt(strs[4]));
case "DrawingOrnamentWheelsSecond" -> new DrawingOrnamentWheelsSecond(Integer.parseInt(strs[4])); case "DrawingOrnamentWheelsSecond" -> new DrawingOrnamentWheelsSecond(Integer.parseInt(strs[4]));
@ -17,14 +17,14 @@ public class ExtentionGasolineTanker {
}; };
if (strs.length==5){ if (strs.length==5){
EntityGasolineTanker ent=new EntityGasolineTanker(spd,wght,bodyClr); EntityGasolineTanker ent=new EntityGasolineTanker(spd,wght,bodyClr);
return new DrawingGasolineTanker(ent,block); return new DrawingGasolineTanker(ent,wheels);
} }
if(strs.length==8){ if(strs.length==8){
Color dopClr=new Color(Integer.parseInt(strs[5])); Color dopClr=new Color(Integer.parseInt(strs[5]));
boolean bdkit=Boolean.parseBoolean(strs[6]); boolean bdkit=Boolean.parseBoolean(strs[6]);
boolean ant=Boolean.parseBoolean(strs[7]); boolean ant=Boolean.parseBoolean(strs[7]);
EntityImprovedGasolineTanker ent = new EntityImprovedGasolineTanker(spd,wght,bodyClr,dopClr,bdkit,ant); EntityImprovedGasolineTanker ent = new EntityImprovedGasolineTanker(spd,wght,bodyClr,dopClr,bdkit,ant);
return new DrawingImprovedGasolineTanker(ent,block); return new DrawingImprovedGasolineTanker(ent,wheels);
} }
return null; return null;
} }