Выполненная усложненная лабораторная работа №3(точно)
This commit is contained in:
parent
d61b6cf6c5
commit
45be5ff31c
@ -25,5 +25,15 @@ public class CreaterGeneric<T extends EntityWarship, U extends IDrawingObjectBlo
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
public DrawingWarship NewWarshipCreating()
|
||||||
|
{
|
||||||
|
Random rand=new Random();
|
||||||
|
DrawingWarship finalWarship;
|
||||||
|
T warship = (T)Warships[rand.nextInt(WarshipsCount)];
|
||||||
|
U block = (U)Blocks[rand.nextInt(BlocksCount)];
|
||||||
|
if(warship instanceof EntityAdvancedWarship){
|
||||||
|
return new DrawingAdvancedWarship(warship,block);
|
||||||
|
}
|
||||||
|
return new DrawingWarship(warship,block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@ public class DrawingAdvancedWarship extends DrawingWarship {
|
|||||||
Warship=new EntityAdvancedWarship(speed,weight,bodyColor,dopColor,Helipad,Antenna,Missile);
|
Warship=new EntityAdvancedWarship(speed,weight,bodyColor,dopColor,Helipad,Antenna,Missile);
|
||||||
Blocks= blockForm;
|
Blocks= blockForm;
|
||||||
}
|
}
|
||||||
|
public DrawingAdvancedWarship(EntityWarship warship,IDrawingObjectBlock block){
|
||||||
|
super(warship,block);
|
||||||
|
Warship = warship;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void DrawTransport(Graphics g) {
|
public void DrawTransport(Graphics g) {
|
||||||
|
@ -25,6 +25,10 @@ public class DrawingWarship {
|
|||||||
Warship = new EntityWarship(speed, weight, bodyColor);
|
Warship = new EntityWarship(speed, weight, bodyColor);
|
||||||
Blocks= blockForm;
|
Blocks= blockForm;
|
||||||
}
|
}
|
||||||
|
public DrawingWarship(EntityWarship warship,IDrawingObjectBlock block){
|
||||||
|
Warship = warship;
|
||||||
|
Blocks = block;
|
||||||
|
}
|
||||||
|
|
||||||
public IDrawingObjectBlock GetFormOfBlock(int FormOfBlock){
|
public IDrawingObjectBlock GetFormOfBlock(int FormOfBlock){
|
||||||
BlockForm temp = null;
|
BlockForm temp = null;
|
||||||
|
@ -99,7 +99,7 @@ public class FormCreater extends JDialog{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
createrGeneric.AddWarship(new EntityWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),color));
|
createrGeneric.AddWarship(new EntityWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),color));
|
||||||
_warship=new DrawingWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),color, fblock);
|
_warship=createrGeneric.NewWarshipCreating();
|
||||||
}
|
}
|
||||||
if (AdvancedRadioButton.isSelected()){
|
if (AdvancedRadioButton.isSelected()){
|
||||||
Color color1=JColorChooser.showDialog(this,"Выберите цвет корпуса корабля",Color.WHITE);
|
Color color1=JColorChooser.showDialog(this,"Выберите цвет корпуса корабля",Color.WHITE);
|
||||||
@ -112,8 +112,7 @@ public class FormCreater extends JDialog{
|
|||||||
}
|
}
|
||||||
createrGeneric.AddWarship(new EntityAdvancedWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),
|
createrGeneric.AddWarship(new EntityAdvancedWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),
|
||||||
color1,color2,HelipadCheckBox.isSelected(),AntennaCheckBox.isSelected(),MissileCheckBox.isSelected()));
|
color1,color2,HelipadCheckBox.isSelected(),AntennaCheckBox.isSelected(),MissileCheckBox.isSelected()));
|
||||||
_warship=new DrawingAdvancedWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),color1,color2,
|
_warship=createrGeneric.NewWarshipCreating();
|
||||||
HelipadCheckBox.isSelected(),AntennaCheckBox.isSelected(),MissileCheckBox.isSelected(),fblock);
|
|
||||||
}
|
}
|
||||||
_warship.SetPosition(rand.nextInt(100),rand.nextInt(100),getWidth(),getHeight());
|
_warship.SetPosition(rand.nextInt(100),rand.nextInt(100),getWidth(),getHeight());
|
||||||
repaint();
|
repaint();
|
||||||
|
Loading…
Reference in New Issue
Block a user