diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-01-28 15:52:30 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-01-28 15:52:30 -0500 |
commit | 8f46c097bf0b3cf314af62a66428e04043d0a61f (patch) | |
tree | 8e2ebbb3698e2a36fdb261a3bb651a4cd34a1b6e /src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java | |
parent | c29a8870d46edd635963d54b3ada87db10352b76 (diff) | |
download | fourpuzzle-8f46c097bf0b3cf314af62a66428e04043d0a61f.tar.gz fourpuzzle-8f46c097bf0b3cf314af62a66428e04043d0a61f.tar.bz2 fourpuzzle-8f46c097bf0b3cf314af62a66428e04043d0a61f.zip |
Created a manager for SpecialEvent action threads
EventHandler controls when they are executed and allows MapViewGameState to poll it to see if it is currently managing any action threads. If it is, MapViewGameState should be able to prevent certain actions from occuring (unless the action thread is ParallelProcess) such as keyboard input.
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java')
-rw-r--r-- | src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java index 3bbde17..64ca592 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java | |||
@@ -5,6 +5,8 @@ | |||
5 | 5 | ||
6 | package com.fourisland.fourpuzzle.gamestate.mapview.event; | 6 | package com.fourisland.fourpuzzle.gamestate.mapview.event; |
7 | 7 | ||
8 | import java.util.concurrent.Future; | ||
9 | |||
8 | /** | 10 | /** |
9 | * | 11 | * |
10 | * @author hatkirby | 12 | * @author hatkirby |
@@ -22,9 +24,18 @@ public abstract class EventCall extends SpecialEvent implements Runnable { | |||
22 | 24 | ||
23 | public abstract void run(); | 25 | public abstract void run(); |
24 | 26 | ||
25 | public void activate() | 27 | private Future isRunning = null; |
28 | public void activate(EventCallTime calltime) | ||
26 | { | 29 | { |
27 | new Thread(this, "Special Event").start(); | 30 | if ((isRunning == null) || (isRunning.isDone())) |
31 | { | ||
32 | if (calltime == EventCallTime.ParallelProcess) | ||
33 | { | ||
34 | isRunning = EventHandler.runParallel(this); | ||
35 | } else { | ||
36 | isRunning = EventHandler.runEvent(this); | ||
37 | } | ||
38 | } | ||
28 | } | 39 | } |
29 | 40 | ||
30 | } | 41 | } |