회원 로그인
|
Google Play Games 리더보드
Google Play Games 리더보드
:최고 점수 등록
- 스크립트
:로그인, 로그아웃, Google 이름 표시, 이미지 표시, 최고 점수 등록
-블루스택 확인
:최고 점수 등록
- 스크립트
:로그인, 로그아웃, Google 이름 표시, 이미지 표시, 최고 점수 등록
using UnityEngine; using System.Collections; // ios와 비슷하여 조금만 바꾸면 애플의 게임센터 사용 가능 using UnityEngine.SocialPlatforms; using GooglePlayGames; using GooglePlayGames.BasicApi; using UnityEngine.UI; //1. 사용자 Login public class GooglePlayGamesTest : MonoBehaviour { public Text _userID = null; public Text _scoreText = null; public RawImage _userPic = null; // texture형태로 받을 수 있는 UI.RawImage int _score = 0; void Start () { PlayGamesPlatform.Activate(); // 구글게임서비스 활성화(초기화 작업) - 제일 먼저 호출해야 하는 필수 // Login(); } // 점수 리더보드에 업데이트 public void ScoureUpdate() { // 리더보드 설정 / 넣기 (리더보드ID 넣기) Social.ReportScore(_score, "CgkI0vKu_YoMEAIQBg", ScoreCallback); } // 점수 올리기 public void ScoreUp() { _score += 10; _scoreText.text = _score.ToString(); } // 스코어 callback void ScoreCallback(bool result) // 점수 업데이트 여부 result true 경우 성공 { Social.ShowLeaderboardUI(); // 리더보드 페이지 출력 } // 인증 callback void AuthenticateCallback(bool result) // localUser.Authenticate()의 성공 여부를 result로 { // 출력 _userID.text = "Name : " + Social.localUser.userName; // Social.localUser.id - 아이디(웹서버 로그인 연동 가능) // Social.localUser.image - 사진 // _userPic.texture = Social.localUser.image; // 유저 사진 가져오기 StartCoroutine("UserPictureLoad"); print("Name : " + Social.localUser.userName); } // 유저 이미지 넣기 // 이미지를 받을 까지 계속 시도 IEnumerator UserPictureLoad() { Texture2D pic = Social.localUser.image; // 최초 유저 이미지 가져오기 while (pic == null) // 이미지를 받을 때까지 시도 { pic = Social.localUser.image; yield return null; } _userPic.texture = pic; } // 로그인 public void Login() { // 로그인 여부 확인 if (Social.localUser.authenticated == false) // localUser(본인).authenticated(인증) { // Authenticate(인자 callback)-네트워크/디바이스 상태에 따라 결과가 완료되었을 때 알려줌(true/false) Social.localUser.Authenticate(AuthenticateCallback); } } // 로그 아웃 public void Logout() { ((GooglePlayGames.PlayGamesPlatform)Social.Active).SignOut(); // 형변환 /* 아래와 같음 GooglePlayGames.PlayGamesPlatform pl = (GooglePlayGames.PlayGamesPlatform)Social.Active; pl.SignOut(); */ print("logout"); } }-확인
-블루스택 확인
댓글 0개
| 엮인글 0개
146개(3/8페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
유니티 강좌 모음(영문) | 푸딩뱃살 | 60297 | 2013.08.28 12:02 | |
유니티 경고, 에러 모음 (재정리 예정) [1+1] | 푸딩뱃살 | 71098 | 2013.08.12 00:09 | |
104 | [콘솔] 안드로이드 호환성 설정 - AndroidManifest.xml | 푸딩뱃살 | 1561 | 2016.01.10 16:29 |
103 | [소셜] 구글 개발자 콘솔 요약 | 푸딩뱃살 | 2075 | 2016.01.08 15:49 |
102 | [유니티] Rich Text (리치 텍스트) | 푸딩뱃살 | 3032 | 2016.01.07 11:32 |
101 | [스트립트] 전처리기 | 푸딩뱃살 | 3839 | 2016.01.05 11:36 |
100 | [소셜] 안드로이드 inApp(인앱) 처리 | 푸딩뱃살 | 1422 | 2016.01.05 11:30 |
99 | [소셜] Push (문자 알림 서비스) | 푸딩뱃살 | 1821 | 2016.01.04 11:50 |
98 | [소셜] 안드로이드 inApp(인앱) 등록 | 푸딩뱃살 | 1582 | 2016.01.04 10:46 |
97 | [유니티] Asset Bundle (애셋 번들) | 푸딩뱃살 | 4697 | 2015.12.30 11:53 |
96 | [소셜] AdMob 광고 연동 | 푸딩뱃살 | 1669 | 2015.12.30 01:19 |
>> | [소셜] Google Play Games 리더보드 | 푸딩뱃살 | 2545 | 2015.12.29 16:00 |
94 | [소셜] 유니티 구글 게임 서비스 연동 | 푸딩뱃살 | 2298 | 2015.12.29 10:59 |
93 | [소셜] 구글 플레이 서비스 (Google Play Service) | 푸딩뱃살 | 2386 | 2015.12.28 10:16 |
92 | [소셜] UnityAds 유니티 광고(Unity Advertisement) 연동 | 푸딩뱃살 | 2809 | 2015.12.24 12:09 |
91 | [유니티] 안드로이드 빌드 | 푸딩뱃살 | 5917 | 2015.12.21 10:41 |
90 | [스트립트] 프레임 함수-유니티가 시작되면서 호출되는 기본적인 함수 | 푸딩뱃살 | 4517 | 2015.12.14 00:22 |
89 | [유니티] Trail Renderer (트레일 렌더러) | 푸딩뱃살 | 2785 | 2015.12.11 17:25 |
88 | [유니티] Character Controller (캐릭터 컨트롤러) | 푸딩뱃살 | 3130 | 2015.12.10 14:18 |
87 | [유니티] Materials (매터리얼) 예제 | 푸딩뱃살 | 2375 | 2015.12.09 12:17 |
86 | [유니티] Light (라이트) | 푸딩뱃살 | 2966 | 2015.12.09 10:52 |
85 | [유니티] Physics.Linecast() / Physics.Raycast() | 푸딩뱃살 | 3985 | 2015.12.08 12:56 |