-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8bd3fb3
commit 82755cf
Showing
5 changed files
with
62 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class AgainGameCommand implements ButtonCommand { | ||
EndGamePrompt endGamePrompt; | ||
public AgainGameCommand(EndGamePrompt endGamePrompt){ | ||
this.endGamePrompt = endGamePrompt; | ||
} | ||
public void execute(){ | ||
endGamePrompt.setResult(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public interface ButtonCommand { | ||
public void execute(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class EndGameCommand implements ButtonCommand { | ||
EndGamePrompt endGamePrompt; | ||
public EndGameCommand(EndGamePrompt endGamePrompt){ | ||
this.endGamePrompt = endGamePrompt; | ||
} | ||
public void execute(){ | ||
endGamePrompt.setResult(2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.ActionEvent; | ||
|
||
public class EndGamePromptClickEvent implements ActionListener { | ||
private EndGamePrompt endGamePrompt; | ||
EndGamePromptClickEvent(EndGamePrompt endGamePrompt){ | ||
this.endGamePrompt = endGamePrompt; | ||
} | ||
public void actionPerformed(ActionEvent e) { | ||
if (e.getSource().equals(endGamePrompt.getYesButton())) { | ||
endGamePrompt.setCommand(new AgainGameCommand(endGamePrompt)); | ||
} | ||
if (e.getSource().equals(endGamePrompt.getNoButton())) { | ||
endGamePrompt.setCommand(new EndGameCommand(endGamePrompt)); | ||
} | ||
endGamePrompt.buttonPressed(); | ||
} | ||
} |