Combu  3.2.2
Unity API Documentation
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
Combu.User Class Reference

User class implementing the Unity built-in Social interfaces (specialized IUserProfile, ILocalUser). More...

Inheritance diagram for Combu.User:
Combu.Profile

Public Member Functions

 User (bool authenticated)
 
 User (string jsonString)
 
 User (Hashtable hash)
 
virtual void FromUser (User source)
 Sets the data from another user object. More...
 
virtual void Authenticate (Action< bool > callback)
 Authenticate the user. More...
 
virtual void Authenticate (Action< bool, string > callback)
 Authenticate the user. More...
 
virtual void Authenticate (string password, Action< bool, string > callback)
 Authenticate the user with the specified password. More...
 
virtual void CreateGuest (Action< bool, string > callback)
 Creates a guest account. More...
 
virtual void LoadFriends (Action< bool > callback)
 Loads the friends of the current logged user. More...
 
virtual void LoadFriends (eContactType contactType, Action< bool > callback)
 Loads the friends of the current logged user. More...
 
virtual void LoadFriends< T > (eContactType contactType, Action< bool > callback)
 Loads the friends of the current logged user. More...
 
virtual void Update (Action< bool, string > callback, bool requestUpdateFromServer=true, bool requestReplaceCustomData=false, bool requestReplaceAppCustomData=false)
 Update or Create this user to server, whether id is positive and greater than zero. More...
 
virtual void Delete (Action< bool, string > callback)
 Delete this instance from the server. More...
 
void Load (Action< bool > callback)
 Load of the current user from server. More...
 
virtual void ResetPassword (Action< bool, string > callback)
 Resets the password of this user. More...
 
virtual void ChangePassword (string newPassword, Action< bool, string > callback)
 Changes the password of this user. More...
 
virtual void AuthenticatePlatform (string platformKey, string platformId, Action< bool, string > callback)
 Authenticates the user from an external platform (like Facebook, Game Center, GooglePlay etc). Note you are the only responsible for the external authentication, Combu only stores the info that you send. More...
 
virtual void AuthenticatePlatform< T > (string platformKey, string platformId, Action< bool, string > callback)
 
virtual void LinkAccount (string username, string password, Action< bool, string > callback)
 Links the currently logged account to another: all the platforms Ids of the current user will be transferred to the new account and the current account will be deleted. More...
 
virtual void LinkPlatform (string platformKey, string platformId, Action< bool, string > callback)
 Links a new platform Id to the logged account. More...
 
void GetContact (string idOrUsername, Action< bool, string, eContactType?, User > callback)
 Gets the contact information with loggedAccount if there's a pending request or is in the friends/ignored lists. If there's no relation found then the callback will return a failure. More...
 
void GetContact< T > (string idOrUsername, Action< bool, string, eContactType?, User > callback)
 Gets the contact information with loggedAccount if there's a pending request or is in the friends/ignored lists. If there's no relation found then the callback will return a failure. More...
 
void AddContact (string otherUsername, eContactType contactType, Action< bool, string > callback)
 Adds the contact. More...
 
void AddContact (long otherId, eContactType contactType, Action< bool, string > callback)
 Adds the contact. More...
 
void AddContact (Profile otherUser, eContactType contactType, Action< bool, string > callback)
 Adds the contact. More...
 
void RemoveContact (string otherUsername, Action< bool, string > callback)
 Removes the contact. More...
 
void RemoveContact (long otherId, Action< bool, string > callback)
 Removes the contact. More...
 
void RemoveContact (Profile otherUser, Action< bool, string > callback)
 Removes the contact. More...
 
- Public Member Functions inherited from Combu.Profile
 Profile (string jsonString)
 Initializes a new instance of the CBUser class from a JSON formatted string. More...
 
 Profile (Hashtable hash)
 Initializes a new instance of the CBUser class from a Hashtable. More...
 
virtual void FromJson (string jsonString)
 Initialize the object from a JSON formatted string. More...
 
virtual void FromHashtable (Hashtable hash)
 Initialize the object from a hashtable. More...
 

Static Public Member Functions

static bool CanAutoLogin (out string username, out string password)
 Determines if can auto-login and output the stored username and password. More...
 
static void AutoLogin (Action< bool, string > callback)
 Automatically logins with the credentials stored in PlayerPrefs. More...
 
static void AutoLogin< T > (Action< bool, string > callback)
 
static void ResendActivationCode (string usernameEmailOrId, Action< bool, string > callback)
 Resends the activation code by email. More...
 
static void Delete (string username, string password, Action< bool, string > callback)
 Delete a user from the server. More...
 
static void Load (User[] updateUsers, Action< bool > callback)
 Reload the specified users from server (by Id). More...
 
static void Load (long userId, Action< User > callback)
 Loads a user by Id. More...
 
static void Load (string userName, Action< User > callback)
 Loads a user by userName. More...
 
static void Load (long[] userIds, Action< User[]> callback)
 Loads the users by Id. More...
 
static void Load (string[] userNames, Action< User[]> callback)
 Loads the users by userName. More...
 
static void Load< T > (string username, string email, SearchCustomData[] customData, bool isOnline, int pageNumber, int limit, Action< T[], int, int > callback)
 Loads the users by searching for the specified parameters. More...
 
static void Random< T > (SearchCustomData[] customData, int count, Action< T[]> callback)
 Loads a specified count of random users. More...
 
static void Exists (string username, string email, Action< bool, string > callback)
 Verify if it exists an account with the specified username and email. More...
 
static void ResetPassword (long idUser, Action< bool, string > callback)
 Resets the password of a user by Id Account. More...
 
static void ResetPassword (string username, Action< bool, string > callback)
 Resets the password of a user by Username. More...
 
static void ChangePassword (long idUser, string username, string resetCode, string newPassword, Action< bool, string > callback)
 Changes the password of a user. More...
 
static void LoadPlatform (IEnumerable< string > platformKeys, IEnumerable< string > platformIds, Action< User[]> callback)
 
static void LoadPlatform< T > (IEnumerable< string > platformKeys, IEnumerable< string > platformIds, Action< T[]> callback)
 

Public Attributes

string password
 
- Public Attributes inherited from Combu.Profile
string email
 The email address. More...
 
Hashtable customData = new Hashtable()
 The global custom data shared between apps. More...
 
Hashtable appCustomData = new Hashtable()
 The custom data for the current app scope. More...
 

Protected Member Functions

virtual void StoreUserCredentials (string storeUserName, string storePassword)
 Stores the user credentials. More...
 

Properties

IUserProfile[] friends [get]
 
IUserProfile[] ignored [get]
 
IUserProfile[] requests [get]
 
IUserProfile[] pendingRequests [get]
 
bool authenticated [get]
 
virtual bool underage [get]
 
- Properties inherited from Combu.Profile
List< ProfilePlatformplatforms [get]
 
string id [get]
 Gets the identifier value as string. More...
 
long idLong [get]
 Gets the identifier value as long. id is just a ToString() of idLong, since Ids are stored as long in the database. More...
 
string userName [get, set]
 Gets or sets the name of the user. More...
 
bool isFriend [get]
 Gets a value indicating whether this Combu.Profile is a friend of the local user. More...
 
virtual UserState state [get]
 Gets the online state. More...
 
Texture2D image [get, set]
 Gets or sets the image. More...
 
string sessionToken [get]
 Gets the session token. More...
 
System.? DateTime lastSeen [get]
 Gets the last seen date/time. More...
 

Additional Inherited Members

- Protected Attributes inherited from Combu.Profile
long _id = 0
 
string _userName = ""
 
Texture2D _image
 
string _sessionToken = ""
 
System.? DateTime _lastSeen
 

Detailed Description

User class implementing the Unity built-in Social interfaces (specialized IUserProfile, ILocalUser).

Member Function Documentation

◆ AddContact() [1/3]

void Combu.User.AddContact ( long  otherId,
eContactType  contactType,
Action< bool, string >  callback 
)

Adds the contact.

Parameters
otherIdOther identifier.
contactTypeContact type.
callbackCallback.

◆ AddContact() [2/3]

void Combu.User.AddContact ( Profile  otherUser,
eContactType  contactType,
Action< bool, string >  callback 
)

Adds the contact.

Parameters
otherUserOther user.
contactTypeContact type.
callbackCallback.

◆ AddContact() [3/3]

void Combu.User.AddContact ( string  otherUsername,
eContactType  contactType,
Action< bool, string >  callback 
)

Adds the contact.

Parameters
otherUsernameOther username.
contactTypeContact type.
callbackCallback.

◆ Authenticate() [1/3]

virtual void Combu.User.Authenticate ( Action< bool >  callback)
virtual

Authenticate the user.

Parameters
callbackCallback.

◆ Authenticate() [2/3]

virtual void Combu.User.Authenticate ( Action< bool, string >  callback)
virtual

Authenticate the user.

Parameters
callbackCallback.

◆ Authenticate() [3/3]

virtual void Combu.User.Authenticate ( string  password,
Action< bool, string >  callback 
)
virtual

Authenticate the user with the specified password.

Parameters
passwordPassword.
callbackCallback.
Template Parameters
TType for User.

◆ AuthenticatePlatform()

virtual void Combu.User.AuthenticatePlatform ( string  platformKey,
string  platformId,
Action< bool, string >  callback 
)
virtual

Authenticates the user from an external platform (like Facebook, Game Center, GooglePlay etc). Note you are the only responsible for the external authentication, Combu only stores the info that you send.

Parameters
platformKeyPlatform key.
platformIdPlatform identifier.
callbackCallback.

◆ AutoLogin()

static void Combu.User.AutoLogin ( Action< bool, string >  callback)
static

Automatically logins with the credentials stored in PlayerPrefs.

Parameters
callbackCallback.

◆ CanAutoLogin()

static bool Combu.User.CanAutoLogin ( out string  username,
out string  password 
)
static

Determines if can auto-login and output the stored username and password.

Returns
true if can auto-login; otherwise, false.
Parameters
usernameUsername stored.
passwordPassword stored.

◆ ChangePassword() [1/2]

static void Combu.User.ChangePassword ( long  idUser,
string  username,
string  resetCode,
string  newPassword,
Action< bool, string >  callback 
)
static

Changes the password of a user.

Parameters
idUserIdentifier user.
usernameUsername.
resetCodeReset code.
newPasswordNew password.
callbackCallback.

◆ ChangePassword() [2/2]

virtual void Combu.User.ChangePassword ( string  newPassword,
Action< bool, string >  callback 
)
virtual

Changes the password of this user.

Parameters
newPasswordNew password.
callbackCallback.

◆ CreateGuest()

virtual void Combu.User.CreateGuest ( Action< bool, string >  callback)
virtual

Creates a guest account.

Parameters
callbackCallback.

◆ Delete() [1/2]

virtual void Combu.User.Delete ( Action< bool, string >  callback)
virtual

Delete this instance from the server.

Parameters
callbackCallback.

◆ Delete() [2/2]

static void Combu.User.Delete ( string  username,
string  password,
Action< bool, string >  callback 
)
static

Delete a user from the server.

Parameters
usernameUsername.
passwordPassword.
callbackCallback.

◆ Exists()

static void Combu.User.Exists ( string  username,
string  email,
Action< bool, string >  callback 
)
static

Verify if it exists an account with the specified username and email.

Parameters
usernameUsername.
emailEmail.
callbackCallback.

◆ FromUser()

virtual void Combu.User.FromUser ( User  source)
virtual

Sets the data from another user object.

Parameters
sourceSource.

◆ GetContact()

void Combu.User.GetContact ( string  idOrUsername,
Action< bool, string, eContactType?, User callback 
)

Gets the contact information with loggedAccount if there's a pending request or is in the friends/ignored lists. If there's no relation found then the callback will return a failure.

Parameters
idOrUsernameUser id or username.
callbackCallback.

◆ GetContact< T >()

void Combu.User.GetContact< T > ( string  idOrUsername,
Action< bool, string, eContactType?, User callback 
)

Gets the contact information with loggedAccount if there's a pending request or is in the friends/ignored lists. If there's no relation found then the callback will return a failure.

Parameters
idOrUsernameUser id or username.
callbackCallback.
Type Constraints
T :User 
T :new() 

◆ LinkAccount()

virtual void Combu.User.LinkAccount ( string  username,
string  password,
Action< bool, string >  callback 
)
virtual

Links the currently logged account to another: all the platforms Ids of the current user will be transferred to the new account and the current account will be deleted.

Parameters
usernameUsername.
passwordPassword.
callbackCallback.

◆ LinkPlatform()

virtual void Combu.User.LinkPlatform ( string  platformKey,
string  platformId,
Action< bool, string >  callback 
)
virtual

Links a new platform Id to the logged account.

Parameters
platformKeyPlatform key.
platformIdPlatform identifier.
callbackCallback.

◆ Load() [1/6]

void Combu.User.Load ( Action< bool >  callback)

Load of the current user from server.

Parameters
callbackCallback.

◆ Load() [2/6]

static void Combu.User.Load ( long  userId,
Action< User callback 
)
static

Loads a user by Id.

Parameters
userIdUser Id.
callbackCallback.

◆ Load() [3/6]

static void Combu.User.Load ( long[]  userIds,
Action< User[]>  callback 
)
static

Loads the users by Id.

Parameters
userIdsUser Ids.
callbackCallback.
updateUserIf passed its data will be replaced with the server result.

◆ Load() [4/6]

static void Combu.User.Load ( string  userName,
Action< User callback 
)
static

Loads a user by userName.

Parameters
userNameUser Name.
callbackCallback.

◆ Load() [5/6]

static void Combu.User.Load ( string[]  userNames,
Action< User[]>  callback 
)
static

Loads the users by userName.

Parameters
userNamesUser Names.
callbackCallback.

◆ Load() [6/6]

static void Combu.User.Load ( User[]  updateUsers,
Action< bool >  callback 
)
static

Reload the specified users from server (by Id).

Parameters
updateUsersList of users.
callbackCallback.

◆ Load< T >()

static void Combu.User.Load< T > ( string  username,
string  email,
SearchCustomData[]  customData,
bool  isOnline,
int  pageNumber,
int  limit,
Action< T[], int, int >  callback 
)
static

Loads the users by searching for the specified parameters.

Parameters
usernameUsername.
emailEmail.
customDataCustom data.
pageNumberPage number.
limitLimit.
callbackCallback.
Type Constraints
T :User 
T :new() 

◆ LoadFriends() [1/2]

virtual void Combu.User.LoadFriends ( Action< bool >  callback)
virtual

Loads the friends of the current logged user.

Parameters
callbackCallback.

◆ LoadFriends() [2/2]

virtual void Combu.User.LoadFriends ( eContactType  contactType,
Action< bool >  callback 
)
virtual

Loads the friends of the current logged user.

Parameters
contactTypeContact type.
callbackCallback.

◆ LoadFriends< T >()

virtual void Combu.User.LoadFriends< T > ( eContactType  contactType,
Action< bool >  callback 
)
virtual

Loads the friends of the current logged user.

Parameters
contactTypeContact type.
callbackCallback.
Template Parameters
TType for User.
Type Constraints
T :User 
T :new() 

◆ Random< T >()

static void Combu.User.Random< T > ( SearchCustomData[]  customData,
int  count,
Action< T[]>  callback 
)
static

Loads a specified count of random users.

Parameters
customDataCustom data.
countCount.
callbackCallback.
Type Constraints
T :User 
T :new() 

◆ RemoveContact() [1/3]

void Combu.User.RemoveContact ( long  otherId,
Action< bool, string >  callback 
)

Removes the contact.

Parameters
otherIdOther identifier.
callbackCallback.

◆ RemoveContact() [2/3]

void Combu.User.RemoveContact ( Profile  otherUser,
Action< bool, string >  callback 
)

Removes the contact.

Parameters
otherUserOther user.
callbackCallback.

◆ RemoveContact() [3/3]

void Combu.User.RemoveContact ( string  otherUsername,
Action< bool, string >  callback 
)

Removes the contact.

Parameters
otherUsernameOther username.
callbackCallback.

◆ ResendActivationCode()

static void Combu.User.ResendActivationCode ( string  usernameEmailOrId,
Action< bool, string >  callback 
)
static

Resends the activation code by email.

Parameters
usernameEmailOrIdUsername, e-mail or identifier.
callbackCallback.

◆ ResetPassword() [1/3]

virtual void Combu.User.ResetPassword ( Action< bool, string >  callback)
virtual

Resets the password of this user.

Parameters
callbackCallback.

◆ ResetPassword() [2/3]

static void Combu.User.ResetPassword ( long  idUser,
Action< bool, string >  callback 
)
static

Resets the password of a user by Id Account.

Parameters
idUserIdentifier user.
callbackCallback.

◆ ResetPassword() [3/3]

static void Combu.User.ResetPassword ( string  username,
Action< bool, string >  callback 
)
static

Resets the password of a user by Username.

Parameters
usernameUsername.
callbackCallback.

◆ StoreUserCredentials()

virtual void Combu.User.StoreUserCredentials ( string  storeUserName,
string  storePassword 
)
protectedvirtual

Stores the user credentials.

Parameters
storeUserNameUser name.
storePasswordPassword.

◆ Update()

virtual void Combu.User.Update ( Action< bool, string >  callback,
bool  requestUpdateFromServer = true,
bool  requestReplaceCustomData = false,
bool  requestReplaceAppCustomData = false 
)
virtual

Update or Create this user to server, whether id is positive and greater than zero.

Parameters
callbackCallback.