void send_cardinfo_to_player(CPlayer player)
{
byte count = (byte)this.engine.distributed_floor_cards.Count;
CPacket msg = CPacket.create((short)PROTOCOL.BEGIN_CARD_INFO);
msg.push(player.player_index);
msg.push(count);
for (int i = 0; i < count; ++i)
{
msg.push(this.engine.distributed_floor_cards[i].number);
msg.push((byte)this.engine.distributed_floor_cards[i].pae_type);
msg.push((byte)this.engine.distributed_floor_cards[i].position);
}
msg.push((byte)this.players.Count);
for (int i = 0; i < this.players.Count; ++i)
{
byte player_index = this.players[i].player_index;
byte players_card_count = (byte)this.engine.distributed_players_cards[player_index].Count;
msg.push(player_index);
msg.push(players_card_count);
// 플레이어 본인의 카드정보만 실제 카드로 보내주고,
// 다른 플레이어의 카드는 null카드로 보내줘서 클라이언트딴에서는 알지 못하게 한다.
if (player.player_index == player_index)
{
for (int card_index = 0; card_index < players_card_count; ++card_index)
{
msg.push(this.engine.distributed_players_cards[player_index][card_index].number);
msg.push((byte)this.engine.distributed_players_cards[player_index][card_index].pae_type);
msg.push((byte)this.engine.distributed_players_cards[player_index][card_index].position);
}
}
else
{
for (int card_index = 0; card_index < players_card_count; ++card_index)
{
// 다른 플레이어의 카드는 null카드로 보내준다.
msg.push(byte.MaxValue);
}
}
}
player.send(msg);
}