CREATE YOUR WORLD
Social

유저 정보

4min
사용자 정보 검색 zepetoworldhelper getuserinfo 함수를 사용하여 사용자 정보를 검색할 수 있습니다 완료 시간, 오류 발생 시간 및 문자열 배열과 같은 userid에 포함된 콜백 함수가 인수로 전달됩니다 다음은 zepetoworldhelper getuserinfo 함수를 호출하는 예입니다 zepetoworldhelper getuserinfo(ids, (info users\[]) => { for (let i = 0; i < info length; i++) { console log(`userid ${info\[i] useroid}, name ${info\[i] name}, zepetoid ${info\[i] zepetoid}`); } }, (error) => { console log(error); }); 다음은 사용자 정보를 검색하기 위한 전체 예제 코드입니다 예제 코드를 사용할 때 "userid 1", "userid 2" 값을 실제 사용자 id 값으로 변경하십시오 import { zepetoscriptbehaviour } from 'zepeto script'; import { zepetoworldhelper, users } from 'zepeto world'; export default class userinfo extends zepetoscriptbehaviour { start() { let ids string\[] = \["userid 1", "userid 2"]; zepetoworldhelper getuserinfo(ids, (info users\[]) => { for (let i = 0; i < info length; i++) { console log(`userid ${info\[i] useroid}, name ${info\[i] name}, zepetoid ${info\[i] zepetoid}`); } }, (error) => { console log(error); }); } } 사용자 프로필 이미지 가져오기 zepetoworldhelper getprofiletexture 함수를 사용하여 사용자의 프로필 사진을 로드합니다 완료 시점부터 오류 발생 시점까지의 콜백 함수와 userid가 인수로 전달됩니다 다음은 zepetoworldhelper getprofiletexture 함수를 호출하는 예제 코드입니다 zepetoworldhelper getprofiletexture(this userid, (texture texture) => { this sampleimage sprite = this getsprite(texture); }, (error) => { console log(error); }); 다음은 사용자의 프로필 사진을 가져오는 예제 코드입니다 import { zepetoscriptbehaviour } from 'zepeto script'; import { zepetoworldhelper } from 'zepeto world'; import { texture,texture2d, sprite, rect, vector2 } from 'unityengine'; import { image } from 'unityengine ui'; export default class gettextureexample extends zepetoscriptbehaviour { public userid string; public sampleimage image; start() { zepetoworldhelper getprofiletexture(this userid, (texture texture) => { this sampleimage sprite = this getsprite(texture); }, (error) => { console log(error); }); } getsprite(texture texture) { let rect rect = new rect(0, 0, texture width, texture height); return sprite create(texture as texture2d, rect, new vector2(0 5, 0 5)); } }