1 package de.jos.game.actions;
2
3 import java.util.List;
4
5 import org.apache.commons.lang.StringUtils;
6
7 import com.golden.gamedev.object.GameFont;
8
9 import de.jos.game.actions.cleanup.AbstractCleanupAction;
10 import de.jos.game.objects.ResourceContainer;
11
12 /***
13 * Jedes AbstractAction Event ist selbst fuer sein rendern verantwortlich.
14 *
15 * @author root
16 *
17 */
18 public abstract class AbstractAction {
19
20 private ResourceContainer resourceContainer = null;
21 private GameFont gameFont = null;
22 private AbstractCleanupAction cleanupAction = null;
23
24 public void init() {
25 gameFont = resourceContainer.getGameFont();
26 }
27
28 public void cleanup() {
29
30 if (cleanupAction != null) {
31 cleanupAction.cleanup();
32 }
33 }
34
35 public List<SpecialActionEvent> getNewSpecialEventList() {
36 if (cleanupAction != null) {
37 return cleanupAction.getNewSpecialEventList();
38 }
39 return null;
40 }
41
42 protected String getString(String key) {
43 return StringUtils.upperCase(getResourceContainer().getLabelResources().getString(key));
44 }
45
46 protected String getString(String key, String appendString) {
47 return getString(key) + appendString;
48 }
49
50 public abstract Integer getLayer();
51
52 public ResourceContainer getResourceContainer() {
53 return resourceContainer;
54 }
55
56 public void setResourceContainer(ResourceContainer resourceContainer) {
57 this.resourceContainer = resourceContainer;
58 }
59
60 protected GameFont getGameFont() {
61 return gameFont;
62 }
63
64 public boolean isBlocking() {
65 return true;
66 }
67
68 public AbstractCleanupAction getCleanupAction() {
69 return cleanupAction;
70 }
71
72 public void setCleanupAction(AbstractCleanupAction cleanupAction) {
73 this.cleanupAction = cleanupAction;
74 }
75
76 }