회원 로그인
정보기억 정보기억에 체크할 경우 다음접속시 아이디와 패스워드를 입력하지 않으셔도 됩니다.
그러나, 개인PC가 아닐 경우 타인이 로그인할 수 있습니다.
PC를 여러사람이 사용하는 공공장소에서는 체크하지 마세요.
소셜네트워크 서비스를 통해서 로그인하시면 별도의 로그인 절차없이 회원서비스를 이용하실 수 있습니다.


최근 게시물

1.노션에서 작성 중

1.노션에서 작성 중

개편하기 전까지 노션에서 작성 중

2024.04.04//read more

2.ChatGPT

2.ChatGPT

OpenAI로 대규모 언어 모델대화형...

2023.03.16//read more

3.노코딩 게임 엔진 - 빌..

3.노코딩 게임 엔진 - 빌..

빌드 지원안드로이드iOS윈도우즈특이사...

2023.03.14//read more

4.(완료) 미접속 회원 정..

4.(완료) 미접속 회원 정..

[완료] 36명의 회원을 정리하였습니...

2023.02.16//read more

5.매뉴얼 플러스 - 전자제..



안정적인 DNS 서비스 DNSEver
DNS Powered by DNSEver.com


Google Play Games 리더보드

푸딩뱃살 | 2015.12.29 16:00 | 조회 2560
Google Play Games 리더보드
:최고 점수 등록

- 스크립트
:로그인, 로그아웃, 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");
    }
}
-확인
-블루스택 확인



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