The UserIdentifier is global. Cut through the crap.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@837 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -36,7 +36,6 @@ import com.threerings.crowd.util.CrowdContext;
|
||||
import com.threerings.parlor.game.data.GameCodes;
|
||||
import com.threerings.parlor.game.data.GameConfig;
|
||||
import com.threerings.parlor.game.data.GameObject;
|
||||
import com.threerings.parlor.game.data.UserIdentifier;
|
||||
import com.threerings.parlor.util.ParlorContext;
|
||||
|
||||
/**
|
||||
@@ -54,22 +53,6 @@ public /*abstract*/ class GameController extends PlaceController
|
||||
{
|
||||
protected static const log :Log = Log.getLog(GameController);
|
||||
|
||||
/**
|
||||
* Configures a means for identifying users persistently.
|
||||
*/
|
||||
public static function setUserIdentifier (userIder :UserIdentifier) :void
|
||||
{
|
||||
_userIder = userIder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the persistent user id for the supplied player name.
|
||||
*/
|
||||
public static function nameToId (name :Name) :int
|
||||
{
|
||||
return (_userIder == null) ? 0 : _userIder.getUserId(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes this game controller with the game configuration that
|
||||
* was established during the match making process. Derived classes
|
||||
@@ -339,8 +322,5 @@ public /*abstract*/ class GameController extends PlaceController
|
||||
* the client knows the game is over before the server has
|
||||
* transitioned the game object accordingly. */
|
||||
protected var _gameOver :Boolean;
|
||||
|
||||
/** Used to map users to persistent integer identifiers. */
|
||||
protected static var _userIder :UserIdentifier;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,21 @@ package com.threerings.parlor.game.data {
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
public interface UserIdentifier
|
||||
public class UserIdentifier
|
||||
{
|
||||
/**
|
||||
* Returns the id of the specified user, or 0 if they're not valid.
|
||||
* Get the user id for the specified user, or 0 if they're not valid.
|
||||
*/
|
||||
function getUserId (name :Name) :int;
|
||||
public static function getUserId (name :Name) :int
|
||||
{
|
||||
return (_userIder == null) ? 0 : _userIder(name);
|
||||
}
|
||||
|
||||
public static function setIder (userIder :Function) :void
|
||||
{
|
||||
_userIder = userIder;
|
||||
}
|
||||
|
||||
protected static var _userIder :Function;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user