Package com.threerings.presents.data

Examples of com.threerings.presents.data.ClientObject


    @Override
    public void clientDidLogon (Client client)
    {
        super.clientDidLogon(client);

        ClientObject clientObj = client.getClientObject();
        if (clientObj instanceof ClusteredBodyObject) {
            // listen to the client object
            clientObj.addListener(this);
            _self = (ClusteredBodyObject) clientObj;

            // we may need to subscribe to a cluster due to session resumption
            maybeUpdateCluster();
        }
View Full Code Here


    public void clientObjectDidChange (Client client)
    {
        super.clientObjectDidChange(client);

        // listen to the client object
        ClientObject clientObj = client.getClientObject();
        clientObj.addListener(this);
        _self = (ClusteredBodyObject) clientObj;
    }
View Full Code Here

            return null;

        } else {
            Hand hand = deck.dealHand(size);
            if (!isAI(playerIndex)) {
                ClientObject clobj = (ClientObject)_omgr.getObject(_playerOids[playerIndex]);
                if (clobj != null) {
                    CardGameSender.sendHand(clobj, _cardgameobj.getOid(), hand);
                }
            }
            return hand;
View Full Code Here

     */
    public void transferCardsBetweenPlayers (int fromPlayerIdx,
        int toPlayerIdx,  Card[] cards)
    {
        // Notify the sender that the cards have been taken
        ClientObject fromClient = getClientObject(fromPlayerIdx);
        if (fromClient != null) {
            CardGameSender.sentCardsToPlayer(fromClient, toPlayerIdx, cards);
        }

        // Notify the receiver with the cards
        ClientObject toClient = getClientObject(toPlayerIdx);
        if (toClient != null) {
            CardGameSender.sendCardsFromPlayer(toClient, fromPlayerIdx,
                cards);
        }

View Full Code Here

     */
    public void transferCardsBetweenPlayers (int[] toPlayerIndices, Card[][] cards)
    {
        // Send all removal notices
        for (int ii = 0; ii < _playerCount; ii++) {
            ClientObject fromClient = getClientObject(ii);
            if (fromClient != null) {
                CardGameSender.sentCardsToPlayer(fromClient, toPlayerIndices[ii], cards[ii]);
            }
        }

        // Send all addition notices and notify everyone else
        for (int ii = 0; ii < _playerCount; ii++) {
            ClientObject toClient = getClientObject(toPlayerIndices[ii]);
            if (toClient != null) {
                CardGameSender.sendCardsFromPlayer(toClient, ii, cards[ii]);
            }
            notifyCardsTransferred(ii, toPlayerIndices[ii], cards[ii].length);
        }
View Full Code Here

            receiverOid = _playerOids[toPlayerIdx];
        OccupantOp op = new OccupantOp() {
            public void apply (OccupantInfo info) {
                int oid = info.getBodyOid();
                if (oid != senderOid && oid != receiverOid) {
                    ClientObject client = (ClientObject)_omgr.getObject(oid);
                    if (client != null) {
                        CardGameSender.cardsTransferredBetweenPlayers(client,
                            fromPlayerIdx, toPlayerIdx, cards);
                    }
                }
View Full Code Here

TOP

Related Classes of com.threerings.presents.data.ClientObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.