회원 로그인
정보기억 정보기억에 체크할 경우 다음접속시 아이디와 패스워드를 입력하지 않으셔도 됩니다.
그러나, 개인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 | 조회 2544
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개(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