Last active
December 17, 2015 14:39
-
-
Save LuckOfWise/5625956 to your computer and use it in GitHub Desktop.
UnityからSCORE BOARD(http://www.score-board.mobi/)を使う場合
AndroidManifest.xmlはREADME.txtを見て更新してください。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// スコアの送信 | |
void PostRanking (int score) | |
{ | |
#if UNITY_ANDROID | |
AndroidJavaClass plugin = new AndroidJavaClass ("jp.basicinc.gamefeat.ranking.android.sdk.controller.GFRankingController"); | |
AndroidJavaClass unityPlayer = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); | |
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject> ("currentActivity"); | |
AndroidJavaObject ranking = plugin.CallStatic<AndroidJavaObject> ("getIncetance", activity); | |
ranking.Call ("sendScore", new string[] {"[ゲームモードID]"}, new string[] { score.ToString()}); | |
#endif | |
} | |
// ランキングページ表示 | |
void ShowRanking () | |
{ | |
#if UNITY_ANDROID | |
AndroidJavaClass plugin = new AndroidJavaClass ("jp.basicinc.gamefeat.ranking.android.sdk.controller.GFRankingController"); | |
AndroidJavaClass unityPlayer = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); | |
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject> ("currentActivity"); | |
plugin.CallStatic ("show", activity, "[ゲームモードID]"); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment