4
This commit is contained in:
parent
bcf9a1a058
commit
30d3353001
@ -25,8 +25,6 @@ public class ControllerBoat {
|
||||
@FXML
|
||||
private Label labelWeightValue;
|
||||
@FXML
|
||||
private Label labelBodyColorValue;
|
||||
@FXML
|
||||
private ComboBox<String> comboBoxNumOars;
|
||||
@FXML
|
||||
private ComboBox<String> comboBoxOarsType;
|
||||
@ -82,7 +80,7 @@ public class ControllerBoat {
|
||||
bodyColorPicker.setValue(Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
|
||||
}
|
||||
_boat = new DrawningBoat(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000,
|
||||
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
|
||||
bodyColorPicker.getValue());
|
||||
SetData();
|
||||
Draw();
|
||||
}
|
||||
@ -96,8 +94,8 @@ public class ControllerBoat {
|
||||
dopColorPicker.setValue(Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
|
||||
}
|
||||
_boat = new DrawningSpeedboat(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000,
|
||||
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
|
||||
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
|
||||
bodyColorPicker.getValue(),
|
||||
dopColorPicker.getValue(),
|
||||
(rnd.nextInt(2) != 0), (rnd.nextInt(2) != 0), (rnd.nextInt(2) != 0));
|
||||
SetData();
|
||||
Draw();
|
||||
|
@ -95,7 +95,7 @@ public class ControllerMapWithSetBoats {
|
||||
|
||||
Stage stageBoat = new Stage();
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(FormBoat.class.getResource("form-boat-view.fxml"));
|
||||
Scene sceneBoat = new Scene(fxmlLoader.load(), 320, 240);
|
||||
Scene sceneBoat = new Scene(fxmlLoader.load(), 500, 400);
|
||||
|
||||
FirstUpdateBoatGUI(sceneBoat, stageBoat, fxmlLoader, false);
|
||||
|
||||
@ -221,15 +221,15 @@ public class ControllerMapWithSetBoats {
|
||||
addMapAlert.showAndWait();
|
||||
}
|
||||
else {
|
||||
Stage stageArmoredVehicle = new Stage();
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(FormBoat.class.getResource("form-removed-armored-boat.fxml"));
|
||||
Scene sceneArmoredVehicle = new Scene(fxmlLoader.load(), 320, 240);
|
||||
Stage stageBoat = new Stage();
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(FormBoat.class.getResource("form-removed-boat-view.fxml"));
|
||||
Scene sceneBoat = new Scene(fxmlLoader.load(), 320, 240);
|
||||
|
||||
FirstUpdateBoatGUI(sceneArmoredVehicle, stageArmoredVehicle, fxmlLoader, true);
|
||||
FirstUpdateBoatGUI(sceneBoat, stageBoat, fxmlLoader, true);
|
||||
|
||||
stageArmoredVehicle.setTitle("Removed armored vehicle");
|
||||
stageArmoredVehicle.setScene(sceneArmoredVehicle);
|
||||
stageArmoredVehicle.show();
|
||||
stageBoat.setTitle("Removed armored vehicle");
|
||||
stageBoat.setScene(sceneBoat);
|
||||
stageBoat.show();
|
||||
|
||||
ControllerRemovedBoat controllerRemovedBoat = fxmlLoader.getController();
|
||||
controllerRemovedBoat.SetBoat(_removedBoats.pop());
|
||||
|
@ -18,21 +18,18 @@ public class DrawningSpeedboat extends DrawningBoat {
|
||||
gc.setLineWidth(2);
|
||||
|
||||
_startPosX += 25;
|
||||
_startPosY -= 30;
|
||||
super.DrawTransport(gc);
|
||||
_startPosX -= 25;
|
||||
_startPosY += 30;
|
||||
|
||||
if (speedboat.GetWing()) {
|
||||
gc.setFill(speedboat.GetDopColor());
|
||||
gc.fillRect(_startPosX, _startPosY, 20, 80);
|
||||
gc.strokeRect(_startPosX, _startPosY, 20, 80);
|
||||
gc.fillRect(_startPosX, _startPosY+30, 20, 80);
|
||||
gc.strokeRect(_startPosX, _startPosY+30, 20, 80);
|
||||
gc.setFill(speedboat.GetBodyColor());
|
||||
gc.fillRect(_startPosX + 20, _startPosY + 20, 10, 40);
|
||||
gc.strokeRect(_startPosX + 20, _startPosY + 20, 10, 40);
|
||||
gc.fillRect(_startPosX + 20, _startPosY + 50, 10, 40);
|
||||
gc.strokeRect(_startPosX + 20, _startPosY + 50, 10, 40);
|
||||
}
|
||||
_startPosX += 25;
|
||||
_startPosY += 10;
|
||||
if (speedboat.GetBodyKit()) {
|
||||
double[] bodyKitX = {
|
||||
_startPosX + 120,
|
||||
@ -43,12 +40,12 @@ public class DrawningSpeedboat extends DrawningBoat {
|
||||
_startPosX + 120
|
||||
};
|
||||
double[] bodyKitY = {
|
||||
_startPosY + 10,
|
||||
_startPosY + 30,
|
||||
_startPosY + 50,
|
||||
_startPosY + 45,
|
||||
_startPosY + 30,
|
||||
_startPosY + 15
|
||||
_startPosY + 70,
|
||||
_startPosY + 90,
|
||||
_startPosY + 85,
|
||||
_startPosY + 70,
|
||||
_startPosY + 55
|
||||
};
|
||||
gc.setFill(speedboat.GetDopColor());
|
||||
gc.fillPolygon(bodyKitX, bodyKitY, 6);
|
||||
@ -61,17 +58,16 @@ public class DrawningSpeedboat extends DrawningBoat {
|
||||
_startPosX + 110
|
||||
};
|
||||
double[] sportLineY = {
|
||||
_startPosY,
|
||||
_startPosY,
|
||||
_startPosY + 60,
|
||||
_startPosY + 60
|
||||
_startPosY + 40,
|
||||
_startPosY + 40,
|
||||
_startPosY + 100,
|
||||
_startPosY + 100
|
||||
};
|
||||
gc.setFill(speedboat.GetDopColor());
|
||||
gc.fillPolygon(sportLineX, sportLineY, 4);
|
||||
gc.setFill(Color.BROWN);
|
||||
gc.fillOval(_startPosX + 10, _startPosY + 10, 110, 40);
|
||||
gc.fillOval(_startPosX + 10, _startPosY + 50, 110, 40);
|
||||
}
|
||||
_startPosX -= 25;
|
||||
_startPosY -= 10;
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ public class FormMapWithSetBoats extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(FormBoat.class.getResource("form-map-with-set-boats-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 640, 540);
|
||||
Scene scene = new Scene(fxmlLoader.load(), 1000, 540);
|
||||
|
||||
FirstUpdateGUI(scene, fxmlLoader);
|
||||
|
||||
|
@ -6,8 +6,8 @@ import javafx.scene.paint.Color;
|
||||
public class MapWithSetBoatsGeneric <T extends IDrawningObject, U extends AbstractMap> {
|
||||
private final int _pictureWidth;
|
||||
private final int _pictureHeight;
|
||||
private final int _placeSizeWidth = 210;
|
||||
private final int _placeSizeHeight = 90;
|
||||
private final int _placeSizeWidth = 400;
|
||||
private final int _placeSizeHeight = 150;
|
||||
private final SetBoatsGeneric<T> _setBoats;
|
||||
private GraphicsContext _graphicsContext = null;
|
||||
private final U _map;
|
||||
@ -20,9 +20,9 @@ public class MapWithSetBoatsGeneric <T extends IDrawningObject, U extends Abstra
|
||||
_map = map;
|
||||
_graphicsContext = gc;
|
||||
}
|
||||
public int Add(T armoredVehicle)
|
||||
public int Add(T boat)
|
||||
{
|
||||
return _setBoats.Insert(armoredVehicle);
|
||||
return _setBoats.Insert(boat);
|
||||
}
|
||||
public T Delete(int position)
|
||||
{
|
||||
@ -43,7 +43,7 @@ public class MapWithSetBoatsGeneric <T extends IDrawningObject, U extends Abstra
|
||||
}
|
||||
public void ShowSet() {
|
||||
DrawBackground();
|
||||
DrawArmoredVehicles();
|
||||
DrawBoats();
|
||||
}
|
||||
public void MoveObject(Direction direction) {
|
||||
if (_map != null) {
|
||||
@ -99,26 +99,25 @@ public class MapWithSetBoatsGeneric <T extends IDrawningObject, U extends Abstra
|
||||
_graphicsContext.closePath();
|
||||
}
|
||||
}
|
||||
private void DrawArmoredVehicles() {
|
||||
private void DrawBoats() {
|
||||
int yNumOfPlaces = _pictureHeight / _placeSizeHeight;
|
||||
int xNumOfPlaces = _pictureWidth / _placeSizeWidth;
|
||||
|
||||
int RowIndex = yNumOfPlaces - 1;
|
||||
int RowIndex = 0;
|
||||
int ColumnIndex = 0;
|
||||
|
||||
for (T armoredVehicle : _setBoats) {
|
||||
if (armoredVehicle != null) {
|
||||
float[] position = armoredVehicle.GetCurrentPosition();
|
||||
armoredVehicle.SetObject(ColumnIndex *_placeSizeWidth,
|
||||
RowIndex * _placeSizeHeight + (_placeSizeHeight - (int)(position[3] - position[1])),
|
||||
for (T boat : _setBoats) {
|
||||
if (boat != null) {
|
||||
float[] position = boat.GetCurrentPosition();
|
||||
boat.SetObject(ColumnIndex *_placeSizeWidth,
|
||||
RowIndex * _placeSizeHeight + (_placeSizeHeight - (int)(position[3]-position[1])) - 70,
|
||||
_pictureWidth, _pictureHeight);
|
||||
armoredVehicle.DrawningObject(_graphicsContext);
|
||||
boat.DrawningObject(_graphicsContext);
|
||||
}
|
||||
if (ColumnIndex == xNumOfPlaces - 1) {
|
||||
if (ColumnIndex == xNumOfPlaces-1) {
|
||||
ColumnIndex = 0;
|
||||
RowIndex--;
|
||||
}
|
||||
else {
|
||||
RowIndex++;
|
||||
} else {
|
||||
ColumnIndex++;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
-
|
||||
</Label>
|
||||
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
|
||||
Rollers:
|
||||
Oars:
|
||||
</Label>
|
||||
<ComboBox fx:id="comboBoxNumOars" value="5" onAction="#ComboBoxNumOars_Changed">
|
||||
<items>
|
||||
|
Loading…
x
Reference in New Issue
Block a user