Beispiel #1
0
    void OnCardClick(CardVisual card)
    {
        // Tell logic server to try to play this card
        SGC_PlayCardFromHand command = new SGC_PlayCardFromHand(card.m_cardID);

        m_visualManager.TransmitStream(command.PackCommand());
        m_visualManager.MakeAllUnclickable();
    }
Beispiel #2
0
    public override void ExecuteAiCommand(AiPlayer aiPlayer, ClientConnectionManager aiConnection)
    {
        //@TODO: Proper AI card selection
        int cardId = aiPlayer.m_cards[0].Key;

        aiPlayer.m_cards.RemoveAt(0);
        SGC_PlayCardFromHand command = new SGC_PlayCardFromHand(cardId);

        aiConnection.TransmitStream(command.PackCommand());
    }
Beispiel #3
0
    public static SGCommand CreateCommandFromPacket(BKSystem.IO.BitStream packet, int playerID)
    {
        if (packet.Length < 0)
        {
            return(null);
        }

        ushort commandID;

        packet.Position = 0;
        packet.Read(out commandID, 0, 16);
        Debug.Log("Read packet with server command ID: " + commandID);

        SGCommand command;

        switch (commandID)
        {
        case 1:
            command = new SGC_CastSpellFromChannel0(packet, playerID);
            break;

        case 2:
            command = new SGC_PlayCardFromHand(packet, playerID);
            break;

        case 3:
            command = new SGC_SendDeck(packet, playerID);
            break;

        case 4:
            command = new SGC_RefreshTimeout(packet, playerID);
            break;

        default:
            command = null;
            break;
        }

        command.m_ID = (SGCommandID)commandID;

        return(command);
    }