본문 바로가기
개발/Playfab

유니티 플레이팹 아이템 주기 Playfab Grant Item ToUser 간단 사용법

by SPNK 2022. 7. 20.
반응형

플레이팹 로그인이 되었다는 가정하에 진행

 

유니티 플레이팹 게스트 로그인 Playfab Sign In with Guest Login 간단 사용법

코드 작성 using PlayFab; using PlayFab.ClientModels; using PlayFab.Json; using PlayFab.ProfilesModels; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using EntityKey = PlayFab.ProfilesMod

parksh3641.tistory.com

 


코드 작성

using System;
using System.Collections.Generic;
using PlayFab;
using PlayFab.ClientModels;
using UnityEngine;

public class PlayfabManager : MonoBehaviour
{
    private void DisplayPlayfabError(PlayFabError error) => Debug.LogError("error : " + error.GenerateErrorReport());

    public void GrantItemToUser(string catalogversion, string playfabId, List<string> itemIds) //아이템 주기
    {
        PlayFab.ServerModels.GrantItemsToUserRequest request = new PlayFab.ServerModels.GrantItemsToUserRequest
        {
            CatalogVersion = catalogversion,
            PlayFabId = playfabId,
            ItemIds = itemIds
        };
        PlayFabServerAPI.GrantItemsToUser(request,
            result =>
            {
                Debug.Log("Give Item : " + request.ItemIds);
            }, DisplayPlayfabError);
    }
}

 


다른 기능 구현하기

 

유니티 플레이팹 아이템 구매 Playfab Shop Purchase Item 간단 사용법

플레이팹 로그인이 되었다는 가정하에 진행 유니티 플레이팹 게스트 로그인 Playfab Sign In with Guest Login 간단 사용법 코드 작성 using PlayFab; using PlayFab.ClientModels; using PlayFab.Json; using PlayFab.ProfilesModel

parksh3641.tistory.com

 

 

 

유니티 플레이팹 가상화폐 돈 증가 감소 간단 구현 Unity Playfab

기본 설정 public enum MoneyType { Gold, Crystal } public int gold = 0; public int crystal = 0; 돈 증가 public void UpdateAddCurrency(MoneyType moneyType, int number) { string currentType = ""; switch (moneyType) { case MoneyType.Gold: currentType =

parksh3641.tistory.com

 

반응형

댓글