diff --git a/AzulPanel.java b/AzulPanel.java index 25368ba..2416903 100644 --- a/AzulPanel.java +++ b/AzulPanel.java @@ -22,11 +22,13 @@ public class AzulPanel extends JPanel{ static Boolean firstTake = AzulWindow.firstTake; static Boolean endgame = AzulWindow.endgame; static Boolean roundscore = AzulWindow.roundscore; + String output; //animations private static AzulPanel azulPanel; private ArrayList animatableObjectList; + public AzulPanel(){ animatableObjectList = new ArrayList<>(); @@ -61,7 +63,7 @@ public void paint(Graphics g) { //2. CURRENT PLAYER TAG - FINAL g.setFont(new Font("Algerian", Font.PLAIN, 45)); int id = allPlayer[0].ID; - g.drawString("Player "+ id + " "+allPlayer[0].score, 1500,985); + g.drawString("Player "+ id , 1500,985); //3. FACTORY FLOOR NUMBER INDECATORS - FINAL int xinc = 85+10; @@ -92,14 +94,53 @@ else if (b==2) } } } + //4.5 CURRENT PLAYER SCORES + if (allPlayer[0].score == 0) + g.fillRect(685-10, 350-10, 30, 30); + else { + for (int c = 1; c<= 20; c++) { + for (int r = 1; r<=5; r++) { + if (allPlayer[0].score == (r-1)*20+c) + g.fillRect(673+(c-1)*2+(c-1)*30, 378+8*(r-1)+(r-1)*30, 26, 26); + } + } + } //5. BUFFER ZONE BIG TILE + NUMBER INDECATOR - FINAL if (!allPlayer[0].BufferZone.isEmpty()) { g.setFont(new Font("Algerian", Font.PLAIN, 60)); - g.drawImage(tileimage[allPlayer[0].BufferZone.get(0)], 1460,662,150,150,null); - g.drawString("x" + allPlayer[0].BufferZone.size(),1460+150+40,662+150/2+20); + g.drawImage(tileimage[allPlayer[0].BufferZone.get(0)], 1480,650,120,120,null); + g.drawString("x" + allPlayer[0].BufferZone.size(),1460+150+40,650+120/2+20); g.setFont(new Font("Algerian", Font.PLAIN, 45)); } + if (output!=null) { + g.setFont(new Font("Algerian", Font.PLAIN, 25)); + //g.drawString(output + output.length(),1420,650+200); + if(output.equals("2")) { + g.drawString("Selection:",1420,650+200-10); + g.setFont(new Font("Dialog", Font.PLAIN, 15)); + g.drawString("any colored tiles",1420,650+200+20-10); + } + else if(output.equals("1")) { + g.drawString("Placement:",1420,650+200-10); + g.setFont(new Font("Dialog", Font.PLAIN, 15)); + g.drawString("the arrows near the pattern lines or the area in the floor line",1420,650+200+20-10); + } + else if(output.equals("3")) { + g.drawString("Scoring:",1420,650+200-10); + g.setFont(new Font("Dialog", Font.PLAIN, 15)); + g.drawString("Player Directions?",1420,650+200+20-10); + } + + g.setFont(new Font("Algerian", Font.PLAIN, 45)); + } + g.setColor(Color.GRAY); + g.setFont(new Font("Algerian", Font.PLAIN, 20)); + //g.drawString("Copyright 2022",1375,565+10); + g.setFont(new Font("Dialog", Font.PLAIN, 15)); + //g.drawString("Jess Luc Omar Josh",1375+220,565+10); + g.setFont(new Font("Algerian", Font.PLAIN, 45)); + g.setColor(Color.BLACK); //5.5 FINAL GAME VICTORS AND SCORE COMPARISON if (endgame) { g.setFont(new Font("Algerian", Font.ITALIC, 45)); @@ -228,7 +269,7 @@ public static void drawRotate(Graphics g, double x, double y, int angle, String g2d.rotate(-Math.toRadians(angle)); g2d.translate(-(float)x,-(float)y); } - public void updateAll(Factory[] af, FactoryFloor f, ArrayList b, Player [] a,Boolean s, Boolean e, Boolean start) { + public void updateAll(Factory[] af, FactoryFloor f, ArrayList b, Player [] a,Boolean s, Boolean e, Boolean start, String out) { allFactory = af; factoryFloor = f; bag = b; @@ -236,6 +277,7 @@ public void updateAll(Factory[] af, FactoryFloor f, ArrayList b, Player roundscore = s; endgame = e; strt = start; + output = out; } -} +} \ No newline at end of file diff --git a/AzulWindow.java b/AzulWindow.java index 62a54e4..4da5ad2 100644 --- a/AzulWindow.java +++ b/AzulWindow.java @@ -38,6 +38,7 @@ public class AzulWindow extends JFrame implements ItemListener, ActionListener{ static Boolean firstTake, endgame, roundscore; static ArrayList victors; static PlainButton startB; + static String output; //players @@ -150,8 +151,9 @@ public class AzulWindow extends JFrame implements ItemListener, ActionListener{ @Override public void actionPerformed(ActionEvent e) { + output = "2"; strt = false; - panel.updateAll(allFactory,factoryFloor,bag, allPlayer, roundscore,endgame,strt); + panel.updateAll(allFactory,factoryFloor,bag, allPlayer, roundscore,endgame,strt, output); c.validate(); c.repaint(); @@ -202,7 +204,10 @@ public void setFactoryTileFunction(PlainButton temp) { temp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - + + output = "1"; + System.out.println(output); + panel.updateAll(allFactory,factoryFloor,bag, allPlayer, roundscore,endgame,strt, output); //REPAINT EVERYTHING c.validate(); c.repaint(); @@ -219,15 +224,10 @@ public void actionPerformed(ActionEvent e) { //BUTTON FUNCTION ArrayList list = allFactory[temp.factoryID].takeAll(); color = list.get(temp.ID); - /*System.out.println(list); - System.out.println(color);*/ while(list.contains(color)) allPlayer[0].addBufferZone(list.remove(list.indexOf(color))); - //System.out.println(list + "---"+allPlayer[0].BufferZone); factoryFloor.add(list); - /*for (int i: factoryFloor.colors) - System.out.print(i+" ");*/ - + // ANIMATE LUC //from: int x = temp.getBounds().x; @@ -238,21 +238,11 @@ public void actionPerformed(ActionEvent e) { //to: 1460,662 //final size: 150 - /*AnimatableObject ani = new AnimatableObject(tileimage[0],0 , 0, tilesize, tilesize, null); - - try { - Thread.sleep(1000); - Animate.animate(ani, 1460,662,150,150, 2000, 120); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - }*/ /*s = new Screen(tileimage[color],x,y,1460,662,60,150); s.setBounds(0,0,width, height); c.add(s); s = null;*/ - //DISABLE ALL OF FACTORY AND ENABLE ALL OF CURRENT PLAYER PATTERNLINE & FLOOR for (Factory f: allFactory) @@ -275,7 +265,8 @@ public void setFactFloorFunction(PlainButton temp) { @Override public void actionPerformed(ActionEvent e) { System.out.println("OFFER: Factory Floor Tile clicked " + temp.ID +" "); - + output = "1"; + panel.updateAll(allFactory,factoryFloor,bag, allPlayer, roundscore,endgame,strt, output); //REPAINT EVERYTHING c.validate(); c.repaint(); @@ -309,16 +300,6 @@ public void actionPerformed(ActionEvent e) { //color of tile: color //to: 1460,662 //final size: 150 - /*AnimatableObject ani = new AnimatableObject(tileimage[0],0 , 0, tilesize, tilesize, null); - - try { - Thread.sleep(1000); - Animate.animate(ani, 1460,662,150,150, 2000, 120); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - }*/ - // NEXT ACTION //DISABLE ALL OF FACTORY AND ENABLE ALL OF CURRENT PLAYER PATTERNLINE & FLOOR @@ -333,8 +314,6 @@ public void actionPerformed(ActionEvent e) { c.validate(); c.repaint(); c.add(panel); - //allPlayer[0] - //c.removeAll(); }}); } @@ -344,6 +323,7 @@ public void setPlayerPatternFunction(PlainButton temp) { @Override public void actionPerformed(ActionEvent e) { System.out.println("PLACEMENT: Placement Clicked " + temp.ID +" " +temp.factoryID + ""); + output = "2"; //REPAINT EVERYTHING c.validate(); @@ -386,15 +366,7 @@ public void actionPerformed(ActionEvent e) { //to: int x = temp.getBounds().x; int y = temp.getBounds().y; - /*AnimatableObject ani = new AnimatableObject(tileimage[0],0 , 0, tilesize, tilesize, null); - - try { - Thread.sleep(1000); - Animate.animate(ani, 1460,662,150,150, 2000, 120); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } + /* for (ArrayList d: allPlayer[0].wall) { for (int n: d) System.out.print(n+" "); @@ -433,9 +405,15 @@ public void actionPerformed(ActionEvent e) { p.wall.set(i,arr); p.scoreWall.get(i).set(col, score); } - + try { + Thread.sleep(2000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } c.validate(); c.repaint(); + } int i = 0; while(i <7 && p.floorLine[i]!=-1 ) { @@ -574,7 +552,9 @@ public void setPlayerFloorFunction(PlainButton temp) { @Override public void actionPerformed(ActionEvent e) { System.out.println("PLACEMENT: player floor Clicked " + temp.ID +" " +temp.factoryID + ""); - //REPAINT EVERYTHING + output = "2"; + + //REPAINT EVERYTHING c.validate(); c.repaint(); c.add(panel); @@ -726,7 +706,7 @@ public void rotateTurn() { } allPlayer = temp; System.out.println("---------------------------------player:" + allPlayer[0].ID); - panel.updateAll(allFactory,factoryFloor,bag, allPlayer, roundscore,endgame,strt); + panel.updateAll(allFactory,factoryFloor,bag, allPlayer, roundscore,endgame,strt, output); c.validate(); c.repaint(); c.add(panel); @@ -745,7 +725,7 @@ public void rotateRound(int first) { temp[j] = allPlayer[(index+j)%4]; } allPlayer = temp; - panel.updateAll(allFactory,factoryFloor,bag, allPlayer, roundscore,endgame,strt); + panel.updateAll(allFactory,factoryFloor,bag, allPlayer, roundscore,endgame,strt, output); c.validate(); c.repaint(); c.add(panel); @@ -775,4 +755,4 @@ public void itemStateChanged(ItemEvent e) { } -} +} \ No newline at end of file