void SendRegisterAccept(Player player)
        {
            Log("SendRegisterAccept on " + player.IPInfo);
            var writer = m_Client.m_Writer;

            writer.Reset();
            ReaderGameHelper.AddClientState(writer, player.State);
            player.Peer.Send(writer, DeliveryMethod.ReliableUnordered);
        }
        void SendVerifyData(Player player)
        {
            Log("SendVerifyData on " + player.IPInfo);
            var writer = m_Client.m_Writer;

            writer.Reset();
            ReaderGameHelper.AddClientState(writer, player.State);
            writer.Put(player.PlayerName);
            writer.Put((byte)player.TypeUnit);
            player.Peer.Send(writer, DeliveryMethod.ReliableUnordered);
        }
Exemplo n.º 3
0
    protected void PrepareSend(NetDataWriter writer)
    {
        ReaderGameHelper.AddWorldUpdate(writer, TypeWorldUpdate.Player);
        ReaderGameHelper.AddClientState(writer, State);
        writer.Put(ID);
        writer.Put(PlayerName);
        writer.Put((byte)TypeUnit);
        int index = m_DataSend.Last + 1;

        writer.Put(index);
        m_DataSend.Add(index);
    }
Exemplo n.º 4
0
    public override void Update(NetDataWriter writer)
    {
        if (m_State != ClientState.Connected)
        {
            return;
        }
        ReaderGameHelper.AddClientState(writer, m_State);
        int index = m_DataSend.Last + 1;

        m_DataSend.Add(index);
        writer.Put(index);
        var data = m_UnitControl.GetData();

        if (writer.PutInWriter(data))
        {
            //шоб наверняка) засрем канал))
            int count = MiscHelper.CountPackets(DeliveryMethod.Unreliable);
            for (int i = 0; i < count; i++)
            {
                m_Peer.Send(writer, DeliveryMethod.Unreliable);
            }
        }
    }