纳金网

标题: unity3d与php的数据交换及本地数据的读取与储存 [打印本页]

作者: 会飞的鱼    时间: 2012-4-11 10:39
标题: unity3d与php的数据交换及本地数据的读取与储存
测试前需要先搭建本机测试环境 下面是英文简介:
This library can be used to exchange data between Unity and php or to load / save binary data to a local file (the position players, etc.) Below you will find a server files, dll and example project.
Put the library in the "Your Project / Assets / Plugins /», server files - to the server, set the path to the gateway:
Code:

Gateway.Init(serverURL, gatewayPath, gatewayName);
Gateway.SESSIONID = "DEBUG";//You can get this from JavaScript
Gateway.GetSender().Call(myo, "ServerToClient", "hashtable", OnGetAnswer);
/*full code attach.*/
/*or for save local*/
void Serialize()
{
UNPSerializer unp = new UNPSerializer();
byte[] ba = unp.Encode(myo);
}
And we get the data in the C# format, in callback function.



Now supported by the serialization / deserialization:

    NULL
    BOOLEAN
    STRING
    INTEGER
    FLOAT
    ARRAY
    ARRAYLIST
    HASHTABLE
    DICTIONARY
    LIST
    VECTOR2
    VECTOR3
    VECTOR4
    COLOR
    QUATERNION
    MESH
    TEXTURE2D (from PNG)

Not support your classes - later it will be included.



For download the Mesh, you must first save the serialized Mesh - you can use the top menu editor "SaveMesh"





I welcome your feedback.





DEMO


    unp.zip (759.3 KB, 7 views)
    unp_server.zip (184.8 KB, 6 views)
    UNP_dll.zip (93.4 KB, 8 views)

来自互联网





欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5