Skip to content

QUDOUser

Class in QUDOSDK

Properties

The user's account name
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//The currently logged in user
QUDOUser currentUser;

void PrintAccountName()
{
    if(currentUser != null)
    {
        //Prints the account name on the console
        Debug.Log(currentUser.AccountName);
    }
}
The list of unlocked achievements from this user
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
//The currently logged in user
QUDOUser currentUser;

void PrintAchievementsUnlocked()
{
    if(currentUser != null)
    {
        //Prints all the achievements unlocked from this user on the console
        foreach (var achievementUnlocked in currentUser.AchievementsUnlocked)
        {
            Debug.Log(achievementUnlocked.Name);
        }
    }
}
Wallet balance from this user
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//The currently logged in user
QUDOUser currentUser;

void PrintUserBalance()
{
    if(currentUser != null)
    {
        //Prints the balance of this user on the console
        Debug.Log($"{currentUser.Username} has {currentUser.Balance} QUDO!");
    }
}
The user's display name
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//The currently logged in user
QUDOUser currentUser;

void PrintUserDisplayName()
{
    if(currentUser != null)
    {
        //Prints the user's display name to the console
        Debug.Log($"{currentUser.DisplayName}");
    }
}
Does this user have a display name?
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// The currently logged in user
QUDOUser currentUser;

void DoesUserHaveDisplayName()
{
    if(currentUser != null)
    {
        // Prints to the console the 'HasDisplayName' value
        Debug.Log($"Has display name? {currentUser.HasDisplayName}");
    }
}
The list of highscores from this user
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
//The currently logged in user
QUDOUser currentUser;

void PrintUserHighscores()
{
    if(currentUser != null)
    {
        //Prints all the highscores from this user on the console
        foreach (var highscoreUnlocked in currentUser.Highscores)
        {
            Debug.Log(highscoreUnlocked.Name);
        }
    }
}
Is the user running on offline mode?
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
//The currently logged in user
QUDOUser currentUser;

void CheckIfUserIsOffline()
{
    if(currentUser != null)
    {
        //Print to the console if the user is offline or not
        if(currentUser.IsOffline)
        {
            Debug.Log("User is offline!");
        }
        else
        {
            Debug.Log("User is online!");
        }
    }
}
The list of increases from this user
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
//The currently logged in user
QUDOUser currentUser;

void PrintNetworkRewardHistory()
{
    if(currentUser != null)
    {
        //Prints the block time of all the network reward histories
        foreach (var networkRewardHistory in currentUser.NetworkRewardHistory)
        {
            Debug.Log(networkRewardHistory.BlockTime);
        }
    }
}
The pending reward that the user can grab
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//The currently logged in user
QUDOUser currentUser;

void PrintPendingReward()
{
    if(currentUser != null)
    {
        //Prints the pending reward from this user on the console
        Debug.Log(currentUser.PendingReward);
    }
}
The list of products that this user currently owns
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
//The currently logged in user
QUDOUser currentUser;

void PrintUserProducts()
{
    if(currentUser != null)
    {
        foreach(product in currentUser.Products)
        {
            Debug.Log(product.Name);
        }
    }
}
Get the user's profile image
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
//The currently logged in user
QUDOUser currentUser;

//The image component that will display this user's profile image
Image profileImage;

void DisplayUserProfileImage()
{
    if(currentUser != null)
    {
        //Set the 'profileImage' sprite to the user's profile image
        profileImage.sprite = currentUser.ProfileImage;
    }
}
Get the user's QRCode image
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
//The currently logged in user
QUDOUser currentUser;

//The image component that will display this user's QRCode image
Image qrCodeImage;

void DisplayUserQrCode()
{
    if(currentUser != null)
    {
        //Set the 'qrCodeImage' sprite to the user's QRCode image
        qrCodeImage.sprite = currentUser.QRCode;
    }
}
The Balance in a formated string
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//The currently logged in user
QUDOUser currentUser;

void PrintUserStrBalance()
{
    if(currentUser != null)
    {
        //Prints the formated string for the balance
        Debug.Log(currentUser.StrBalance);
    }
}
The Pending Reward in a formated string
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//The currently logged in user
QUDOUser currentUser;

void PrintUserStrPendingReward()
{
    if(currentUser != null)
    {
        //Prints the formated string for the pending reward
        Debug.Log(currentUser.StrPendingReward);
    }
}
The transaction history from this user
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
//The currently logged in user
QUDOUser currentUser;

void PrintUserTransactionHistory()
{
    if(currentUser != null)
    {
        //Print all transaction done to this user
        foreach (var transaction in currentUser.TransactionHistory)
        {
            Debug.Log($"from: {transaction.From} to: {transaction.To} quantity: {transaction.Quantity}");
        }
    }
}
The user's username
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//The currently logged in user
QUDOUser currentUser;

void PrintUserUsername()
{
    if(currentUser != null)
    {
        //Prints the user's username on the console
        Debug.Log(currentUser.Username);
    }
}

Methods

This function is used for in-app purchases, all products need to be registered on the QUDO dashboard
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//The currently logged in user
QUDOUser currentUser;

string productAlias = "myProduct";

void UserBuyProduct()
{
    if(currentUser != null)
    {
        //Tries to buy a product with a specific product alias
        currentUser.BuyProduct(productAlias, (bool successfull) =>
        {
            if (successfull)
            {
                Debug.Log("Payment was successfull!");
            }
            else
            {
                Debug.Log("Payment was not successfull!");
            }
        });
    }
}
Check the value of a certain highscore alias
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
//The currently logged in user
QUDOUser currentUser;

string highscoreAlias = "myHighscore";

void PrintHighscoreValue()
{
    if(currentUser != null)
    {
        //Print the value of the highscore given by the alias
        Debug.Log(currentUser.CheckHighscore(highscoreAlias));
    }
}
Reward the player with an achievement
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
//The currently logged in user
QUDOUser currentUser;

//The alias of the achievement you wish to give the player
string achievementAlias = "myAchievement";

void GiveUserAchievement()
{
    //Give the current user an achievement
    currentUser.GiveAchievement(achievementAlias, (bool successfull, float qudoReceived) =>
    {
        if (successfull)
        {
            Debug.Log("Achieved! and received: " + qudoReceived);
        }
        else
        {
            Debug.Log("Couldn't give the achievement to the player!");
        }
    });
}
Check if the user has a specific achievement from the current game
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
//The currently logged in user
QUDOUser currentUser;

//Achievement alias to search for
string achievementAlias = "myAchievement";

void DoesUserHaveAchievement()
{
    if(currentUser != null)
    {
        //Check if the user as the specified achievement through it's alias
        if(currentUser.HasAchievement(achievementAlias))
        {
            Debug.Log("User has this achievement!");
        }
        else
        {
            Debug.Log("User doesn't have achievement!");
        }
    }
}
Execute a logout to the current logged in user
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//The currently logged in user
QUDOUser currentUser;

void LogoutQUDOUser()
{
    //Try to logout the user
    currentUser.Logout((bool successfull) =>
    {
        if (successfull)
        {
            Debug.Log("Logged out!");
        }
        else
        {
            /*
            *The logout communication with the server can fail,
            *however the session will be cleared anyways from this game
            */
            Debug.LogError("There was some problems when loggin out!");
        }
        //Also make sure to set your user variable to null
        currentUser = null;
    });
}
Opens this user's history page
Example
1
2
3
4
5
6
7
8
//The currently logged in user
QUDOUser currentUser;

void OpenQUDOUserHistory()
{
    //Open the user's history UI
    currentUser.OpenHistory();
}
Opens this user's profile page
Example
1
2
3
4
5
6
7
8
//The currently logged in user
QUDOUser currentUser;

void OpenQUDOUserProfile()
{
    //Open the user's profile UI
    currentUser.OpenProfile();
}
Opens this user's wallet page
Example
1
2
3
4
5
6
7
8
//The currently logged in user
QUDOUser currentUser;

void OpenQUDOUserWallet()
{
    //Open the user's wallet UI
    currentUser.OpenWallet();
}
Tries to get an achievement from the player's data with a certain alias
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
//The currently logged in user
QUDOUser currentUser;

//The achievement alias
string achievementAlias = "myAchievement";

void RetrieveQUDOAchievement()
{
    //Try to get the achievement with the following alias
    AchievementData achievement = currentUser.RetrieveAchievement(achievementAlias);

    /*
    *Since AchievementData is a struct we need to check if
    *the value returned is not the default
    */
    if(!achievement.Equals(default(AchievementData)))
    {
        Debug.Log(achievement.Name);
    }

}
Tries to get an highscore from the player's data with a certain alias
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
//The currently logged in user
QUDOUser currentUser;

//The highscore alias
string highscoreAlias = "myHighscore";

void RetrieveQUDOHighscore()
{
    //Try to get the highscire with the following alias
    HighscoreData highscore = currentUser.RetrieveHighscore(highscoreAlias);

    /*
    *Since HighscoreData is a struct we need to check if
    *the value returned is not the default
    */
    if(!highscore.Equals(default(HighscoreData)))
    {
        Debug.Log(highscore.Name);
    }
}
This function is used as a general purpose QUDO send command, with it you can request the user to send QUDO to someone else
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

//The account name of the receiver
string to = "testdev012";
//The quantity of qudo to pay
float quantity = 0.5f;
//The memo to include on the transfer
string memo = "A QUDO transfer";


void UserSendQUDO()
{
    //Try to make this user pay for the following quantity to a certain account name
    currentUser.SendQUDO(to, quantity, memo, (bool successfull) =>
    {
        if (successfull)
        {
            Debug.Log("Payment done!");
        }
        else
        {
            Debug.Log("Couldn't pay!");
        }
    });
}
Submit an highscore for this player
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//The currently logged in user
QUDOUser currentUser;

//The highscore alias to submit
string highscoreAlias = "myHighscore";
//The score to submit on the highscore
float score = 100;

void SubmitUserHighscore()
{
    //Try to submit the following highscore
    currentUser.SubmitHighscore(highscoreAlias, score, (bool successfull) =>
    {
        if (successfull)
        {
            Debug.Log("Highscore submited!");
        }
        else
        {
            Debug.LogError("Couldn't submit the highscore!");
        }
    });
}

Static Events

Event executed when any user logs in
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
void OnEnable()
{
    //Subscribe to the event
    QUDOUser.OnAnyUserLoggedIn += QUDOUser_OnAnyUserLoggedIn;
}

void OnDisable()
{
    //Make sure you always unsubscribe to the events
    QUDOUser.OnAnyUserLoggedIn -= QUDOUser_OnAnyUserLoggedIn;
}

void QUDOUser_OnAnyUserLoggedIn(QUDOUser user)
{
    if(user != null)
    {
        Debug.Log($"{user.Username} has logged in!");
    }
}
Event executed when any user logs out
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
void OnEnable()
{
    //Subscribe to the event
    QUDOUser.OnAnyUserLoggedOut += QUDOUser_OnAnyUserLoggedOut;
}

void OnDisable()
{
    //Make sure you always unsubscribe to the events
    QUDOUser.OnAnyUserLoggedOut -= QUDOUser_OnAnyUserLoggedOut;
}

void QUDOUser_OnAnyUserLoggedOut(QUDOUser user)
{
    if(user != null)
    {
        Debug.Log($"{user.Username} has logged out!");
    }
}

Events

Event triggered when the user receives an achievement
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnAchievementReceived += QUDOUser_OnAchievementReceived;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnAchievementReceived -= QUDOUser_OnAchievementReceived;
    }
}

void QUDOUser_OnAchievementReceived(AchievementList achievement)
{
    Debug.Log($"{achievement.Name} received!");
}
Event triggered when the user receives an highscore
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnHighscoreReceived += QUDOUser_OnHighscoreReceived;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnHighscoreReceived -= QUDOUser_OnHighscoreReceived;
    }
}

void QUDOUser_OnHighscoreReceived(HighscoreList highscore, float qudoAmount)
{
    Debug.Log($"{highscore.Name} submited! received: {qudoAmount} QUDO");
}
Event triggered when the user claims the pending reward
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnPendingRewardClaimed += QUDOUser_OnPendingRewardClaimed;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnPendingRewardClaimed -= QUDOUser_OnPendingRewardClaimed;
    }
}

void QUDOUser_OnPendingRewardClaimed()
{
    Debug.Log("Pending reward claimed!");
}
Event triggered when the user receives pending reward, this event will return the float value of the QUDO received
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnPendingRewardReceived += QUDOUser_OnPendingRewardReceived;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnPendingRewardReceived -= QUDOUser_OnPendingRewardReceived;
    }
}

void QUDOUser_OnPendingRewardReceived(float pendingRewardReceived)
{
    Debug.Log($"User received {pendingRewardReceived} QUDO from pending reward");
}
Event triggered when the user receives QUDO
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnQUDOReceived += QUDOUser_OnQUDOReceived;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnQUDOReceived -= QUDOUser_OnQUDOReceived;
    }
}

void QUDOUser_OnQUDOReceived(TransactionHistory transactionHistory)
{
    Debug.Log($"received {transactionHistory.Quantity} QUDO from {transactionHistory.From}");
}
Event triggered when the user is logged out
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnUserLogout += QUDOUser_OnUserLogout;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnUserLogout -= QUDOUser_OnUserLogout;
    }
}

void QUDOUser_OnUserLogout()
{
    //Make sure to set the current user to null
    currentUser = null;
}
Event triggered when the user losts the connection to the QUDO Server
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnUserLostConnection += QUDOUser_OnUserLostConnection;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnUserLostConnection -= QUDOUser_OnUserLostConnection;
    }
}

void QUDOUser_OnUserLostConnection()
{
    Debug.Log($"{currentUser} has lost connection!");
}
Event triggered when the user regains the connection to the QUDO Server
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnUserRegainedConnection += QUDOUser_OnUserRegainedConnection;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnUserRegainedConnection -= QUDOUser_OnUserRegainedConnection;
    }
}

void QUDOUser_OnUserRegainedConnection()
{
    Debug.Log($"{currentUser} has regained connection!");
}
Event triggered when the user expires
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnUserSessionExpired += QUDOUser_OnUserSessionExpired;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnUserSessionExpired -= QUDOUser_OnUserSessionExpired;
    }
}

void QUDOUser_OnUserSessionExpired()
{
    Debug.Log($"{currentUser} session has expired!");
}
Event triggered when the user is updated. Use this to update information of the user in your game
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//The currently logged in user
QUDOUser currentUser;

void OnEnable()
{
    if(currentUser != null)
    {
        //Subscribe to the event
        currentUser.OnUserUpdate += QUDOUser_OnUserUpdate;
    }

}

void OnDisable()
{
    if(currentUser != null)
    {
        //Make sure you always unsubscribe to the events
        currentUser.OnUserUpdate -= QUDOUser_OnUserUpdate;
    }
}

void QUDOUser_OnUserUpdate()
{
    Debug.Log($"{currentUser} updated!");
}