我有一個腳本,通過 PlayFab id 獲取用戶名并將其寫入變數TestName
它取自原始檔案(并稍作修改):

有沒有快速加載排行榜的解決方案?
uj5u.com熱心網友回復:
我不知道這是否是最好的方法。沒有出現必要資料的原因似乎是因為沒有正確接收排行榜。
GetLeaderboardResult _leaderBoard;
IEnumerator GetLeaderBoardData()
{
int getLeaderBoard = 1;
PlayFabClientAPI.GetLeaderboard(new GetLeaderboardRequest()
{
StartPosition = /*Some Value Setting*/,
StatisticName = /*Some Value Setting*/,
MaxResultsCount = /*Some Value Setting*/,
ProfileConstraints =
new PlayerProfileViewConstraints()
{
ShowLocations = true,
ShowDisplayName = true
}
}, (result)=>
{
_leaderBoard = result;
getLeaderBoard -= 1;
}, (error)=>{});
yield return new WaitWhile(()=>!(getLeaderBoard <= 0));
}
如果您按照上述方式進行操作,相應的排行榜資料將被放入一個名為'_leaderBoard'的變數中。如果有另一種異步等待值進入的方法,您可以使用該方法。
希望這對您有所幫助。:)
uj5u.com熱心網友回復:

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/525589.html
標籤:C#unity3d游乐园
上一篇:我希望在收集所有硬幣后出現鑰匙
