Skip to content

Commit

Permalink
Merge branch 'Csongor'
Browse files Browse the repository at this point in the history
  • Loading branch information
pupcs committed May 21, 2024
2 parents 0eb91c5 + 3cf1b03 commit c1c1c0b
Show file tree
Hide file tree
Showing 53 changed files with 33 additions and 62 deletions.
18 changes: 8 additions & 10 deletions src/main/java/program/main/NomadButtonPanel.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package program.main;

import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
Expand All @@ -14,7 +13,7 @@ public class NomadButtonPanel extends JPanel implements ActionListener {
JButton changePipeIn = new JButton("change pipe in");
JButton changePipeOut = new JButton("change pipe out");

public int lettersize = 12;
public static final int letterSize = 12;

/**
* Az osztály konstruktora.
Expand All @@ -24,25 +23,27 @@ public NomadButtonPanel() {
this.setBackground(new Color(240, 204, 125));
this.add(move);

String sg = "Showcard Gothic";

move.setVisible(true);
move.addActionListener(this);
move.setVisible(true);
move.setBackground(new Color(240, 204, 125));
move.setFont(new Font("Showcard Gothic", Font.PLAIN, 12));
move.setFont(new Font(sg, Font.PLAIN, 12));

this.add(changePipeIn);
changePipeIn.addActionListener(this);
changePipeIn.setVisible(true);
changePipeIn.addActionListener(this);
changePipeIn.setBackground(new Color(240, 204, 125));
changePipeIn.setFont(new Font("Showcard Gothic", Font.PLAIN, 12));
changePipeIn.setFont(new Font(sg, Font.PLAIN, 12));

this.add(changePipeOut);
changePipeOut.addActionListener(this);
changePipeOut.setVisible(true);
changePipeOut.addActionListener(this);
changePipeOut.setBackground(new Color(240, 204, 125));
changePipeOut.setFont(new Font("Showcard Gothic", Font.PLAIN, 12));
changePipeOut.setFont(new Font(sg, Font.PLAIN, 12));
}

/**
Expand All @@ -51,8 +52,7 @@ public NomadButtonPanel() {
* @return
*/
public boolean getendturn() {
boolean end = NomadPipeInteraction.getendturn();
return end;
return NomadPipeInteraction.getendturn();
}

/**
Expand All @@ -64,6 +64,7 @@ public void resetTurn(boolean temp) {
NomadPipeInteraction.setendturn(temp);
}


/**
* Ez a függvény felelős azért, hogy amikor a felhasználó rányom egy gomra akkor az történjen ami a gomra van írva.
*
Expand All @@ -72,10 +73,7 @@ public void resetTurn(boolean temp) {
@Override
public void actionPerformed(ActionEvent e) {
if (!Controller.currentTurnIsNomad) {
//this.setVisible(false);
return;
} else {
// this.setVisible(true);
}

if (e.getSource() == move) {
Expand Down
77 changes: 25 additions & 52 deletions src/main/java/program/main/Pipe.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package program.main;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.time.LocalDateTime;
import java.util.Random;

import static program.main.Main.game;

public class Pipe extends Field implements Serializable {
public class Pipe extends Field {

int x1;
int y1;
int x2;
int y2;

String nif = "Nincs ilyen függvénye: ";

/**
* Megadja, hogy a csőben van-e víz.
*/
Expand All @@ -26,7 +23,7 @@ public class Pipe extends Field implements Serializable {
/**
* A csőhöz csatlakoztatott pumpák tömbje.
*/
private Pump connectedPumps[] = new Pump[2];
private Pump[] connectedPumps = new Pump[2];

/**
* Megadja, hogy hány körig nem lehet még kilyukasztani a csövet.
Expand Down Expand Up @@ -182,7 +179,6 @@ public void detach(Pump pump) {
this.connectedPumps[1].removePipe(this);
this.connectedPumps[1] = null;
}
//System.out.println("SUCCESS - Pump.Detach()");
}

/**
Expand Down Expand Up @@ -212,16 +208,11 @@ public void placedDown() {
* @return
*/
public boolean flowThru() {
if (this.connectedPumps[0].getPipeIn() == this && this.connectedPumps[1].getPipeOut() == this) {
//System.out.println("SUCCESS - Pump.flowThru()");
return true;
}
if (this.connectedPumps[1].getPipeIn() == this && this.connectedPumps[0].getPipeOut() == this) {
//System.out.println("SUCCESS - Pump.flowThru()");
return true;
}
//System.out.println("SUCCESS - Pump.flowThru()");
return false;
return (this.connectedPumps[0].getPipeIn() == this && this.connectedPumps[1].getPipeOut() == this
||
this.connectedPumps[1].getPipeIn() == this && this.connectedPumps[0].getPipeOut() == this
);

}

/**
Expand All @@ -231,13 +222,9 @@ public boolean flowThru() {
* @return
*/
public Pump otherEnd(Pump p) {
//Pump temp = connectedPumps[0];
//System.out.println(this.connectedPumps[0]);
//System.out.println(this.connectedPumps[1]);
if (connectedPumps[0] != p) {
return connectedPumps[0];
}
//System.out.println("SUCCESS - Pump.otherEnd()");
return connectedPumps[1];
}

Expand All @@ -248,7 +235,7 @@ public Pump otherEnd(Pump p) {
*/
@Override
public void setNewPump(Pump p) {
throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.setNewPump()");
throw new UnsupportedOperationException(nif + "Pipe.setNewPump()");
}

/**
Expand All @@ -258,7 +245,7 @@ public void setNewPump(Pump p) {
*/
@Override
public boolean getNewPump() {
throw new UnsupportedOperationException("Nincs ilyen függvénye" + "Pipe.getNewPump()");
throw new UnsupportedOperationException(nif + "Pipe.getNewPump()");
}

/**
Expand Down Expand Up @@ -297,7 +284,6 @@ public void turn() {
this.setWater(false);
Controller.addPointsToNomad();
}
//System.out.println("SUCCESS - Pump.turn()");
}

/**
Expand All @@ -306,7 +292,7 @@ public void turn() {
@Override
public ArrayList<Pump> listNeighbours() {

throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.listNeighbours()");
throw new UnsupportedOperationException(nif + "Pipe.listNeighbours()");

}

Expand All @@ -318,7 +304,7 @@ public ArrayList<Pump> listNeighbours() {
@Override
public void removePipe(Pipe p) {

throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.removePipe()");
throw new UnsupportedOperationException(nif + "Pipe.removePipe()");
}

/**
Expand All @@ -328,7 +314,7 @@ public void removePipe(Pipe p) {
*/
@Override
public void connectPipe(Pipe p) {
throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.connectPipe()");
throw new UnsupportedOperationException(nif + "Pipe.connectPipe()");

}

Expand All @@ -340,7 +326,7 @@ public void connectPipe(Pipe p) {
@Override
public void changePipeIn(Pipe p) {

throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.changePipeIn()");
throw new UnsupportedOperationException(nif + "Pipe.changePipeIn()");

}

Expand All @@ -351,7 +337,7 @@ public void changePipeIn(Pipe p) {
*/
@Override
public void changePipeOut(Pipe p) {
throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.changePipeOut()");
throw new UnsupportedOperationException(nif + "Pipe.changePipeOut()");

}

Expand All @@ -363,7 +349,7 @@ public void changePipeOut(Pipe p) {
@Override
public void setNewPipe(Pipe p) {

throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.setNewPipe()");
throw new UnsupportedOperationException(nif + "Pipe.setNewPipe()");
}

/**
Expand All @@ -374,7 +360,7 @@ public void setNewPipe(Pipe p) {
@Override
public Pipe getNewPipe() {

throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.getNewPipe()");
throw new UnsupportedOperationException(nif + "Pipe.getNewPipe()");

}

Expand All @@ -384,7 +370,7 @@ public Pipe getNewPipe() {
@Override
public int SpareWater() {

throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.SpareWater()");
throw new UnsupportedOperationException(nif + "Pipe.SpareWater()");

}

Expand All @@ -398,7 +384,6 @@ public ArrayList<Pump> getConnectedPumps() {
ArrayList<Pump> lista = new ArrayList<Pump>();
lista.add(this.connectedPumps[0]);
lista.add(this.connectedPumps[1]);
//System.out.println("SUCCESS - Pump.getConnectedPumps()");
return lista;
}

Expand All @@ -409,7 +394,7 @@ public ArrayList<Pump> getConnectedPumps() {
*/
public ArrayList<Pipe> getConnectedPipes() {

throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.getConnectedPipes()");
throw new UnsupportedOperationException(nif + "Pipe.getConnectedPipes()");
}

/**
Expand All @@ -419,7 +404,6 @@ public ArrayList<Pipe> getConnectedPipes() {
*/
public void SetTurnNotToSlippery(int i) {
turnsToNotSlippery = i;
//System.out.println("SUCCESS - Pump.SetTurnNotToSlippery()");
}

/**
Expand All @@ -429,10 +413,8 @@ public void SetTurnNotToSlippery(int i) {
*/
public boolean GetSlippery() {
if (turnsToNotSlippery > 0) {
//System.out.println("SUCCESS - Pump.GetSlippery()");
return true;
}
//System.out.println("SUCCESS - Pump.GetSlippery()");
return false;
}

Expand All @@ -442,7 +424,6 @@ public boolean GetSlippery() {
* @return
*/
public int getTurnToNotSticky() {
//System.out.println("SUCCESS - Pump.getTurnToNotSticky()");
return turnToNotSticky;
}

Expand All @@ -452,7 +433,6 @@ public int getTurnToNotSticky() {
* @return
*/
public int getTurnsToNotSlippery() {
//System.out.println("SUCCESS - Pump.getTurnsToNotSlippery()");
return turnsToNotSlippery;
}

Expand All @@ -474,7 +454,6 @@ public boolean GetSticky() {
* @param i
*/
public void setTurnToNotSticky(int i) {
//System.out.println("SUCCESS - Pump.setTurnToNotSticky");
turnToNotSticky = i;
}

Expand All @@ -487,10 +466,8 @@ public boolean canPlayerStep() {
Random random = new Random();
int randomNumber = random.nextInt(2);
if (randomNumber == 1) {
//System.out.println("SUCCESS - Pump.canPlayerStep()");
return true;
} else {
//System.out.println("SUCCESS - Pump.canPlayerStep()");
return false;
}
}
Expand All @@ -501,7 +478,6 @@ public boolean canPlayerStep() {
public void destroy() {
if (this.getState() == State.Working) {
if (turntoDestroy == 0) {
//System.out.println("SUCCESS - Pump.destroy()");
this.setState(State.Broken);
}
}
Expand All @@ -518,7 +494,6 @@ public void repair() {
int randomNumber = random.nextInt(4);
randomNumber = randomNumber + 2;
turntoDestroy = randomNumber;
//System.out.println("SUCCESS - Pump.repair()");
}
}

Expand All @@ -528,7 +503,6 @@ public void repair() {
* @return
*/
public boolean getWater() {
//System.out.println("SUCCESS - Pump.getWater()");
return water;
}

Expand All @@ -538,30 +512,29 @@ public boolean getWater() {
* @param state
*/
public void setWater(boolean state) {
//System.out.println("SUCCESS - Pump.setWater()");
water = state;
}


public void removeNeighour(Pump p) {

throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.removeNeighour()");
throw new UnsupportedOperationException(nif + "Pipe.removeNeighour()");
}

public void addNeighour(Pump p) {
throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.addNeighour()");
throw new UnsupportedOperationException(nif + "Pipe.addNeighour()");
}

public void addWater() {
throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.addWater()");
throw new UnsupportedOperationException(nif + "Pipe.addWater()");
}

public Pipe getPipeIn() {
throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.getPipeIn()");
throw new UnsupportedOperationException(nif + "Pipe.getPipeIn()");
}

public Pipe getPipeOut() {
throw new UnsupportedOperationException("Nincs ilyen függvénye: " + "Pipe.getPipeOut()");
throw new UnsupportedOperationException(nif + "Pipe.getPipeOut()");
}

/**
Expand Down
Binary file modified target/classes/program/main/Cactus.class
Binary file not shown.
Binary file modified target/classes/program/main/Cistern.class
Binary file not shown.
Binary file modified target/classes/program/main/Controller.class
Binary file not shown.
Binary file modified target/classes/program/main/Field.class
Binary file not shown.
Binary file modified target/classes/program/main/Game.class
Binary file not shown.
Binary file modified target/classes/program/main/GamePanel.class
Binary file not shown.
Binary file modified target/classes/program/main/GameWindow.class
Binary file not shown.
Binary file modified target/classes/program/main/ImagePanel.class
Binary file not shown.
Binary file modified target/classes/program/main/InGame.class
Binary file not shown.
Binary file modified target/classes/program/main/LoadSave.class
Binary file not shown.
Binary file modified target/classes/program/main/Main.class
Binary file not shown.
Binary file modified target/classes/program/main/Nomad.class
Binary file not shown.
Binary file modified target/classes/program/main/NomadButtonPanel.class
Binary file not shown.
Binary file modified target/classes/program/main/NomadMoveWindow.class
Binary file not shown.
Binary file modified target/classes/program/main/NomadPipeInWindow.class
Binary file not shown.
Binary file modified target/classes/program/main/NomadPipeInteraction.class
Binary file not shown.
Binary file modified target/classes/program/main/NomadPipeOutWindow.class
Binary file not shown.
Binary file modified target/classes/program/main/Pipe.class
Binary file not shown.
Binary file modified target/classes/program/main/Player.class
Binary file not shown.
Binary file modified target/classes/program/main/Plumber.class
Binary file not shown.
Binary file modified target/classes/program/main/PlumberButtonPanel.class
Binary file not shown.
Binary file modified target/classes/program/main/PlumberMoveWindow.class
Binary file not shown.
Binary file modified target/classes/program/main/PlumberPickUpWindow.class
Binary file not shown.
Binary file modified target/classes/program/main/PlumberPipeInWindow.class
Binary file not shown.
Binary file modified target/classes/program/main/PlumberPipeInteraction.class
Binary file not shown.
Binary file modified target/classes/program/main/PlumberPipeOutWindow.class
Binary file not shown.
Binary file modified target/classes/program/main/Pump.class
Binary file not shown.
Binary file modified target/classes/program/main/Spring.class
Binary file not shown.
Binary file modified target/classes/program/main/State.class
Binary file not shown.
Binary file modified target/classes/program/main/restart_menu$1.class
Binary file not shown.
Binary file modified target/classes/program/main/restart_menu$2.class
Binary file not shown.
Binary file modified target/classes/program/main/restart_menu.class
Binary file not shown.
Binary file modified target/classes/program/main/settings$1.class
Binary file not shown.
Binary file modified target/classes/program/main/settings$2.class
Binary file not shown.
Binary file modified target/classes/program/main/settings.class
Binary file not shown.
Binary file modified target/classes/program/main/startMenu$1.class
Binary file not shown.
Binary file modified target/classes/program/main/startMenu$2.class
Binary file not shown.
Binary file modified target/classes/program/main/startMenu$3.class
Binary file not shown.
Binary file modified target/classes/program/main/startMenu.class
Binary file not shown.
Binary file not shown.
Binary file modified target/test-classes/com/stepDefinition/UIChangePipeIn.class
Binary file not shown.
Binary file modified target/test-classes/com/stepDefinition/UIChangePipeOut.class
Binary file not shown.
Binary file modified target/test-classes/com/stepDefinition/UIDestroyPipeSteps.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified target/test-classes/com/stepDefinition/UIPickUpPipeSteps.class
Binary file not shown.
Binary file modified target/test-classes/com/stepDefinition/UIPickUpPumpSteps.class
Binary file not shown.
Binary file modified target/test-classes/com/stepDefinition/UIPlumberMovesSteps.class
Binary file not shown.
Binary file not shown.
Binary file modified target/test-classes/com/stepDefinition/UIStartSteps.class
Binary file not shown.

0 comments on commit c1c1c0b

Please sign in to comment.