diff options
Diffstat (limited to 'src')
15 files changed, 316 insertions, 118 deletions
| diff --git a/src/com/fourisland/fourpuzzle/Database.java b/src/com/fourisland/fourpuzzle/Database.java deleted file mode 100755 index 30bc8a3..0000000 --- a/src/com/fourisland/fourpuzzle/Database.java +++ /dev/null | |||
| @@ -1,101 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * To change this template, choose Tools | Templates | ||
| 3 | * and open the template in the editor. | ||
| 4 | */ | ||
| 5 | |||
| 6 | package com.fourisland.fourpuzzle; | ||
| 7 | |||
| 8 | import com.fourisland.fourpuzzle.transition.SquareTransition; | ||
| 9 | import com.fourisland.fourpuzzle.transition.Transition; | ||
| 10 | import com.fourisland.fourpuzzle.transition.TransitionDirection; | ||
| 11 | import java.util.HashMap; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * | ||
| 15 | * @author hatkirby | ||
| 16 | */ | ||
| 17 | public class Database { | ||
| 18 | |||
| 19 | private static HashMap<String, String> vocabulary = new HashMap<String, String>(); | ||
| 20 | private static GameCharacters heros = GameCharacters.getDefaultParty(); | ||
| 21 | private static HashMap<String, String> music = new HashMap<String, String>(); | ||
| 22 | private static HashMap<String, Transition> transitions = new HashMap<String, Transition>(); | ||
| 23 | |||
| 24 | static { | ||
| 25 | loadDefaultVocabulary(); | ||
| 26 | loadDefaultMusic(); | ||
| 27 | loadDefaultTransitions(); | ||
| 28 | } | ||
| 29 | |||
| 30 | /* Vocabulary */ | ||
| 31 | |||
| 32 | private static void loadDefaultVocabulary() | ||
| 33 | { | ||
| 34 | /* Global */ | ||
| 35 | vocabulary.put("Title", "Untitled Game"); | ||
| 36 | |||
| 37 | /* TitleScreen */ | ||
| 38 | vocabulary.put("NewGame", "New Game"); | ||
| 39 | vocabulary.put("LoadGame", "Load Game"); | ||
| 40 | vocabulary.put("EndGame", "End"); | ||
| 41 | } | ||
| 42 | |||
| 43 | public static String getVocab(String key) | ||
| 44 | { | ||
| 45 | return vocabulary.get(key); | ||
| 46 | } | ||
| 47 | |||
| 48 | public static void setVocab(String key, String value) | ||
| 49 | { | ||
| 50 | vocabulary.put(key, value); | ||
| 51 | } | ||
| 52 | |||
| 53 | /* Heros */ | ||
| 54 | |||
| 55 | public static void addHero(GameCharacter hero) | ||
| 56 | { | ||
| 57 | heros.add(hero); | ||
| 58 | } | ||
| 59 | |||
| 60 | public static GameCharacters createParty() | ||
| 61 | { | ||
| 62 | return GameCharacters.createParty(); | ||
| 63 | } | ||
| 64 | |||
| 65 | /* Music */ | ||
| 66 | |||
| 67 | public static void loadDefaultMusic() | ||
| 68 | { | ||
| 69 | music.put("Title", "Opening1"); | ||
| 70 | music.put("GameOver", "GameOver"); | ||
| 71 | } | ||
| 72 | |||
| 73 | public static String getMusic(String key) | ||
| 74 | { | ||
| 75 | return music.get(key); | ||
| 76 | } | ||
| 77 | |||
| 78 | public static void setMusic(String key, String value) | ||
| 79 | { | ||
| 80 | music.put(key, value); | ||
| 81 | } | ||
| 82 | |||
| 83 | /* Transitions */ | ||
| 84 | |||
| 85 | public static void loadDefaultTransitions() | ||
| 86 | { | ||
| 87 | transitions.put("MapExit", new SquareTransition(TransitionDirection.Out)); | ||
| 88 | transitions.put("MapEnter", new SquareTransition(TransitionDirection.In)); | ||
| 89 | } | ||
| 90 | |||
| 91 | public static Transition getTransition(String key) | ||
| 92 | { | ||
| 93 | return transitions.get(key).copy(); | ||
| 94 | } | ||
| 95 | |||
| 96 | public static void setTransition(String key, Transition value) | ||
| 97 | { | ||
| 98 | transitions.put(key, value); | ||
| 99 | } | ||
| 100 | |||
| 101 | } | ||
| diff --git a/src/com/fourisland/fourpuzzle/PuzzleApplication.java b/src/com/fourisland/fourpuzzle/PuzzleApplication.java index edf6ac8..25aee9f 100755 --- a/src/com/fourisland/fourpuzzle/PuzzleApplication.java +++ b/src/com/fourisland/fourpuzzle/PuzzleApplication.java | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | */ | 4 | */ |
| 5 | package com.fourisland.fourpuzzle; | 5 | package com.fourisland.fourpuzzle; |
| 6 | 6 | ||
| 7 | import com.fourisland.fourpuzzle.database.Database; | ||
| 8 | import com.fourisland.fourpuzzle.database.Vocabulary; | ||
| 7 | import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState; | 9 | import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState; |
| 8 | import com.fourisland.fourpuzzle.gamestate.mapview.ChipSet; | 10 | import com.fourisland.fourpuzzle.gamestate.mapview.ChipSet; |
| 9 | import com.fourisland.fourpuzzle.util.Interval; | 11 | import com.fourisland.fourpuzzle.util.Interval; |
| @@ -42,7 +44,7 @@ public class PuzzleApplication extends Application { | |||
| 42 | INSTANCE = this; | 44 | INSTANCE = this; |
| 43 | 45 | ||
| 44 | gameFrame = new JDialog(new JFrame(), false); | 46 | gameFrame = new JDialog(new JFrame(), false); |
| 45 | gameFrame.setTitle(Database.getVocab("title")); | 47 | gameFrame.setTitle(Database.getVocab(Vocabulary.Title)); |
| 46 | gameFrame.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); | 48 | gameFrame.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); |
| 47 | gameFrame.setResizable(false); | 49 | gameFrame.setResizable(false); |
| 48 | gameFrame.addWindowListener(new WindowAdapter() { | 50 | gameFrame.addWindowListener(new WindowAdapter() { |
| @@ -153,7 +155,7 @@ public class PuzzleApplication extends Application { | |||
| 153 | 155 | ||
| 154 | JFrame errorBox = new JFrame(ex.getClass().getSimpleName()); | 156 | JFrame errorBox = new JFrame(ex.getClass().getSimpleName()); |
| 155 | JLabel text = new JLabel(); | 157 | JLabel text = new JLabel(); |
| 156 | text.setText("<HTML><CENTER>I'm sorry, but " + Database.getVocab("Title") + | 158 | text.setText("<HTML><CENTER>I'm sorry, but " + Database.getVocab(Vocabulary.Title) + |
| 157 | " has run into an error and been forced to quit.<BR>Your save file has not been kept. The error was:<BR><BR>" + | 159 | " has run into an error and been forced to quit.<BR>Your save file has not been kept. The error was:<BR><BR>" + |
| 158 | ex.getMessage() + "</CENTER>"); | 160 | ex.getMessage() + "</CENTER>"); |
| 159 | if (ex instanceof Error) | 161 | if (ex instanceof Error) |
| diff --git a/src/com/fourisland/fourpuzzle/SaveFile.java b/src/com/fourisland/fourpuzzle/SaveFile.java index d079f0f..a98e8bf 100755 --- a/src/com/fourisland/fourpuzzle/SaveFile.java +++ b/src/com/fourisland/fourpuzzle/SaveFile.java | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | */ | 4 | */ |
| 5 | package com.fourisland.fourpuzzle; | 5 | package com.fourisland.fourpuzzle; |
| 6 | 6 | ||
| 7 | import com.fourisland.fourpuzzle.database.GameCharacters; | ||
| 8 | import com.fourisland.fourpuzzle.database.Database; | ||
| 7 | import com.fourisland.fourpuzzle.gamestate.mapview.event.HeroEvent; | 9 | import com.fourisland.fourpuzzle.gamestate.mapview.event.HeroEvent; |
| 8 | import java.io.IOException; | 10 | import java.io.IOException; |
| 9 | import java.io.InputStream; | 11 | import java.io.InputStream; |
| diff --git a/src/com/fourisland/fourpuzzle/database/Database.java b/src/com/fourisland/fourpuzzle/database/Database.java new file mode 100755 index 0000000..6d61f37 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/database/Database.java | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | /* | ||
| 2 | * To change this template, choose Tools | Templates | ||
| 3 | * and open the template in the editor. | ||
| 4 | */ | ||
| 5 | |||
| 6 | package com.fourisland.fourpuzzle.database; | ||
| 7 | |||
| 8 | import com.fourisland.fourpuzzle.transition.Transition; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * | ||
| 12 | * @author hatkirby | ||
| 13 | */ | ||
| 14 | public class Database { | ||
| 15 | |||
| 16 | public static String getVocab(Vocabulary key) | ||
| 17 | { | ||
| 18 | return key.getValue(); | ||
| 19 | } | ||
| 20 | |||
| 21 | /** | ||
| 22 | * Sets a Vocabulary definition | ||
| 23 | * | ||
| 24 | * FourPuzzle uses pre-defined Vocabulary strings in many places such as | ||
| 25 | * for the Title of the game, menu options and more. There are default | ||
| 26 | * values for all of these definitions, but you can change them if you wish, | ||
| 27 | * using this function. | ||
| 28 | * | ||
| 29 | * @param key The Vocabulary to set | ||
| 30 | * @param value The value to set the Vocabulary to | ||
| 31 | */ | ||
| 32 | public static void setVocab(Vocabulary key, String value) | ||
| 33 | { | ||
| 34 | key.setValue(value); | ||
| 35 | } | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Adds a Hero to the party | ||
| 39 | * | ||
| 40 | * When making a game, you need characters, at least one playable character. | ||
| 41 | * You have to create your characters and use this function to add them to | ||
| 42 | * the central list of playable characters, or your game will not work. | ||
| 43 | * There are no default characters, so this is a must-do. | ||
| 44 | * | ||
| 45 | * @param hero The Hero to add | ||
| 46 | */ | ||
| 47 | public static void addHero(GameCharacter hero) | ||
| 48 | { | ||
| 49 | GameCharacters.getDefaultParty().add(hero); | ||
| 50 | } | ||
| 51 | |||
| 52 | public static GameCharacters createParty() | ||
| 53 | { | ||
| 54 | return GameCharacters.createParty(); | ||
| 55 | } | ||
| 56 | |||
| 57 | public static String getMusic(Music key) | ||
| 58 | { | ||
| 59 | return key.getValue(); | ||
| 60 | } | ||
| 61 | |||
| 62 | /** | ||
| 63 | * Change a default Music value | ||
| 64 | * | ||
| 65 | * In certain places of your game, such as the Title Screen and Game Over | ||
| 66 | * screen, background music plays. You can tell FourPuzzle what Music to | ||
| 67 | * play during these instances with this function. There are default values | ||
| 68 | * for all instances, though. | ||
| 69 | * | ||
| 70 | * @param key The Music instance you wish to change | ||
| 71 | * @param value The name of the Music file you wish to change it to | ||
| 72 | */ | ||
| 73 | public static void setMusic(Music key, String value) | ||
| 74 | { | ||
| 75 | key.setValue(value); | ||
| 76 | } | ||
| 77 | |||
| 78 | public static Transition getTransition(Transitions key) | ||
| 79 | { | ||
| 80 | return key.getValue().copy(); | ||
| 81 | } | ||
| 82 | |||
| 83 | /** | ||
| 84 | * Set a default Transition | ||
| 85 | * | ||
| 86 | * In certain places, a Transition may be displayed that you did not | ||
| 87 | * directly incur. These are default transitions, but they can be changed | ||
| 88 | * if you wish by using this function. | ||
| 89 | * | ||
| 90 | * Warning, all Transition instances have a required type of transition, | ||
| 91 | * whether it be In or Out. If you provide the wrong type of Transition for | ||
| 92 | * a certain instance, your game will not run. | ||
| 93 | * | ||
| 94 | * @param key The transition to change | ||
| 95 | * @param value The transition to change it to | ||
| 96 | */ | ||
| 97 | public static void setTransition(Transitions key, Transition value) | ||
| 98 | { | ||
| 99 | key.setValue(value); | ||
| 100 | } | ||
| 101 | |||
| 102 | public static String getSound(Sound key) | ||
| 103 | { | ||
| 104 | return key.getValue(); | ||
| 105 | } | ||
| 106 | |||
| 107 | /** | ||
| 108 | * Change a default sound effect | ||
| 109 | * | ||
| 110 | * Sound Effects are used in many places of the game. The default sound | ||
| 111 | * effects for certain situations can be changed using this function. | ||
| 112 | * | ||
| 113 | * @param key The Sound instance to change | ||
| 114 | * @param value The name of the Sound file to change it to | ||
| 115 | */ | ||
| 116 | public static void setSound(Sound key, String value) | ||
| 117 | { | ||
| 118 | key.setValue(value); | ||
| 119 | } | ||
| 120 | |||
| 121 | } | ||
| diff --git a/src/com/fourisland/fourpuzzle/GameCharacter.java b/src/com/fourisland/fourpuzzle/database/GameCharacter.java index 8557fef..3930b96 100755 --- a/src/com/fourisland/fourpuzzle/GameCharacter.java +++ b/src/com/fourisland/fourpuzzle/database/GameCharacter.java | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * and open the template in the editor. | 3 | * and open the template in the editor. |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | package com.fourisland.fourpuzzle; | 6 | package com.fourisland.fourpuzzle.database; |
| 7 | 7 | ||
| 8 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; | 8 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; |
| 9 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.EventGraphic; | 9 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.EventGraphic; |
| diff --git a/src/com/fourisland/fourpuzzle/GameCharacters.java b/src/com/fourisland/fourpuzzle/database/GameCharacters.java index 211b66d..bcd533a 100755 --- a/src/com/fourisland/fourpuzzle/GameCharacters.java +++ b/src/com/fourisland/fourpuzzle/database/GameCharacters.java | |||
| @@ -3,8 +3,9 @@ | |||
| 3 | * and open the template in the editor. | 3 | * and open the template in the editor. |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | package com.fourisland.fourpuzzle; | 6 | package com.fourisland.fourpuzzle.database; |
| 7 | 7 | ||
| 8 | import com.fourisland.fourpuzzle.*; | ||
| 8 | import com.fourisland.fourpuzzle.gamestate.GameOverGameState; | 9 | import com.fourisland.fourpuzzle.gamestate.GameOverGameState; |
| 9 | import java.util.ArrayList; | 10 | import java.util.ArrayList; |
| 10 | 11 | ||
| diff --git a/src/com/fourisland/fourpuzzle/database/Music.java b/src/com/fourisland/fourpuzzle/database/Music.java new file mode 100644 index 0000000..4e00ccb --- /dev/null +++ b/src/com/fourisland/fourpuzzle/database/Music.java | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | * To change this template, choose Tools | Templates | ||
| 3 | * and open the template in the editor. | ||
| 4 | */ | ||
| 5 | |||
| 6 | package com.fourisland.fourpuzzle.database; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * | ||
| 10 | * @author hatkirby | ||
| 11 | */ | ||
| 12 | public enum Music { | ||
| 13 | Title("Opening1"), | ||
| 14 | GameOver("GameOver"); | ||
| 15 | |||
| 16 | private String value; | ||
| 17 | private Music(String value) | ||
| 18 | { | ||
| 19 | this.value = value; | ||
| 20 | } | ||
| 21 | |||
| 22 | String getValue() | ||
| 23 | { | ||
| 24 | return value; | ||
| 25 | } | ||
| 26 | |||
| 27 | void setValue(String value) | ||
| 28 | { | ||
| 29 | this.value = value; | ||
| 30 | } | ||
| 31 | } | ||
| diff --git a/src/com/fourisland/fourpuzzle/database/Sound.java b/src/com/fourisland/fourpuzzle/database/Sound.java new file mode 100644 index 0000000..40fda37 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/database/Sound.java | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | * To change this template, choose Tools | Templates | ||
| 3 | * and open the template in the editor. | ||
| 4 | */ | ||
| 5 | |||
| 6 | package com.fourisland.fourpuzzle.database; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * | ||
| 10 | * @author hatkirby | ||
| 11 | */ | ||
| 12 | public enum Sound { | ||
| 13 | MoveCursor("Cursor1"), | ||
| 14 | Selection("Decision2"); | ||
| 15 | |||
| 16 | private String value; | ||
| 17 | private Sound(String value) | ||
| 18 | { | ||
| 19 | this.value = value; | ||
| 20 | } | ||
| 21 | |||
| 22 | String getValue() | ||
| 23 | { | ||
| 24 | return value; | ||
| 25 | } | ||
| 26 | |||
| 27 | void setValue(String value) | ||
| 28 | { | ||
| 29 | this.value = value; | ||
| 30 | } | ||
| 31 | } | ||
| diff --git a/src/com/fourisland/fourpuzzle/database/Transitions.java b/src/com/fourisland/fourpuzzle/database/Transitions.java new file mode 100644 index 0000000..e45ad6d --- /dev/null +++ b/src/com/fourisland/fourpuzzle/database/Transitions.java | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | /* | ||
| 2 | * To change this template, choose Tools | Templates | ||
| 3 | * and open the template in the editor. | ||
| 4 | */ | ||
| 5 | |||
| 6 | package com.fourisland.fourpuzzle.database; | ||
| 7 | |||
| 8 | import com.fourisland.fourpuzzle.transition.InTransition; | ||
| 9 | import com.fourisland.fourpuzzle.transition.MultidirectionalTransition; | ||
| 10 | import com.fourisland.fourpuzzle.transition.OutTransition; | ||
| 11 | import com.fourisland.fourpuzzle.transition.SquareTransition; | ||
| 12 | import com.fourisland.fourpuzzle.transition.Transition; | ||
| 13 | import com.fourisland.fourpuzzle.transition.TransitionDirection; | ||
| 14 | import com.fourisland.fourpuzzle.transition.TransitionUnsupportedException; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * | ||
| 18 | * @author hatkirby | ||
| 19 | */ | ||
| 20 | public enum Transitions { | ||
| 21 | MapExit(TransitionDirection.Out, new SquareTransition(TransitionDirection.Out)), | ||
| 22 | MapEnter(TransitionDirection.In, new SquareTransition(TransitionDirection.In)); | ||
| 23 | |||
| 24 | private final TransitionDirection dir; | ||
| 25 | private Transition trans; | ||
| 26 | private Transitions(TransitionDirection dir, Transition trans) | ||
| 27 | { | ||
| 28 | this.dir = dir; | ||
| 29 | |||
| 30 | if (isTransitionSupported(dir, trans)) | ||
| 31 | { | ||
| 32 | this.trans = trans; | ||
| 33 | } else { | ||
| 34 | throw new TransitionUnsupportedException(trans.getClass().getName(), dir); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | Transition getValue() | ||
| 39 | { | ||
| 40 | return trans; | ||
| 41 | } | ||
| 42 | |||
| 43 | void setValue(Transition trans) | ||
| 44 | { | ||
| 45 | if (isTransitionSupported(dir, trans)) | ||
| 46 | { | ||
| 47 | this.trans = trans; | ||
| 48 | } else { | ||
| 49 | throw new TransitionUnsupportedException(trans.getClass().getName(), dir); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | private boolean isTransitionSupported(TransitionDirection dir, Transition trans) | ||
| 54 | { | ||
| 55 | if (trans instanceof MultidirectionalTransition) | ||
| 56 | { | ||
| 57 | return (((MultidirectionalTransition) trans).getDirection() == dir); | ||
| 58 | } else if (trans instanceof OutTransition) | ||
| 59 | { | ||
| 60 | return (dir == TransitionDirection.Out); | ||
| 61 | } else if (trans instanceof InTransition) | ||
| 62 | { | ||
| 63 | return (dir == TransitionDirection.In); | ||
| 64 | } | ||
| 65 | |||
| 66 | return false; | ||
| 67 | } | ||
| 68 | } | ||
| diff --git a/src/com/fourisland/fourpuzzle/database/Vocabulary.java b/src/com/fourisland/fourpuzzle/database/Vocabulary.java new file mode 100644 index 0000000..e79f3c0 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/database/Vocabulary.java | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* | ||
| 2 | * To change this template, choose Tools | Templates | ||
| 3 | * and open the template in the editor. | ||
| 4 | */ | ||
| 5 | |||
| 6 | package com.fourisland.fourpuzzle.database; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * | ||
| 10 | * @author hatkirby | ||
| 11 | */ | ||
| 12 | public enum Vocabulary { | ||
| 13 | Title("Untitled Game"), | ||
| 14 | NewGame("New Game"), | ||
| 15 | LoadGame("Load Game"), | ||
| 16 | EndGame("End Game"); | ||
| 17 | |||
| 18 | private String value; | ||
| 19 | private Vocabulary(String value) | ||
| 20 | { | ||
| 21 | this.value = value; | ||
| 22 | } | ||
| 23 | |||
| 24 | String getValue() | ||
| 25 | { | ||
| 26 | return value; | ||
| 27 | } | ||
| 28 | |||
| 29 | void setValue(String value) | ||
| 30 | { | ||
| 31 | this.value = value; | ||
| 32 | } | ||
| 33 | } | ||
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java b/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java index 53cae37..459f730 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java | |||
| @@ -6,10 +6,11 @@ | |||
| 6 | package com.fourisland.fourpuzzle.gamestate; | 6 | package com.fourisland.fourpuzzle.gamestate; |
| 7 | 7 | ||
| 8 | import com.fourisland.fourpuzzle.Audio; | 8 | import com.fourisland.fourpuzzle.Audio; |
| 9 | import com.fourisland.fourpuzzle.Database; | 9 | import com.fourisland.fourpuzzle.database.Database; |
| 10 | import com.fourisland.fourpuzzle.Display; | 10 | import com.fourisland.fourpuzzle.Display; |
| 11 | import com.fourisland.fourpuzzle.Game; | 11 | import com.fourisland.fourpuzzle.Game; |
| 12 | import com.fourisland.fourpuzzle.SaveFile; | 12 | import com.fourisland.fourpuzzle.SaveFile; |
| 13 | import com.fourisland.fourpuzzle.database.Music; | ||
| 13 | import com.fourisland.fourpuzzle.transition.SquareTransition; | 14 | import com.fourisland.fourpuzzle.transition.SquareTransition; |
| 14 | import com.fourisland.fourpuzzle.transition.TransitionDirection; | 15 | import com.fourisland.fourpuzzle.transition.TransitionDirection; |
| 15 | import com.fourisland.fourpuzzle.util.ObjectLoader; | 16 | import com.fourisland.fourpuzzle.util.ObjectLoader; |
| @@ -24,7 +25,7 @@ public class GameOverGameState implements GameState { | |||
| 24 | 25 | ||
| 25 | public void initalize() | 26 | public void initalize() |
| 26 | { | 27 | { |
| 27 | Audio.playMusic(Database.getMusic("GameOver")); | 28 | Audio.playMusic(Database.getMusic(Music.GameOver)); |
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | public void deinitalize() | 31 | public void deinitalize() |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java b/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java index cf8b908..ad1ffe1 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java | |||
| @@ -5,7 +5,11 @@ | |||
| 5 | 5 | ||
| 6 | package com.fourisland.fourpuzzle.gamestate; | 6 | package com.fourisland.fourpuzzle.gamestate; |
| 7 | 7 | ||
| 8 | import com.fourisland.fourpuzzle.database.Database; | ||
| 8 | import com.fourisland.fourpuzzle.*; | 9 | import com.fourisland.fourpuzzle.*; |
| 10 | import com.fourisland.fourpuzzle.database.Music; | ||
| 11 | import com.fourisland.fourpuzzle.database.Sound; | ||
| 12 | import com.fourisland.fourpuzzle.database.Vocabulary; | ||
| 9 | import com.fourisland.fourpuzzle.gamestate.mapview.MapViewGameState; | 13 | import com.fourisland.fourpuzzle.gamestate.mapview.MapViewGameState; |
| 10 | import com.fourisland.fourpuzzle.transition.SquareTransition; | 14 | import com.fourisland.fourpuzzle.transition.SquareTransition; |
| 11 | import com.fourisland.fourpuzzle.transition.TransitionDirection; | 15 | import com.fourisland.fourpuzzle.transition.TransitionDirection; |
| @@ -27,9 +31,9 @@ public class TitleScreenGameState implements GameState { | |||
| 27 | 31 | ||
| 28 | public void initalize() | 32 | public void initalize() |
| 29 | { | 33 | { |
| 30 | Audio.playMusic(Database.getMusic("Title")); | 34 | Audio.playMusic(Database.getMusic(Music.Title)); |
| 31 | 35 | ||
| 32 | choices = new ChoiceWindow(Arrays.asList(Database.getVocab("NewGame"), Database.getVocab("LoadGame"), Database.getVocab("EndGame")), true); | 36 | choices = new ChoiceWindow(Arrays.asList(Database.getVocab(Vocabulary.NewGame), Database.getVocab(Vocabulary.LoadGame), Database.getVocab(Vocabulary.EndGame)), true); |
| 33 | wx = (Game.WIDTH/2)-(choices.getWidth()/2); | 37 | wx = (Game.WIDTH/2)-(choices.getWidth()/2); |
| 34 | wy = (Game.HEIGHT/4*3)-(choices.getHeight()/2); | 38 | wy = (Game.HEIGHT/4*3)-(choices.getHeight()/2); |
| 35 | } | 39 | } |
| @@ -46,9 +50,9 @@ public class TitleScreenGameState implements GameState { | |||
| 46 | { | 50 | { |
| 47 | if (Game.getKey().getKeyCode() == KeyEvent.VK_ENTER) | 51 | if (Game.getKey().getKeyCode() == KeyEvent.VK_ENTER) |
| 48 | { | 52 | { |
| 49 | Audio.playSound("Decision2"); | 53 | Audio.playSound(Database.getSound(Sound.Selection)); |
| 50 | 54 | ||
| 51 | if (choices.getSelected().equals(Database.getVocab("NewGame"))) | 55 | if (choices.getSelected().equals(Database.getVocab(Vocabulary.NewGame))) |
| 52 | { | 56 | { |
| 53 | Game.setSaveFile(new SaveFile()); | 57 | Game.setSaveFile(new SaveFile()); |
| 54 | 58 | ||
| @@ -69,10 +73,10 @@ public class TitleScreenGameState implements GameState { | |||
| 69 | } | 73 | } |
| 70 | } | 74 | } |
| 71 | }).start(); | 75 | }).start(); |
| 72 | } else if (choices.getSelected().equals(Database.getVocab("LoadGame"))) | 76 | } else if (choices.getSelected().equals(Database.getVocab(Vocabulary.LoadGame))) |
| 73 | { | 77 | { |
| 74 | // Do nothing, yet | 78 | // Do nothing, yet |
| 75 | } else if (choices.getSelected().equals(Database.getVocab("EndGame"))) | 79 | } else if (choices.getSelected().equals(Database.getVocab(Vocabulary.EndGame))) |
| 76 | { | 80 | { |
| 77 | new Thread(new Runnable() { | 81 | new Thread(new Runnable() { |
| 78 | public void run() { | 82 | public void run() { |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java index f39c451..fac21c6 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java | |||
| @@ -10,7 +10,7 @@ import java.awt.Graphics; | |||
| 10 | import java.awt.Point; | 10 | import java.awt.Point; |
| 11 | import com.fourisland.fourpuzzle.Direction; | 11 | import com.fourisland.fourpuzzle.Direction; |
| 12 | import com.fourisland.fourpuzzle.Game; | 12 | import com.fourisland.fourpuzzle.Game; |
| 13 | import com.fourisland.fourpuzzle.GameCharacter; | 13 | import com.fourisland.fourpuzzle.database.GameCharacter; |
| 14 | import com.fourisland.fourpuzzle.gamestate.mapview.Map; | 14 | import com.fourisland.fourpuzzle.gamestate.mapview.Map; |
| 15 | import com.fourisland.fourpuzzle.gamestate.mapview.MapViewGameState; | 15 | import com.fourisland.fourpuzzle.gamestate.mapview.MapViewGameState; |
| 16 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; | 16 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java index 5bd312a..22e464d 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java | |||
| @@ -5,7 +5,9 @@ | |||
| 5 | 5 | ||
| 6 | package com.fourisland.fourpuzzle.gamestate.mapview.event; | 6 | package com.fourisland.fourpuzzle.gamestate.mapview.event; |
| 7 | 7 | ||
| 8 | import com.fourisland.fourpuzzle.database.Database; | ||
| 8 | import com.fourisland.fourpuzzle.*; | 9 | import com.fourisland.fourpuzzle.*; |
| 10 | import com.fourisland.fourpuzzle.database.Transitions; | ||
| 9 | import com.fourisland.fourpuzzle.gamestate.mapview.MapViewGameState; | 11 | import com.fourisland.fourpuzzle.gamestate.mapview.MapViewGameState; |
| 10 | import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEvent; | 12 | import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEvent; |
| 11 | import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventThread; | 13 | import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventThread; |
| @@ -190,14 +192,14 @@ public class SpecialEvent { | |||
| 190 | { | 192 | { |
| 191 | if (!startedTransition) | 193 | if (!startedTransition) |
| 192 | { | 194 | { |
| 193 | Display.transition(Database.getTransition("MapExit")); | 195 | Display.transition(Database.getTransition(Transitions.MapExit)); |
| 194 | } | 196 | } |
| 195 | 197 | ||
| 196 | Game.setGameState(new MapViewGameState(map, x, y)); | 198 | Game.setGameState(new MapViewGameState(map, x, y)); |
| 197 | 199 | ||
| 198 | if (!startedTransition) | 200 | if (!startedTransition) |
| 199 | { | 201 | { |
| 200 | Display.transition(Database.getTransition("MapEnter")); | 202 | Display.transition(Database.getTransition(Transitions.MapEnter)); |
| 201 | } | 203 | } |
| 202 | } | 204 | } |
| 203 | 205 | ||
| diff --git a/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java b/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java index 9da5d60..6a82c6a 100755 --- a/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java +++ b/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java | |||
| @@ -5,7 +5,10 @@ | |||
| 5 | 5 | ||
| 6 | package com.fourisland.fourpuzzle.window; | 6 | package com.fourisland.fourpuzzle.window; |
| 7 | 7 | ||
| 8 | import com.fourisland.fourpuzzle.window.SystemGraphic; | ||
| 8 | import com.fourisland.fourpuzzle.Audio; | 9 | import com.fourisland.fourpuzzle.Audio; |
| 10 | import com.fourisland.fourpuzzle.database.Database; | ||
| 11 | import com.fourisland.fourpuzzle.database.Sound; | ||
| 9 | import java.awt.Font; | 12 | import java.awt.Font; |
| 10 | import java.awt.Graphics2D; | 13 | import java.awt.Graphics2D; |
| 11 | import java.awt.Rectangle; | 14 | import java.awt.Rectangle; |
| @@ -106,7 +109,7 @@ public class ChoiceWindow { | |||
| 106 | { | 109 | { |
| 107 | if (selected > 0) | 110 | if (selected > 0) |
| 108 | { | 111 | { |
| 109 | Audio.playSound("Cursor1"); | 112 | Audio.playSound(Database.getSound(Sound.MoveCursor)); |
| 110 | 113 | ||
| 111 | selected--; | 114 | selected--; |
| 112 | } | 115 | } |
| @@ -116,7 +119,7 @@ public class ChoiceWindow { | |||
| 116 | { | 119 | { |
| 117 | if (selected < (choices.size()-1)) | 120 | if (selected < (choices.size()-1)) |
| 118 | { | 121 | { |
| 119 | Audio.playSound("Cursor1"); | 122 | Audio.playSound(Database.getSound(Sound.MoveCursor)); |
| 120 | 123 | ||
| 121 | selected++; | 124 | selected++; |
| 122 | } | 125 | } |
