在v6.x中得到我正在使用的分数
FB.API("/me/scores", HttpMethod.GET, LoadScoreCallback)
其中LoadScoreCallback
使用FBResult
。由于FBResult
已被7.x中的IGraphResult
取代,因此我无法通过它获得分数。有谁知道怎么做?
答案 0 :(得分:4)
IGraphResult从FB.API回复" / me / scores"具有您在v7.x +
中所期望的分数数据以下是解析结果的示例代码(注意:您应该添加错误处理):
void handleScoresResponse (IGraphResult result)
{
UnityEngine.Debug.Log(result.RawResult);
var dataList = result.ResultDictionary["data"] as List<object>;
var dataDict = dataList[0] as Dictionary<string, object>;
long score = (long)dataDict["score"];
var user = dataDict["user"] as Dictionary<string, object>;
string userName = user["name"] as string;
string userID = user["id"] as string;
UnityEngine.Debug.Log(userName + ": " + score);
}