Ejemplo n.º 1
0
    public void SendC2S(Proto.C2S c2s)
    {
        var stream = new System.IO.MemoryStream();

        ProtoBuf.Serializer.Serialize(stream, c2s);
        ws.Send(stream.ToArray());
    }
Ejemplo n.º 2
0
    private void OnOpen(object sender, EventArgs e)
    {
        Debug.Log("websocket connect ok");
        var c2s = new Proto.C2S();
        var pb  = new Proto.GamerLoginC2S();

        pb.id             = this.id;
        pb.session        = this.session;
        c2s.gamerLoginC2S = pb;
        SendC2S(c2s);
    }
Ejemplo n.º 3
0
    private IEnumerator CoHeart()
    {
        yield return(new WaitForSeconds(10));

        var c2s = new Proto.C2S();
        var pb  = new Proto.ServerTimeC2S();

        pb.id             = this.id;
        c2s.serverTimeC2S = pb;
        SendC2S(c2s);
    }