Refactored NavPanel into separate class, separated InfoPanel into InfoPanel and child ImageInfoPanel,reconstructed and refactored ability score GUI, implemented button functionality to force user to choose ability scores before proceeding.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package GUI;
|
||||
|
||||
import GUI.Panels.*;
|
||||
import GUI.Panels.SubPanels.NavPanel;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -22,23 +23,30 @@ public class GUImanager extends JFrame {
|
||||
private int raceChoice;
|
||||
private int classChoice;
|
||||
|
||||
private String[] statOptions;
|
||||
private String[] statDescriptions;
|
||||
private int[] selectedStats;
|
||||
|
||||
|
||||
|
||||
public GUImanager (boolean returningUser) {
|
||||
super("D&D Character Builder");
|
||||
frameSetup();
|
||||
setupRaceAndClass();
|
||||
setupPanelInfo();
|
||||
this.panels = new JPanel[]{
|
||||
new MainMenuPanel(),
|
||||
new BasicPanel(createBackButton(), createContinueButton(), raceOptions, raceDescriptions, "Step 1: Choose Your Race"), // To choose Race.
|
||||
new BasicPanel(createBackButton(), createContinueButton(), classOptions, classDescriptions, "Step 2: Choose Your Class"), // To choose Class.
|
||||
new ChooseAbilityScoresPanel(createBackButton(), createContinueButton())
|
||||
new BasicPanel(createNavPanel(), raceOptions, raceDescriptions, "Step 1: Choose Your Race"), // To choose Race.
|
||||
new BasicPanel(createNavPanel(), classOptions, classDescriptions, "Step 2: Choose Your Class"), // To choose Class.
|
||||
new ChooseAbilityScoresPanel(createNavPanel(27), statOptions, statDescriptions, selectedStats, "Step 3: Choose Your Ability Scores")
|
||||
};
|
||||
|
||||
|
||||
this.lastPanel = 0;
|
||||
this.currentPanel = 1;
|
||||
this.nextPanel = 2;
|
||||
this.lastPanel = currentPanel - 1;
|
||||
this.nextPanel = currentPanel + 1;
|
||||
|
||||
/* this.lastPanel = 0;
|
||||
this.currentPanel = 1;
|
||||
this.nextPanel = 2;*/
|
||||
|
||||
/* if (returningUser) {
|
||||
|
||||
@@ -72,7 +80,7 @@ public class GUImanager extends JFrame {
|
||||
|
||||
}
|
||||
|
||||
private void setupRaceAndClass() {
|
||||
private void setupPanelInfo() {
|
||||
|
||||
raceOptions = new String[]{
|
||||
"Dragonborn",
|
||||
@@ -136,6 +144,42 @@ public class GUImanager extends JFrame {
|
||||
|
||||
};
|
||||
|
||||
statOptions = new String[] {
|
||||
|
||||
"Strength",
|
||||
"Dexterity",
|
||||
"Constitution",
|
||||
"Intelligence",
|
||||
"Wisdom",
|
||||
"Charisma"
|
||||
|
||||
};
|
||||
|
||||
statDescriptions = new String[] {
|
||||
|
||||
"Strength is a thing.",
|
||||
"Dexterity is a thing",
|
||||
"Constitution is a thing",
|
||||
"Intelligence is a thing",
|
||||
"Wisdom is a thing",
|
||||
"Charisma is a thing"
|
||||
|
||||
};
|
||||
|
||||
selectedStats = new int[] {8, 8, 8, 8, 8, 8};
|
||||
|
||||
}
|
||||
|
||||
private NavPanel createNavPanel() {
|
||||
|
||||
return new NavPanel(createBackButton(), createContinueButton(), 0);
|
||||
|
||||
}
|
||||
|
||||
private NavPanel createNavPanel(int continueRequirement) {
|
||||
|
||||
return new NavPanel(createBackButton(), createContinueButton(), continueRequirement);
|
||||
|
||||
}
|
||||
|
||||
private DefaultButton createBackButton() {
|
||||
|
||||
Reference in New Issue
Block a user