Occupant events.

Undocumented, I'm sure we'll change some things around soon.
Fixed a few bugs, too.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@190 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2007-02-14 23:50:33 +00:00
parent c8ee960c0d
commit ee871c3f2f
4 changed files with 154 additions and 6 deletions
@@ -190,6 +190,13 @@ public class EZGameControl extends EventDispatcher
StateChangedEvent.GAME_ENDED, scl.stateChanged,
false, 0, true);
}
if (obj is OccupantChangedListener) {
var ocl :OccupantChangedListener = (obj as OccupantChangedListener);
addEventListener(OccupantChangedEvent.OCCUPANT_ENTERED, ocl.occupantEntered,
false, 0, true);
addEventListener(OccupantChangedEvent.OCCUPANT_LEFT, ocl.occupantLeft,
false, 0, true);
}
}
/**
@@ -216,6 +223,11 @@ public class EZGameControl extends EventDispatcher
removeEventListener(
StateChangedEvent.GAME_ENDED, scl.stateChanged);
}
if (obj is OccupantChangedListener) {
var ocl :OccupantChangedListener = (obj as OccupantChangedListener);
removeEventListener(OccupantChangedEvent.OCCUPANT_ENTERED, ocl.occupantEntered);
removeEventListener(OccupantChangedEvent.OCCUPANT_LEFT, ocl.occupantLeft);
}
}
/**
@@ -540,6 +552,7 @@ public class EZGameControl extends EventDispatcher
o["gameDidStart_v1"] = gameDidStart_v1;
o["gameDidEnd_v1"] = gameDidEnd_v1;
o["dispatchEvent_v1"] = dispatch;
o["occupantChanged_v1"] = occupantChanged_v1;
}
/**
@@ -584,6 +597,17 @@ public class EZGameControl extends EventDispatcher
dispatch(new StateChangedEvent(StateChangedEvent.GAME_ENDED, this));
}
/**
* Private method to post a OccupantEvent.
*/
private function occupantChanged_v1 (occupantId :int, player :Boolean, enter :Boolean) :void
{
dispatch(new OccupantChangedEvent(
enter ? OccupantChangedEvent.OCCUPANT_ENTERED
: OccupantChangedEvent.OCCUPANT_LEFT,
this, occupantId, player));
}
/**
* Sets the properties we received from the EZ game framework
* on the other side of the security boundary.