찾기
내용으로 건너뛰기
추적
문서의 이전 판을 선택했습니다!
저장하면 이 자료로 새 판을 만듭니다.
미디어 파일
======Social API====== Social API는 다음과 같은 Unity의 사회적 기능 점입니다: * 사용자 프로파일 * 친구 리스트(Friends lists) * 성취(Achievements) * 통계/지도자보드(Leaderboards) 이는 ''XBox Live'' 혹은 ''GameCenter''와 같은 다양한 사회적 배경(back-ends)에 대해 통합 인터페이스를 제공하고, 이는 주로 게임 프로젝트의 프로그래머의 사용을 위한 것 입니다. Social API는 기본적으로 비동기 API 이며, 이를 사용하는 일반적인 방법은 함수 호출을 수행하고 그 함수가 완료되면 콜백(callback)을 등록하는 것 입니다. 비동기적 함수는 API에서 일부 상태 변수를 채우는 등의 부작용이 있으며, 콜백은 서버가 처리해야 할 데이터를 포함할 수 있습니다. Social 클래스는 UnityEngine 네임공간(namespace)에 존재하고 그러므로 항상 사용할 수 있지만 다른 Social API는 자신만의 네임공간인 UnityEngine.SocialPlatforms 에 보관됩니다. 추가적으로, Social API의 구현은 SocialPlatforms.GameCenter과 같은 하위 네임공간에 있습니다. Social API 다음은 Social API을 사용하는 한 예제(JavaScript) 입니다: <file csharp> import UnityEngine.SocialPlatforms; function Start () { // Authenticate and register a ProcessAuthentication callback // This call needs to be made before we can proceed to other calls in the Social API Social.localUser.Authenticate (ProcessAuthentication); } // This function gets called when Authenticate completes // Note that if the operation is successful, Social.localUser will contain data from the server. function ProcessAuthentication (success: boolean) { if (success) { Debug.Log ("Authenticated, checking achievements"); // Request loaded achievements, and register a callback for processing them Social.LoadAchievements (ProcessLoadedAchievements); } else Debug.Log ("Failed to authenticate"); } // This function gets called when the LoadAchievement call completes function ProcessLoadedAchievements (achievements: IAchievement[]) { if (achievements.Length == 0) Debug.Log ("Error: no achievements found"); else Debug.Log ("Got " + achievements.Length + " achievements"); // You can also call into the functions like this Social.ReportProgress ("Achievement01", 100.0, function(result) { if (result) Debug.Log ("Successfully reported achievement progress"); else Debug.Log ("Failed to report achievement"); }); } </file> 다음은 C#을 사용한 예제입니다. <file csharp> using UnityEngine; using UnityEngine.SocialPlatforms; public class SocialExample : MonoBehaviour { void Start () { // Authenticate and register a ProcessAuthentication callback // This call needs to be made before we can proceed to other calls in the Social API Social.localUser.Authenticate (ProcessAuthentication); } // This function gets called when Authenticate completes // Note that if the operation is successful, Social.localUser will contain data from the server. void ProcessAuthentication (bool success) { if (success) { Debug.Log ("Authenticated, checking achievements"); // Request loaded achievements, and register a callback for processing them Social.LoadAchievements (ProcessLoadedAchievements); } else Debug.Log ("Failed to authenticate"); } // This function gets called when the LoadAchievement call completes void ProcessLoadedAchievements (IAchievement[] achievements) { if (achievements.Length == 0) Debug.Log ("Error: no achievements found"); else Debug.Log ("Got " + achievements.Length + " achievements"); // You can also call into the functions like this Social.ReportProgress ("Achievement01", 100.0, result => { if (result) Debug.Log ("Successfully reported achievement progress"); else Debug.Log ("Failed to report achievement"); }); } } </file> Social API에 대하여 더 상세한 정보를 보려면, [[ScriptRef:Social.html|Social API Scripting Reference]]을 확인합니다. {{tag>유니티 unity}} * 출처: [[http://unitykoreawiki.com/index.php?n=KrMain.net-SocialAPI|유니티코리아위키]] (CC BY-NC-SA 2.0)
2+1?
이 필드는 비어 있도록 유지하세요:
저장
미리 보기
취소
편집 요약
참고: 이 문서를 편집하면 내용은 다음 라이선스에 따라 배포하는 데 동의하는 것으로 간주합니다:
CC Attribution-Noncommercial-Share Alike 4.0 International
연결문서
유니티3D ( Unity3D )
Reference Manual
문서 도구
문서 보기
이전 판
연결문서
맨 위로
다크 모드로 보기
☀️
Toggle Menu
유니티3D ( Unity3D )
너두 고쳐두 됩니다.
사이트 도구
최근 바뀜
미디어 관리자
사이트맵
사용자 도구
등록
로긴
최근 수정된 문서
misuse_topical5
노박
unique_items
dinner_bell
deputy_beagle
ratslayer
one_for_my_baby
alerio
power_fist
제거됨
fixer
climb_ev_ry_mountain
companion
[장비 분실]
crashed_vertibird
brotherhood_t-51b_power_armor
marco
i_forgot_to_remember_to_forget
cateye