Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;

import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.shape.SVGPath;

/**
* FXML Controller class
Expand All @@ -38,12 +44,91 @@ public class Difficulty_selectionController implements Initializable {
private Button hardBtn;
@FXML
private Label backLabel;
@FXML
private HBox pveBadgeHBox;
@FXML
private Label pveDotLabel;
@FXML
private Label pveTextLabel;
@FXML
private Label mainTitleLabel;
@FXML
private Label subtitleLabel;
@FXML
private FlowPane cardsFlowPane;
@FXML
private VBox easyCardVBox;
@FXML
private StackPane easyIconArea;
@FXML
private StackPane easyIconCircle;
@FXML
private SVGPath easySVG;
@FXML
private VBox easyCardContentVBox;
@FXML
private HBox easyCardHeaderHBox;
@FXML
private Label easyCardTitleLabel;
@FXML
private Region easyCardSpacer;
@FXML
private Label easyCardDifficultyLabel;
@FXML
private Label easyCardDescLabel;
@FXML
private StackPane mediumCardStackPane;
@FXML
private VBox mediumCardVBox;
@FXML
private StackPane mediumIconArea;
@FXML
private StackPane mediumIconCircle;
@FXML
private SVGPath mediumSVG;
@FXML
private VBox mediumCardContentVBox;
@FXML
private HBox mediumCardHeaderHBox;
@FXML
private Label mediumCardTitleLabel;
@FXML
private Region mediumCardSpacer;
@FXML
private Label mediumCardDifficultyLabel;
@FXML
private Label mediumCardDescLabel;
@FXML
private Label recommendedLabel;
@FXML
private VBox hardCardVBox;
@FXML
private StackPane hardIconArea;
@FXML
private StackPane hardIconCircle;
@FXML
private SVGPath hardSVG;
@FXML
private VBox hardCardContentVBox;
@FXML
private HBox hardCardHeaderHBox;
@FXML
private Label hardCardTitleLabel;
@FXML
private Region hardCardSpacer;
@FXML
private Label hardCardDifficultyLabel;
@FXML
private Label hardCardDescLabel;

/**
* Initializes the controller class.
*/
private ResourceBundle rb;
@Override
public void initialize(URL url, ResourceBundle rb) {
this.rb = rb;
updateTexts();
backgroundPane.getChildren().clear();

Platform.runLater(() -> {
Expand All @@ -61,6 +146,35 @@ public void initialize(URL url, ResourceBundle rb) {
backLabel.setOnMouseClicked(e -> goBack());
}

private void updateTexts() {
// PVE Badge
pveTextLabel.setText(rb.getString("difficulty.mode.pve"));

mainTitleLabel.setText(rb.getString("difficulty.title"));
subtitleLabel.setText(rb.getString("difficulty.subtitle"));

// EASY CARD
easyCardTitleLabel.setText(rb.getString("difficulty.easy.title"));
easyCardDifficultyLabel.setText(rb.getString("difficulty.easy.level"));
easyCardDescLabel.setText(rb.getString("difficulty.easy.desc"));
easyBtn.setText(rb.getString("difficulty.easy.button"));

// MEDIUM CARD
mediumCardTitleLabel.setText(rb.getString("difficulty.medium.title"));
mediumCardDifficultyLabel.setText(rb.getString("difficulty.medium.level"));
mediumCardDescLabel.setText(rb.getString("difficulty.medium.desc"));
mediumBtn.setText(rb.getString("difficulty.medium.button"));
recommendedLabel.setText(rb.getString("difficulty.medium.recommended"));

// HARD CARD
hardCardTitleLabel.setText(rb.getString("difficulty.hard.title"));
hardCardDifficultyLabel.setText(rb.getString("difficulty.hard.level"));
hardCardDescLabel.setText(rb.getString("difficulty.hard.desc"));
hardBtn.setText(rb.getString("difficulty.hard.button"));

// Back label
backLabel.setText(rb.getString("difficulty.back"));
}
private void startGameWithDifficulty(String difficulty) {
System.out.println("Starting game with difficulty: " + difficulty);

Expand All @@ -87,4 +201,6 @@ private void goBack() {
System.out.println("Back to previous screen");
NavigationManager.navigate(Screens.GAME, NavigationAction.REPLACE);
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,47 @@

import java.net.URL;
import java.util.ResourceBundle;
import javafx.scene.control.Button;
import javafx.scene.control.Label;


public class OfflineModeSelectionController implements Initializable {


@FXML
private Label logoText;
@FXML
private Button settingsButton;
@FXML
private Label titleLabel;
@FXML
private Label subtitleLabel;
@FXML
private Label pvpCardTitle;
@FXML
private Label pvpCardDesc;
@FXML
private Label pvpCardBadge;
@FXML
private Label pvpActionText;
@FXML
private Label pveCardTitle;
@FXML
private Label pveCardDesc;
@FXML
private Label pveCardBadge;
@FXML
private Label pveActionText;
@FXML
private Button backButton;
@FXML
private Label backButtonText;

private ResourceBundle resources;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {

this.resources = resourceBundle;
updateTexts();
}
@FXML
private void handleSettings(ActionEvent event) {
Expand All @@ -36,5 +70,32 @@ private void handlePlayerVsPlayer(MouseEvent event) {
private void handlePlayerVsCPU(MouseEvent event) {
NavigationManager.navigate(Screens.DifficultySelection, NavigationAction.PUSH);
}


private void updateTexts() {
if (resources == null) return;

// Header / Logo
logoText.setText(resources.getString("logo.text"));

// Main labels
titleLabel.setText(resources.getString("offline.title"));
subtitleLabel.setText(resources.getString("offline.subtitle"));

// PVP Card
pvpCardTitle.setText(resources.getString("offline.pvp.title"));
pvpCardDesc.setText(resources.getString("offline.pvp.description"));
pvpCardBadge.setText(resources.getString("offline.pvp.badge"));
pvpActionText.setText(resources.getString("offline.pvp.start"));

// PVE Card
pveCardTitle.setText(resources.getString("offline.pve.title"));
pveCardDesc.setText(resources.getString("offline.pve.description"));
pveCardBadge.setText(resources.getString("offline.pve.badge"));
pveActionText.setText(resources.getString("offline.pve.start"));

// Back button
backButtonText.setText(resources.getString("offline.back"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.shape.SVGPath;

/**
* FXML Controller class
Expand All @@ -43,9 +47,54 @@ public class Pvp_setupController implements Initializable {
private Button startGameBtn;
@FXML
private Button backBtn;
@FXML
private HBox topBar;
@FXML
private Label logoLabel;
@FXML
private HBox navLinks;
@FXML
private VBox titleContainer;
@FXML
private SVGPath pvpIcon;
@FXML
private Label titleLabel;
@FXML
private Label subtitleLabel;
@FXML
private VBox setupCard;
@FXML
private Label player1Label;
@FXML
private Label player1Badge;
@FXML
private HBox player1Container;
@FXML
private StackPane vsSeparator;
@FXML
private Label vsLabel;
@FXML
private Label player2Label;
@FXML
private Label player2Badge;
@FXML
private HBox player2Container;
@FXML
private Label starterLabel;
@FXML
private HBox starterToggleContainer;
@FXML
private ToggleButton player1StarterBtn;
@FXML
private ToggleButton player2StarterBtn;

private ResourceBundle langBundle;

@Override
public void initialize(URL url, ResourceBundle rb) {
this.langBundle = rb;
updateTexts();

backgroundPane.getChildren().clear();

Platform.runLater(() -> {
Expand Down Expand Up @@ -84,4 +133,31 @@ private void onStartGameClicked(ActionEvent event) {

NavigationManager.navigate(Screens.GAME, NavigationAction.REPLACE, params);
}

private void updateTexts() {
if (langBundle == null) {
return;
}

logoLabel.setText(langBundle.getString("pvp.logo"));
titleLabel.setText(langBundle.getString("pvp.title"));
subtitleLabel.setText(langBundle.getString("pvp.subtitle"));

player1Label.setText(langBundle.getString("pvp.player1.label"));
player1Badge.setText(langBundle.getString("pvp.player1.badge"));
player1Field.setPromptText(langBundle.getString("pvp.player1.prompt"));

player2Label.setText(langBundle.getString("pvp.player2.label"));
player2Badge.setText(langBundle.getString("pvp.player2.badge"));
player2Field.setPromptText(langBundle.getString("pvp.player2.prompt"));

vsLabel.setText(langBundle.getString("pvp.vs"));

starterLabel.setText(langBundle.getString("pvp.starter.label"));
player1StarterBtn.setText(langBundle.getString("pvp.starter.player1"));
player2StarterBtn.setText(langBundle.getString("pvp.starter.player2"));

startGameBtn.setText(langBundle.getString("pvp.start"));
backBtn.setText(langBundle.getString("pvp.back"));
}
}
Loading