diff --git a/src/main/java/views/MainPanel.java b/src/main/java/views/MainPanel.java index f5be9a9..02334f2 100644 --- a/src/main/java/views/MainPanel.java +++ b/src/main/java/views/MainPanel.java @@ -23,7 +23,11 @@ private List selectableOpponentHandKeys; Constants.Step currentStep; JPanel myHandButtonsPanel; + JPanel myHandAttackerPanel; + JPanel myPanel; JPanel opponentButtonsPanel; + JPanel opponentAttackerPanel; + JPanel opponentPanel; /** * アタックで使用するカードが既に決定しているか */ @@ -45,6 +49,18 @@ deckButtonPanel = new JPanel(); myHandButtonsPanel = new JPanel(); opponentButtonsPanel = new JPanel(); + + myHandAttackerPanel = new JPanel(); + myPanel = new JPanel(); + opponentAttackerPanel = new JPanel(); + opponentPanel = new JPanel(); + + myPanel.add(myHandAttackerPanel); + myPanel.add(myHandButtonsPanel); + + opponentPanel.add(opponentAttackerPanel); + opponentPanel.add(opponentButtonsPanel); + if(!stepScheduler.isDeckLess()){ //デッキが存在する場合 var cardButton =new JButton("deck"); cardButton.setPreferredSize(new Dimension(CARD_HEIGHT,CARD_WIDTH)); @@ -56,9 +72,11 @@ * */ add(deckButtonPanel,BorderLayout.WEST); - add(myHandButtonsPanel, BorderLayout.SOUTH); + //add(myHandButtonsPanel, BorderLayout.SOUTH); + add(myPanel,BorderLayout.SOUTH); - add(opponentButtonsPanel, BorderLayout.NORTH); + //add(opponentButtonsPanel, BorderLayout.NORTH); + add(opponentPanel,BorderLayout.NORTH); opponentHandButtons.stream().filter(x -> x.getText().equals(CLOSED_SYMBOL)).forEach(x -> { x.setEnabled(true); }); @@ -114,13 +132,11 @@ var cardButton =new CardButton(deckTopCard.getKey().toString()); cardButton.setBounds(0,100,CARD_WIDTH,CARD_HEIGHT); if(iAttack.isATurn()){ - myHandButtons.add(cardButton); - myHandButtonsPanel.add(cardButton, BorderLayout.WEST); + myHandAttackerPanel.add(cardButton); isDecidedAttacker=true; }else { cardButton.setText(CLOSED_SYMBOL); - opponentHandButtons.add(cardButton); - opponentButtonsPanel.add(cardButton, BorderLayout.WEST); + opponentAttackerPanel.add(cardButton); } if(iAttack.getDeckNumber()==1){ deckButtonPanel.removeAll(); @@ -141,10 +157,11 @@ isDecidedAttacker=false; myHandButtonsPanel.removeAll();// myHandButtons.clear(); + myHandAttackerPanel.removeAll(); + opponentAttackerPanel.removeAll(); opponentButtonsPanel.removeAll();// opponentHandButtons.clear(); - /** * 自分の手札に関する処理 */ @@ -154,7 +171,8 @@ cardButton.setStatus(i.getValue()? CardButton.Status.OPEN: CardButton.Status.MY_CLOSED); myHandButtons.add(cardButton); - myHandButtonsPanel.add(cardButton, BorderLayout.WEST); + //myHandButtonsPanel.add(cardButton, BorderLayout.WEST); + myHandButtonsPanel.add(cardButton); final var a=indexForMyHands;//actionPerformedの中に書くと、クリックされて初めて、回しきったindexForMyHandsを参照してしまうため、ここで一時変数に格納する cardButton.addActionListener(new ActionListener() { @Override