Use PresentsDObjectManager.newInterval
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@862 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -783,13 +783,11 @@ public class GameManager extends PlaceManager
|
|||||||
_gameconfig = (GameConfig)_config;
|
_gameconfig = (GameConfig)_config;
|
||||||
|
|
||||||
// start up our tick interval
|
// start up our tick interval
|
||||||
_tickInterval = new Interval(_omgr) {
|
_tickInterval = _omgr.newInterval(new Runnable() {
|
||||||
@Override
|
public void run () {
|
||||||
public void expired () {
|
|
||||||
tick(System.currentTimeMillis());
|
tick(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
};
|
}).schedule(TICK_DELAY, true);
|
||||||
_tickInterval.schedule(TICK_DELAY, true);
|
|
||||||
|
|
||||||
// configure our AIs
|
// configure our AIs
|
||||||
for (int ii = 0; ii < _gameconfig.ais.length; ii++) {
|
for (int ii = 0; ii < _gameconfig.ais.length; ii++) {
|
||||||
@@ -1115,13 +1113,11 @@ public class GameManager extends PlaceManager
|
|||||||
protected void startAITicker ()
|
protected void startAITicker ()
|
||||||
{
|
{
|
||||||
if (_aiTicker == null) {
|
if (_aiTicker == null) {
|
||||||
_aiTicker = new Interval(_omgr) {
|
_aiTicker = _omgr.newInterval(new Runnable() {
|
||||||
@Override
|
public void run () {
|
||||||
public void expired () {
|
|
||||||
tickAIs();
|
tickAIs();
|
||||||
}
|
}
|
||||||
};
|
}).schedule(AI_TICK_DELAY, true);
|
||||||
_aiTicker.schedule(AI_TICK_DELAY, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1272,6 +1268,7 @@ public class GameManager extends PlaceManager
|
|||||||
protected void gameWasCancelled ()
|
protected void gameWasCancelled ()
|
||||||
{
|
{
|
||||||
// nothing to do by default
|
// nothing to do by default
|
||||||
|
stopAITicker();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.google.inject.Injector;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
import com.samskivert.util.Interval;
|
|
||||||
import com.samskivert.util.Lifecycle;
|
import com.samskivert.util.Lifecycle;
|
||||||
|
|
||||||
import com.threerings.presents.client.InvocationService;
|
import com.threerings.presents.client.InvocationService;
|
||||||
@@ -48,7 +47,7 @@ import static com.threerings.parlor.Log.log;
|
|||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public abstract class TourniesManager
|
public abstract class TourniesManager
|
||||||
implements TourniesProvider, Lifecycle.Component
|
implements TourniesProvider, Lifecycle.InitComponent
|
||||||
{
|
{
|
||||||
@Inject public TourniesManager (Lifecycle cycle)
|
@Inject public TourniesManager (Lifecycle cycle)
|
||||||
{
|
{
|
||||||
@@ -60,18 +59,11 @@ public abstract class TourniesManager
|
|||||||
{
|
{
|
||||||
loadTourneyConfigs();
|
loadTourneyConfigs();
|
||||||
|
|
||||||
_interval = new Interval(_omgr) {
|
_omgr.newInterval(new Runnable() {
|
||||||
@Override public void expired () {
|
public void run () {
|
||||||
updateTournies();
|
updateTournies();
|
||||||
}
|
}
|
||||||
};
|
}).schedule(getIntervalDelay(), true);
|
||||||
_interval.schedule(getIntervalDelay(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// from interface Lifecycle.Component
|
|
||||||
public void shutdown ()
|
|
||||||
{
|
|
||||||
_interval.cancel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// from interface TourniesService
|
// from interface TourniesService
|
||||||
@@ -139,9 +131,6 @@ public abstract class TourniesManager
|
|||||||
*/
|
*/
|
||||||
protected abstract long getIntervalDelay ();
|
protected abstract long getIntervalDelay ();
|
||||||
|
|
||||||
/** The interval which updates loaded tournies. */
|
|
||||||
protected Interval _interval;
|
|
||||||
|
|
||||||
/** Count to provide a unique key to tournies as they're created. */
|
/** Count to provide a unique key to tournies as they're created. */
|
||||||
protected int _tourneyCount;
|
protected int _tourneyCount;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user