mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Boat Names Change. Colors Change too. Updates clients during lobby when a change is made.
tags: #story[1142]
This commit is contained in:
@@ -23,9 +23,8 @@ import javafx.scene.paint.Paint;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.scene.shape.Polygon;
|
||||
import javafx.scene.text.Text;
|
||||
import seng302.model.ClientYacht;
|
||||
import javafx.util.Duration;
|
||||
import seng302.model.Colors;
|
||||
import seng302.model.ClientYacht;
|
||||
import seng302.model.GeoPoint;
|
||||
import seng302.model.Limit;
|
||||
import seng302.model.mark.CompoundMark;
|
||||
@@ -351,7 +350,7 @@ public class GameView extends Pane {
|
||||
BoatObject newBoat;
|
||||
final List<Group> wakes = new ArrayList<>();
|
||||
for (ClientYacht clientYacht : clientYachts) {
|
||||
Paint colour = Colors.getColor();
|
||||
Paint colour = clientYacht.getColour();
|
||||
newBoat = new BoatObject();
|
||||
newBoat.setFill(colour);
|
||||
boatObjects.put(clientYacht, newBoat);
|
||||
|
||||
@@ -4,6 +4,8 @@ import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ColorPicker;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
import seng302.gameServer.server.messages.CustomizeRequestType;
|
||||
import seng302.visualiser.ClientToServerThread;
|
||||
|
||||
@@ -19,6 +21,7 @@ public class CustomizationController {
|
||||
private Button customizeSubmit;
|
||||
|
||||
private ClientToServerThread socketThread;
|
||||
private Stage windowStage;
|
||||
|
||||
public void initialize() {
|
||||
|
||||
@@ -33,8 +36,24 @@ public class CustomizationController {
|
||||
System.out.println("Attempting to send");
|
||||
socketThread.sendCustomizationRequest(CustomizeRequestType.NAME, nameField.getText().getBytes());
|
||||
// TODO: 16/08/17 ajm412: Turn colors into byte array.
|
||||
socketThread.sendCustomizationRequest(CustomizeRequestType.COLOR,
|
||||
boatColorPicker.getValue().toString().getBytes());
|
||||
Color color = boatColorPicker.getValue();
|
||||
|
||||
short red = (short) (color.getRed() * 255);
|
||||
short green = (short) (color.getGreen() * 255);
|
||||
short blue = (short) (color.getBlue() * 255);
|
||||
|
||||
byte[] colorArray = new byte[3];
|
||||
|
||||
colorArray[0] = (byte) red;
|
||||
colorArray[1] = (byte) green;
|
||||
colorArray[2] = (byte) blue;
|
||||
|
||||
socketThread.sendCustomizationRequest(CustomizeRequestType.COLOR, colorArray);
|
||||
windowStage.close();
|
||||
}
|
||||
|
||||
public void setStage(Stage stage) {
|
||||
this.windowStage = stage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package seng302.visualiser.controllers;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.media.jfxmedia.logging.Logger;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
@@ -18,9 +21,7 @@ import javafx.stage.Stage;
|
||||
import seng302.gameServer.GameStages;
|
||||
import seng302.gameServer.GameState;
|
||||
import seng302.model.RaceState;
|
||||
import seng302.visualiser.GameClient;
|
||||
import seng302.visualiser.ClientToServerThread;
|
||||
import seng302.visualiser.GameView;
|
||||
|
||||
/**
|
||||
* A class describing the actions of the lobby screen
|
||||
@@ -153,6 +154,7 @@ public class LobbyController {
|
||||
cc.setServerThread(this.socketThread);
|
||||
customizeStage.setTitle("Customize Boat");
|
||||
customizeStage.setScene(new Scene(root, 700, 450));
|
||||
cc.setStage(customizeStage); // pass the stage through so it can be closed later.
|
||||
customizeStage.show();
|
||||
} catch (IOException e) {
|
||||
Logger.logMsg(4, "Failed to load Customization View from resources.");
|
||||
|
||||
Reference in New Issue
Block a user