Some Main GUI refactor, addHover more than one ecc.
This commit is contained in:
@@ -104,7 +104,7 @@ public class Game implements Serializable {
|
|||||||
{
|
{
|
||||||
while(disconnetedPlayers.containsKey(nextPlayer)&& disconnetedPlayers.get(nextPlayer))
|
while(disconnetedPlayers.containsKey(nextPlayer)&& disconnetedPlayers.get(nextPlayer))
|
||||||
{
|
{
|
||||||
nextPlayer.totem=getAvailableTotems().get(new Random().nextInt(getAvailableTotems().size()-1));
|
nextPlayer.totem=getAvailableTotems().get(new Random().nextInt(0,getAvailableTotems().size()));
|
||||||
nextPlayer=totemChoiceQueue.poll();
|
nextPlayer=totemChoiceQueue.poll();
|
||||||
if(nextPlayer==null)
|
if(nextPlayer==null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,11 +113,7 @@ public class ServerLauncher {
|
|||||||
{
|
{
|
||||||
if(event.getEventType() != EventType.RECONNECT_PLAYER)
|
if(event.getEventType() != EventType.RECONNECT_PLAYER)
|
||||||
{
|
{
|
||||||
event.setIsError(true);
|
if(event.getEventType() == EventType.DISCONNECTED_PLAYER)
|
||||||
serverRMI.notifyAll(event);
|
|
||||||
serverTCP.notifyAll(event);
|
|
||||||
return false;
|
|
||||||
}else if(event.getEventType() != EventType.DISCONNECTED_PLAYER)
|
|
||||||
{
|
{
|
||||||
disconnectionTimer.cancel(true);
|
disconnectionTimer.cancel(true);
|
||||||
disconnectionTimer = null;
|
disconnectionTimer = null;
|
||||||
@@ -126,6 +122,11 @@ public class ServerLauncher {
|
|||||||
System.out.println("\n!!! Player list is now empty, ready for a new game init !!!\n");
|
System.out.println("\n!!! Player list is now empty, ready for a new game init !!!\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
event.setIsError(true);
|
||||||
|
serverRMI.notifyAll(event);
|
||||||
|
serverTCP.notifyAll(event);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized(gameController){
|
synchronized(gameController){
|
||||||
|
|||||||
@@ -70,13 +70,15 @@ public class MainFXMLController {
|
|||||||
|
|
||||||
public void setController(ClientController controller) {
|
public void setController(ClientController controller) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
|
skipBtn.setOnAction(e -> controller.skipTurn());
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
Font.loadFont(getClass().getResourceAsStream("/Fonts/InknutAntiqua-Regular.ttf"), 14);
|
Font.loadFont(getClass().getResourceAsStream("/Fonts/InknutAntiqua-Regular.ttf"), 14);
|
||||||
|
|
||||||
|
addHoverZoom(skipBtn);
|
||||||
|
addHoverZoom(detailsBtn);
|
||||||
popup = new Popup();
|
popup = new Popup();
|
||||||
mainHBox.sceneProperty().addListener((obs, oldScene, newScene) -> {
|
mainHBox.sceneProperty().addListener((obs, oldScene, newScene) -> {
|
||||||
if (newScene != null) {
|
if (newScene != null) {
|
||||||
@@ -97,6 +99,7 @@ public class MainFXMLController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
initPopup();
|
initPopup();
|
||||||
|
detailsBtn.setOnAction(e -> openDetailsPopup());
|
||||||
renderBackground();
|
renderBackground();
|
||||||
isError=false;
|
isError=false;
|
||||||
}
|
}
|
||||||
@@ -181,7 +184,12 @@ public class MainFXMLController {
|
|||||||
totem.fitHeightProperty().bind(img.fitHeightProperty().multiply(0.332));
|
totem.fitHeightProperty().bind(img.fitHeightProperty().multiply(0.332));
|
||||||
totem.setPreserveRatio(true);
|
totem.setPreserveRatio(true);
|
||||||
StackPane.setAlignment(totem, Pos.TOP_LEFT);
|
StackPane.setAlignment(totem, Pos.TOP_LEFT);
|
||||||
|
img.fitHeightProperty().addListener((obs, ov, nv) -> {
|
||||||
|
StackPane.setMargin(totem, new Insets(0, 0, 0, 0.224 * nv.doubleValue()));
|
||||||
|
});
|
||||||
|
if (img.getFitHeight() > 0) {
|
||||||
StackPane.setMargin(totem, new Insets(0, 0, 0, 0.224 * img.getFitHeight()));
|
StackPane.setMargin(totem, new Insets(0, 0, 0, 0.224 * img.getFitHeight()));
|
||||||
|
}
|
||||||
wrapper.getChildren().add(totem);
|
wrapper.getChildren().add(totem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +201,11 @@ public class MainFXMLController {
|
|||||||
private StackPane createCard(PlayableCard card, boolean withZoom, boolean withShadow, Region parent) {
|
private StackPane createCard(PlayableCard card, boolean withZoom, boolean withShadow, Region parent) {
|
||||||
ImageView img = new ImageView(loadImage("/GUIImages/Fronts/card-" + card.getIdIMG() + ".png"));
|
ImageView img = new ImageView(loadImage("/GUIImages/Fronts/card-" + card.getIdIMG() + ".png"));
|
||||||
img.setPreserveRatio(true);
|
img.setPreserveRatio(true);
|
||||||
|
if(controller.miniModel.players.size()==5)
|
||||||
|
{
|
||||||
|
img.fitHeightProperty().bind(parent.getScene().heightProperty().subtract(56).divide(4).multiply(0.85));
|
||||||
|
}
|
||||||
|
else
|
||||||
img.fitHeightProperty().bind(parent.getScene().heightProperty().subtract(56).divide(4).multiply(0.90));
|
img.fitHeightProperty().bind(parent.getScene().heightProperty().subtract(56).divide(4).multiply(0.90));
|
||||||
addClip(img);
|
addClip(img);
|
||||||
StackPane wrapper = new StackPane(img);
|
StackPane wrapper = new StackPane(img);
|
||||||
@@ -558,11 +571,6 @@ public class MainFXMLController {
|
|||||||
|
|
||||||
private void renderSidePanel() {
|
private void renderSidePanel() {
|
||||||
infoText.setText("Round: "+Integer.toString(controller.miniModel.currentState.getRound()) + " • " + controller.miniModel.currentState.getGameStage().toString());
|
infoText.setText("Round: "+Integer.toString(controller.miniModel.currentState.getRound()) + " • " + controller.miniModel.currentState.getGameStage().toString());
|
||||||
skipBtn.setOnAction(e -> controller.skipTurn());
|
|
||||||
detailsBtn.setOnAction(e -> openDetailsPopup());
|
|
||||||
|
|
||||||
addHoverZoom(skipBtn);
|
|
||||||
addHoverZoom(detailsBtn);
|
|
||||||
|
|
||||||
VBox playerList = new VBox();
|
VBox playerList = new VBox();
|
||||||
playerList.setFillWidth(true);
|
playerList.setFillWidth(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user