summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-01-28 15:52:30 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-01-28 15:52:30 -0500
commit8f46c097bf0b3cf314af62a66428e04043d0a61f (patch)
tree8e2ebbb3698e2a36fdb261a3bb651a4cd34a1b6e /src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java
parentc29a8870d46edd635963d54b3ada87db10352b76 (diff)
downloadfourpuzzle-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.java15
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
6package com.fourisland.fourpuzzle.gamestate.mapview.event; 6package com.fourisland.fourpuzzle.gamestate.mapview.event;
7 7
8import 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}