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); }
public override void OnReceived() { SGC_RefreshTimeout command = new SGC_RefreshTimeout(); m_visualManager.TransmitStream(command.PackCommand()); }
public override void OnReceivedAi(AiPlayer aiPlayer, ClientConnectionManager aiConnection) { SGC_RefreshTimeout command = new SGC_RefreshTimeout(); aiConnection.TransmitStream(command.PackCommand()); }