Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rcshim04 committed Jul 28, 2020
2 parents ca5fe2e + cf5ce28 commit 590198b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 33 deletions.
30 changes: 18 additions & 12 deletions BGM.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,39 @@ public BGM(String name) {
* Play method
*/
public void play() {
clip.start();
try {
clip.start();
} catch (Exception e) {}
}
/**
* Pause Method
*/
public void pause() {
this.currentFrame = this.clip.getMicrosecondPosition();
clip.stop();
try {
this.currentFrame = this.clip.getMicrosecondPosition();
clip.stop();
} catch (Exception e) {}
}
/**
* Resume Method
*/
public void resume() {
clip.close();
try {
audioInputStream = AudioSystem.getAudioInputStream(this.getClass().getResource(Utility.RES_NAME + "/bgm/"+name+".wav"));
clip.open(audioInputStream);
clip.loop(Clip.LOOP_CONTINUOUSLY);
} catch(Exception e) {System.out.println("Resume");}
clip.setMicrosecondPosition(currentFrame);
clip.start();
clip.close();
audioInputStream = AudioSystem.getAudioInputStream(this.getClass().getResource(Utility.RES_NAME + "/bgm/"+name+".wav"));
clip.open(audioInputStream);
clip.loop(Clip.LOOP_CONTINUOUSLY);
clip.setMicrosecondPosition(currentFrame);
clip.start();
} catch(Exception e) {}
}
/**
* Stop method
*/
public void stop() {
clip.stop();
clip.close();
try {
clip.stop();
clip.close();
} catch(Exception e) {}
}
}
4 changes: 2 additions & 2 deletions CovidCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ public void paintComponent(Graphics g) {
if (maskBox.isClicked()) {
CovidCashier.getPastRestaurant().getUser().putOnMask();

SoundFX.play("gloveBox",300);
SoundFX.play("glovebox",300);
updatePPE(maskBox);
} else if (gloveBox.isClicked()) {
CovidCashier.getPastRestaurant().getUser().putOnGloves();

SoundFX.play("gloveBox",300);
SoundFX.play("glovebox",300);
updatePPE(gloveBox);
} else if (sanitizer.isClicked()) {
CovidCashier.getPastRestaurant().getUser().cleanHands();
Expand Down
2 changes: 0 additions & 2 deletions Dialogue.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ public void actionPerformed(ActionEvent e) {
if (!canProceed) textQueue.poll();
canProceed = textQueue.size() == 0;

if (canProceed) System.out.println("can proceed");

CovidCashier.frame.repaint();
}
}));
Expand Down
2 changes: 0 additions & 2 deletions MemoryGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ public MemoryGameDrawing() {
}
for(int i = 0; i < 2; i++) {
for(int j = 0; j < 5; j++) {
System.out.print(id[i*5+j]+ " ");
cards[j][i] = new Card(names[id[i*5+j]], i*5+j, 60+j*140, 100+i*180, 120, 160);
cards[j][i].activate();
}
System.out.println();
}
infoCard.activate();
}
Expand Down
6 changes: 0 additions & 6 deletions Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,10 @@ public void checkHygiene(String nextStn) {
if (!nextStn.equals("covid counter")) {
if (getPPE().indexOf("M") == -1) {
addFailure("You did not wear a mask prior to a task");
System.out.println("failures mask "+ failures.size());
}

if (!hygienicTracker.getLastTask().equals(nextStn) && !hygienicTracker.getLastTask("gloves").equals(hygienicTracker.getLastTask()) && !hygienicTracker.getLastTask("gloves").equals("covid counter")) {
addFailure("You did not change your gloves in between tasks");
System.out.println("failures gloves "+ failures.size());
}
}

Expand Down Expand Up @@ -263,12 +261,10 @@ public HygieneTracker() {
* @param key the key to be updated
*/
public void update(String key) {
System.out.println("update "+key);

if (key.equals("gloves")) {
if (!getLastTask("clean hands").equals(lastTask)) {
addFailure("You did not sanitize your hands before changing gloves");
System.out.println("failures clean "+ failures.size());
}
}

Expand Down Expand Up @@ -311,14 +307,12 @@ public FridgeTilesBindings() {
protected void loadKeyBindings() {
movementMap.put("left", new Movement("left", KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), new AbstractAction() {
public void actionPerformed(ActionEvent e) {
System.out.println("left");
if(x_coord-80 > 280)
x_coord -= 80;
}
}));
movementMap.put("right", new Movement("right", KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), new AbstractAction() {
public void actionPerformed(ActionEvent e) {
System.out.println("right");
if(x_coord+80 < 520)
x_coord += 80;
}
Expand Down
7 changes: 5 additions & 2 deletions Restaurant.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public Restaurant(boolean training) {
openedStations = new HashMap<String, Boolean>();
openedStations.put("COVID Counter", true);
openedStations.put("Front Counter", true);
openedStations.put("Don't worry, this is my station! Go back to work!", true);


initialLiveTask = true;
Expand Down Expand Up @@ -351,6 +352,7 @@ private void drawCustomer(Graphics g) {
castedCustomer.setCurrentAction("standing");
castedCustomer.setDirection('N');
takeOrder();
initialLiveTask = false;
}
} else if (castedCustomer.getCurrentAction().equals("walk left")) {
if (customer.getX() > castedCustomer.getXTarget()) customer.moveLeft();
Expand Down Expand Up @@ -428,9 +430,10 @@ public void paintComponent(Graphics g) {
drawCustomer(g);

// check whether the live level has been completed
if (!inTraining && listIsCompleted()) {
if (!inTraining && listIsCompleted() && !initialLiveTask) {
for (String key : openedStations.keySet()) openedStations.put(key, false);
openedStations.put("Exit", true);
initialLiveTask = true;
intro = new Dialogue("You've finished your work shift! Go to the arrow (and face in that direction) to exit the restaurant", "Coworker");
repaint();
}
Expand All @@ -446,7 +449,7 @@ public void paintComponent(Graphics g) {
}
} else {
for (Station stn : stations) {
if (stn.getName().equalsIgnoreCase("exit") && !User.hasTrained) {
if (inTraining && stn.getName().equalsIgnoreCase("exit") && !User.hasTrained) {
// do not allow exiting
continue;
}
Expand Down
7 changes: 2 additions & 5 deletions SoundFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ private SoundFX(String name, int duration) {
try {
audioInput = AudioSystem.getAudioInputStream(this.getClass().getResource(Utility.RES_NAME + "/sfx/"+name+".wav"));
}
catch (UnsupportedAudioFileException e) {}
catch (IOException e) {}
catch (Exception e) {}
}

/**
Expand All @@ -56,8 +55,6 @@ public void run() {
Thread.sleep(duration);
sfx.close();
}
catch (LineUnavailableException e) {}
catch (InterruptedException e) {}
catch (IOException e) {}
catch (Exception e) {}
}
}
1 change: 0 additions & 1 deletion SplashScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ private void refreshScreen() {
timer = new javax.swing.Timer(17, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(logoAlpha);
repaint();
}
});
Expand Down
1 change: 0 additions & 1 deletion TrainingLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ public void paintComponent(Graphics g) {
// Return to the restaurant once the training for that station has been completed
// (i.e. all of the information has been read)
if (infoCard.canProceed()) {
System.out.println("back");
deactivate();
Utility.backToRestaurant();
return;
Expand Down

0 comments on commit 590198b

Please sign in to comment.