Unity接入GameCenter排行榜的实现

using UnityEngine;
using System.Collections;

public class GameCenterManager : MonoBehaviour
{

	void Start ()
	{
		if (Application.platform == RuntimePlatform.IPhonePlayer) {
			Social.localUser.Authenticate (success => {
				if (success) {
				} else {
				}
			});
		}
	}
	
	public void ReportScore (long score, string leaderboardID)
	{
		if (Application.platform == RuntimePlatform.IPhonePlayer) {
			if (Social.localUser.authenticated) {
				Social.ReportScore (score, leaderboardID, success => {
				});
			}
		}
	}
   
	public void ShowLeaderboard ()
	{
		if (Application.platform == RuntimePlatform.IPhonePlayer) {
			if (Social.localUser.authenticated) {
				Social.ShowLeaderboardUI ();
			}
		}
	}
}


相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页