User Profile

Load User Profile

using System.Threading.Tasks;
using ReadyGamesNetwork.RGN;
using ReadyGamesNetwork.RGN.Model;
using ReadyGamesNetwork.RGN.Modules;
​
public async void LoadUserProfile()
{
//Loading user Profile in currentUserData
RGNGameUserFullProfileData currentUserData = await RGNCoreBuilder.I.GetModule<UserProfileModule<RGNGameUserFullProfileData>>().GetFullUserProfile(RGNCoreBuilder.I.masterAppUser.UserId);
​
//Checking if user uploaded avatar picture
if (!string.IsNullOrEmpty(currentUserData.avatarPath))
{
TaskCompletionSource<Texture2D> callbackAwaiter = new TaskCompletionSource<Texture2D>();
​
//Downloading avatar picture RGNCoreBuilder.I.GetModule<UserProfileModule<RGNGameUserFullProfileData>>().DownloadAvatar(currentUserData.userId, (avatar) =>
{
callbackAwaiter.SetResult(avatar);
});
​
//Setting up Texture2D in currentUserData for further use.
currentUserData.AvatarTexture = await callbackAwaiter.Task;
}
}

Update User Avatar Image

using ReadyGamesNetwork.RGN;
using ReadyGamesNetwork.RGN.Model;
using ReadyGamesNetwork.RGN.Modules;
using UnityEngine;
​
private void UpdateAvatar(Texture2D texture)
{
RGNCoreBuilder.I.GetModule<UserProfileModule<RGNGameUserFullProfileData>>().UploadAvatar(texture, (result) =>
{
//Handle Success.
});
}

Update UserName/Display Name

using ReadyGamesNetwork.RGN;
using ReadyGamesNetwork.RGN.Model;
using ReadyGamesNetwork.RGN.Modules;
​
private async void UpdateProfileAsync(string displayName)
{
await RGNCoreBuilder.I.GetModule<UserProfileModule<RGNGameUserFullProfileData>>().UpdateProfileAsync(displayName);
}
​

Retrieve User Currencies

using ReadyGamesNetwork.RGN;
using ReadyGamesNetwork.RGN.Model;
using ReadyGamesNetwork.RGN.Modules;
​
​
public async void GetUserCurrencies()
{
UserProfileModule<RGNGameUserFullProfileData> userProfileModule = RGNCoreBuilder.I.GetModule<UserProfileModule<RGNGameUserFullProfileData>>();
​
RGNUserCurrencyData userCurrencyData = await userProfileModule.GetUserCurrencies();
foreach (RGNCurrency currency in userCurrencyData.currencies)
{
Debug.Log(currency.name + currency.quantity);
}
}

rgn-coin Currency

It will similar to the other currency but it will be only purchasable using In App purchase. and can be consumed to buy a NFT or Non-NFT Virtual-Items.
See above screenshot to get more details. In order to buy rgn-coin follow details at 4. Purchase rgn-coin IAP
Copy link
On this page
Load User Profile
Update User Avatar Image
Update UserName/Display Name
Retrieve User Currencies
rgn-coin Currency