コード例 #1
0
    public override void ExecuteAiCommand(AiPlayer aiPlayer, ClientConnectionManager aiConnection)
    {
        // @TODO: AI implementation
        // Sending the same deck that the player loaded for now
        string     deckFileName = m_visualManager.GetDeckFileName();
        PackedDeck deck         = new PackedDeck();

        deck.LoadFromJSON(PackedDeck.deckPath + deckFileName);
        SGC_SendDeck command = new SGC_SendDeck(deck);

        m_visualManager.TransmitStream(command.PackCommand());
    }
コード例 #2
0
    public override void ExecuteCommand()
    {
        // @TODO: Open deck picker interface

        // For now, send the deck that was picked in the connect menu
        string     deckFileName = m_visualManager.GetDeckFileName();
        PackedDeck deck         = new PackedDeck();

        deck.LoadFromJSON(PackedDeck.deckPath + deckFileName);
        SGC_SendDeck command = new SGC_SendDeck(deck);

        m_visualManager.TransmitStream(command.PackCommand());

        FinishCommand();
    }
コード例 #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);
    }