跳转到主要内容

保存数据

安全保存玩家/游戏环境信息数据。 已保存的游戏数据可在控制台中查询,还可通过数据追踪查看历史数据保存记录。

调用信息

public void Save (string storageKey, string storageValue, bool isPrivate, PlayNANOODelegate callback) {}

调用详细信息

参数说明类型
storageKey数据键string
storageValue数据信息string
isPrivate设置数据访问限制时,将阻止外部玩家访问数据。boolean
callback通信结果PlayNANOODelegate

源代码

using PlayNANOO;

public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;

void Awake()
{
plugin = Plugin.GetInstance();

plugin.Storage.Save("storageKey", "storageValue", "isPrivate", (state, error, jsonString, values) => {
if (state.Equals(Configure.PN_API_STATE_SUCCESS))
{
Debug.Log("Success");
}
else
{
Debug.Log("Fail");
}
})
}
}

通信结果

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"Status" : "String"
}