将位图数组发送到SmartFoxserver

时间:2013-09-18 14:08:51

标签: java javascript client-server smartfoxserver

是否有人可以帮助我向SmartFoxServer2X发送一系列位图? 我知道有一个文档,但我是编程的新手,我不知道如何解决这个问题。 在客户端我使用JavaScript,我想将此数组发送到服务器:

 var params = {n1:this.cubes1to20_arr};
    this.sfs.addEventListener(SFS2X.SFSEvent.EXTENSION_RESPONSE, this.onExtensionResponse,this);
    this.sfs.send(new SFS2X.Requests.System.ExtensionRequest("upload_cubes",params));

就像我说this.cubes1to20_arr是一个有20位图的数组。 当我尝试将请求发送到服务器时,我收到错误

> `[INFO] OUTGOING DATA
p: [Object]
    p: [Object]
        n1: [Array]
            19: [Bitmap (name=null)] (Unsupported)
            18: [Bitmap (name=null)] (Unsupported)
            17: [Bitmap (name=null)] (Unsupported)
            16: [Bitmap (name=null)] (Unsupported)
            15: [Bitmap (name=null)] (Unsupported)
            14: [Bitmap (name=null)] (Unsupported)
            13: [Bitmap (name=null)] (Unsupported)
            12: [Bitmap (name=null)] (Unsupported)
            11: [Bitmap (name=null)] (Unsupported)
            10: [Bitmap (name=null)] (Unsupported)
            9: [Bitmap (name=null)] (Unsupported)
            8: [Bitmap (name=null)] (Unsupported)
            7: [Bitmap (name=null)] (Unsupported)
            6: [Bitmap (name=null)] (Unsupported)
            5: [Bitmap (name=null)] (Unsupported)
            4: [Bitmap (name=null)] (Unsupported)
            3: [Bitmap (name=null)] (Unsupported)
            2: [Bitmap (name=null)] (Unsupported)
            1: [Bitmap (name=null)] (Unsupported)
            0: [Bitmap (name=null)] (Unsupported)
    r: -1 (Num)
    c: upload_cubes (Str)
c: 1 (Num)
a: 13 (Num)`

所以我认为我必须创建一个byteArray并将其发送到服务器。 你知道我怎么能意识到这一点?

提前感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

您可能不想这样做:)

SFS用于多人游戏功能,而不是上传图片。我建议通过与SFS相关的Web服务器启动上传脚本。通常,您希望保持SFS服务器的处理能力,并且上传大量数据需要更多的处理。

有没有办法做到这一点,是的,但使用JavaScript API会让它变得更难(也更慢)。您可以更好地使用C#,Java甚至AS3。