void Start()
    {
        operationName     = "a1.png";
        webRequestTexture = new WebRequestTexture(WebRequestType.Texture, path, operationName, texture =>
        {
            if (texture != null)
            {
                Debug.Log(texture.GetType().ToString());
            }
        });
        Main.webRequestManager.Register(webRequestTexture);

        Main.netWorkManager.ResgisterMessage(1, message => {
            TCPNetworkMessage data = message as TCPNetworkMessage;
        });
    }
示例#2
0
    protected override byte[] ParseMessage(INetworkMessage message)
    {
        TCPNetworkMessage temp = message as TCPNetworkMessage;

        byte[] totalBytes = new byte[temp.bodyLenght + 32];

        byte[] mdBytes = BitConverter.GetBytes(temp.md5);
        Array.Copy(mdBytes, 0, totalBytes, 0, 4);

        Array.Copy(BitConverter.GetBytes(temp.bodyLenght), 0, totalBytes, 4, 4);
        Array.Copy(BitConverter.GetBytes(temp.sessionId), 0, totalBytes, 8, 8);
        Array.Copy(BitConverter.GetBytes(temp.mainCmd), 0, totalBytes, 16, 4);
        Array.Copy(BitConverter.GetBytes(temp.cmd), 0, totalBytes, 20, 4);
        Array.Copy(BitConverter.GetBytes(temp.secuity), 0, totalBytes, 24, 4);
        Array.Copy(BitConverter.GetBytes(temp.returnCode), 0, totalBytes, 28, 4);
        return(totalBytes);
    }