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))
|
||||
{
|
||||
nextPlayer.totem=getAvailableTotems().get(new Random().nextInt(getAvailableTotems().size()-1));
|
||||
nextPlayer.totem=getAvailableTotems().get(new Random().nextInt(0,getAvailableTotems().size()));
|
||||
nextPlayer=totemChoiceQueue.poll();
|
||||
if(nextPlayer==null)
|
||||
{
|
||||
|
||||
@@ -113,18 +113,19 @@ public class ServerLauncher {
|
||||
{
|
||||
if(event.getEventType() != EventType.RECONNECT_PLAYER)
|
||||
{
|
||||
if(event.getEventType() == EventType.DISCONNECTED_PLAYER)
|
||||
{
|
||||
disconnectionTimer.cancel(true);
|
||||
disconnectionTimer = null;
|
||||
playerList.clear();
|
||||
gameController.setModel(null);
|
||||
System.out.println("\n!!! Player list is now empty, ready for a new game init !!!\n");
|
||||
return true;
|
||||
}
|
||||
event.setIsError(true);
|
||||
serverRMI.notifyAll(event);
|
||||
serverTCP.notifyAll(event);
|
||||
return false;
|
||||
}else if(event.getEventType() != EventType.DISCONNECTED_PLAYER)
|
||||
{
|
||||
disconnectionTimer.cancel(true);
|
||||
disconnectionTimer = null;
|
||||
playerList.clear();
|
||||
gameController.setModel(null);
|
||||
System.out.println("\n!!! Player list is now empty, ready for a new game init !!!\n");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,13 +70,15 @@ public class MainFXMLController {
|
||||
|
||||
public void setController(ClientController controller) {
|
||||
this.controller = controller;
|
||||
skipBtn.setOnAction(e -> controller.skipTurn());
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
Font.loadFont(getClass().getResourceAsStream("/Fonts/InknutAntiqua-Regular.ttf"), 14);
|
||||
|
||||
|
||||
addHoverZoom(skipBtn);
|
||||
addHoverZoom(detailsBtn);
|
||||
popup = new Popup();
|
||||
mainHBox.sceneProperty().addListener((obs, oldScene, newScene) -> {
|
||||
if (newScene != null) {
|
||||
@@ -97,6 +99,7 @@ public class MainFXMLController {
|
||||
}
|
||||
});
|
||||
initPopup();
|
||||
detailsBtn.setOnAction(e -> openDetailsPopup());
|
||||
renderBackground();
|
||||
isError=false;
|
||||
}
|
||||
@@ -181,7 +184,12 @@ public class MainFXMLController {
|
||||
totem.fitHeightProperty().bind(img.fitHeightProperty().multiply(0.332));
|
||||
totem.setPreserveRatio(true);
|
||||
StackPane.setAlignment(totem, Pos.TOP_LEFT);
|
||||
StackPane.setMargin(totem, new Insets(0, 0, 0, 0.224 * img.getFitHeight()));
|
||||
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()));
|
||||
}
|
||||
wrapper.getChildren().add(totem);
|
||||
}
|
||||
|
||||
@@ -193,7 +201,12 @@ public class MainFXMLController {
|
||||
private StackPane createCard(PlayableCard card, boolean withZoom, boolean withShadow, Region parent) {
|
||||
ImageView img = new ImageView(loadImage("/GUIImages/Fronts/card-" + card.getIdIMG() + ".png"));
|
||||
img.setPreserveRatio(true);
|
||||
img.fitHeightProperty().bind(parent.getScene().heightProperty().subtract(56).divide(4).multiply(0.90));
|
||||
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));
|
||||
addClip(img);
|
||||
StackPane wrapper = new StackPane(img);
|
||||
if (withShadow) addShadow(wrapper);
|
||||
@@ -558,11 +571,6 @@ public class MainFXMLController {
|
||||
|
||||
private void renderSidePanel() {
|
||||
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();
|
||||
playerList.setFillWidth(true);
|
||||
|
||||
Reference in New Issue
Block a user