Sfoglia il codice sorgente

Starting work on gaining new spells

Sam Jaffe 8 anni fa
parent
commit
c5d668b1cf

+ 23 - 0
src/main/lombok/org/leumasjaffe/charsheet/view/level/LevelUpSpellPanel.java

@@ -0,0 +1,23 @@
+package org.leumasjaffe.charsheet.view.level;
+
+import javax.swing.JPanel;
+
+import org.leumasjaffe.charsheet.model.DDClass;
+import org.leumasjaffe.charsheet.model.magic.DDSpellbook;
+import org.leumasjaffe.charsheet.view.level.UpdateClassWithLevelPanel.BoolArray;
+import java.awt.GridBagLayout;
+
+@SuppressWarnings("serial")
+class LevelUpSpellPanel extends JPanel {
+
+	public LevelUpSpellPanel(DDSpellbook sb, DDClass base, int toLevel, BoolArray readyCount) {
+		GridBagLayout gridBagLayout = new GridBagLayout();
+		gridBagLayout.columnWidths = new int[]{0};
+		gridBagLayout.rowHeights = new int[]{0};
+		gridBagLayout.columnWeights = new double[]{Double.MIN_VALUE};
+		gridBagLayout.rowWeights = new double[]{Double.MIN_VALUE};
+		setLayout(gridBagLayout);
+
+	}
+
+}

+ 6 - 1
src/main/lombok/org/leumasjaffe/charsheet/view/level/UpdateClassWithLevelPanel.java

@@ -30,7 +30,7 @@ import javax.swing.JLabel;
 class UpdateClassWithLevelPanel extends JPanel {
 	@FieldDefaults(level=AccessLevel.PUBLIC, makeFinal=true)
 	public class BoolArray extends Observable {
-		boolean data[] = new boolean[] {false};
+		boolean data[] = new boolean[] {false, false};
 	}
 	BoolArray readyCount = new BoolArray();
 	ObservableListener<Consumer<Boolean>, BoolArray> listener;
@@ -65,6 +65,11 @@ class UpdateClassWithLevelPanel extends JPanel {
 		};
 		tabbedPane.addTab("Skills", null, skills, null);
 		
+		info.ddClass.getSpellBook().ifPresent(sb -> {
+			JPanel spells = new LevelUpSpellPanel(sb, info.ddClass.getBase(), info.toLevel, readyCount);
+			tabbedPane.addTab("Spells", null, spells, null);
+		});
+		
 		JPanel panel = new JPanel();
 		GridBagConstraints gbc_panel = new GridBagConstraints();
 		gbc_panel.fill = GridBagConstraints.BOTH;