회원 로그인
|
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개(1/8페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
유니티 강좌 모음(영문) | 푸딩뱃살 | 61019 | 2013.08.28 12:02 | |
유니티 경고, 에러 모음 (재정리 예정) [1+1] | 푸딩뱃살 | 71982 | 2013.08.12 00:09 | |
144 | [콘솔] 오류 : ~ multicast group | 푸딩뱃살 | 1071 | 2019.09.04 00:23 |
143 | [콘솔] 오류 : NullReferenceException | 푸딩뱃살 | 1091 | 2019.07.23 00:26 |
142 | [유니티] Unite Seoul 2019 다시보기 | 푸딩뱃살 | 1259 | 2019.06.28 10:00 |
141 | [정보] GDC 2019 유니티 키노트 하이라이트 | 푸딩뱃살 | 1363 | 2019.03.26 10:45 |
140 | [유니티] Unite Seoul 2018 아젠다 & 세션 다시보기 | 푸딩뱃살 | 2745 | 2018.05.25 10:32 |
139 | [VR/AR] Stereo 360 Image and Video Capture | 푸딩뱃살 | 2048 | 2018.02.02 10:53 |
138 | [VR/AR] ARKit - Face Tracking | 푸딩뱃살 | 1786 | 2018.01.17 16:57 |
137 | [참고] ADAM :Making 참고 | 푸딩뱃살 | 2038 | 2017.12.04 11:14 |
136 | [정보] ARKit Face Tracking on iPhone X | 푸딩뱃살 | 3143 | 2017.11.08 09:59 |
135 | [VR/AR] Vive Full Body Tracking Demo | 푸딩뱃살 | 2147 | 2017.10.31 18:54 |
134 | [애셋] 유니티 모델링 - UModeler | 푸딩뱃살 | 2194 | 2017.10.20 14:02 |
133 | [유니티] 맥에서 안드로이드/자바 SDK 경로 | 푸딩뱃살 | 3305 | 2017.10.04 23:58 |
132 | [콘솔] 오류 : Fatal Error! The project is on case sensitive file | 푸딩뱃살 | 2764 | 2017.10.01 19:59 |
131 | [참고] Adam (Made with Unity) | 푸딩뱃살 | 2495 | 2017.10.01 18:33 |
130 | [정보] 보안 패치 | 푸딩뱃살 | 1928 | 2017.08.21 15:59 |
129 | [콘솔] 오류: Failed to load '.dll', ...... | 푸딩뱃살 | 2077 | 2017.08.20 00:57 |
128 | [콘솔] 오류: [VRDevice] Initialization of device oculus failed. | 푸딩뱃살 | 1937 | 2017.08.19 03:05 |
127 | [콘솔] 오류: MissingComponentException | 푸딩뱃살 | 2975 | 2017.08.19 02:05 |
126 | [콘솔] 오류: Android Manifests | 푸딩뱃살 | 2745 | 2017.08.18 03:01 |
125 | [VR/AR] Google VR SDK for Unity | 푸딩뱃살 | 3569 | 2017.08.18 00:10 |