言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

SocialPlatforms.ILocalUser.Authenticate

public function Authenticate(callback: Action<bool>): void;

Description

現在のアクティブな Social API 実装に対してローカルユーザを認証しそのプロファイルデータをフェッチします

これは他の API コールを行なう前に行なわれるべきです。プラットフォームによって、これはログインの詳細を表示するブロックのダイアログをトリガーする場合があります。

// JavaScript
	Social.localUser.Authenticate (function (success) {
        if (success) {
            Debug.Log ("Authentication successful");
            var userInfo : String = "Username: " + Social.localUser.userName + 
                "\nUser ID: " + Social.localUser.id + 
                "\nIsUnderage: " + Social.localUser.underage;
            Debug.Log (userInfo);
        }
        else
            Debug.Log ("Authentication failed");
    });
// C#
Social.localUser.Authenticate (success => {
		if (success) {
			Debug.Log ("Authentication successful");
			string userInfo = "Username: " + Social.localUser.userName + 
				"\nUser ID: " + Social.localUser.id + 
				"\nIsUnderage: " + Social.localUser.underage;
			Debug.Log (userInfo);
		}
		else
			Debug.Log ("Authentication failed");
	});