summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/Database.java
blob: 30bc8a3999d6aa2eb20b355db54f2b211aa67d67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.fourisland.fourpuzzle;

import com.fourisland.fourpuzzle.transition.SquareTransition;
import com.fourisland.fourpuzzle.transition.Transition;
import com.fourisland.fourpuzzle.transition.TransitionDirection;
import java.util.HashMap;

/**
 *
 * @author hatkirby
 */
public class Database {
    
    private static HashMap<String, String> vocabulary = new HashMap<String, String>();
    private static GameCharacters heros = GameCharacters.getDefaultParty();
    private static HashMap<String, String> music = new HashMap<String, String>();
    private static HashMap<String, Transition> transitions = new HashMap<String, Transition>();
    
    static {
        loadDefaultVocabulary();
        loadDefaultMusic();
        loadDefaultTransitions();
    }

    /* Vocabulary */

    private static void loadDefaultVocabulary()
    {
        /* Global */
        vocabulary.put("Title", "Untitled Game");
        
        /* TitleScreen */
        vocabulary.put("NewGame", "New Game");
        vocabulary.put("LoadGame", "Load Game");
        vocabulary.put("EndGame", "End");
    }
    
    public static String getVocab(String key)
    {
        return vocabulary.get(key);
    }
    
    public static void setVocab(String key, String value)
    {
        vocabulary.put(key, value);
    }
    
    /* Heros */
    
    public static void addHero(GameCharacter hero)
    {
        heros.add(hero);
    }
    
    public static GameCharacters createParty()
    {
        return GameCharacters.createParty();
    }
    
    /* Music */
    
    public static void loadDefaultMusic()
    {
        music.put("Title", "Opening1");
        music.put("GameOver", "GameOver");
    }
    
    public static String getMusic(String key)
    {
        return music.get(key);
    }
    
    public static void setMusic(String key, String value)
    {
        music.put(key, value);
    }
    
    /* Transitions */
    
    public static void loadDefaultTransitions()
    {
        transitions.put("MapExit", new SquareTransition(TransitionDirection.Out));
        transitions.put("MapEnter", new SquareTransition(TransitionDirection.In));
    }
    
    public static Transition getTransition(String key)
    {
        return transitions.get(key).copy();
    }
    
    public static void setTransition(String key, Transition value)
    {
        transitions.put(key, value);
    }

}