コード例 #1
0
        private void showAuthAndSetttingsButtons()
        {
            GUILayout.Label("Authentication and Settings");

                        #if UNITY_ANDROID
            if (GUILayout.Button("Authenticate Silently (with no UI)"))
            {
                PlayGameServices.attemptSilentAuthentication();
            }


            if (GUILayout.Button("Get Auth Token"))
            {
                var token = PlayGameServices.getAuthToken(null);
                Debug.Log("token: " + token);
            }
                        #endif


            if (GUILayout.Button("Authenticate"))
            {
                PlayGameServices.authenticate();
            }


            if (GUILayout.Button("Sign Out"))
            {
                PlayGameServices.signOut();
            }


            if (GUILayout.Button("Is Signed In"))
            {
                // Please note that the isSignedIn method is a total hack that was added to work around a current bug where Google
                // does not properly notify an app that the user signed out
                Debug.Log("is signed in? " + PlayGameServices.isSignedIn());
            }


            if (GUILayout.Button("Get Player Info"))
            {
                var playerInfo = PlayGameServices.getLocalPlayerInfo();
                Prime31.Utils.logObject(playerInfo);

                // if we are on Android and have an avatar image available, lets download the profile pic
                if (Application.platform == RuntimePlatform.Android && playerInfo.avatarUri != null)
                {
                    PlayGameServices.loadProfileImageForUri(playerInfo.avatarUri);
                }
            }


            if (GUILayout.Button("Load Remote Player Info"))
            {
                PlayGameServices.loadPlayer("110453866202127902712");
            }
        }