Forum BigDB Loading name using BigDB

Discussion and help relating to the PlayerIO database solution, BigDB.

Loading name using BigDB

Postby samsonadze » September 11th, 2012, 9:03 pm

How can i get User name with BigDB, i have quickconnect for Simple users, Any help?
C#
samsonadze
 
Posts: 122
Joined: August 29th, 2012, 2:39 pm

Re: Loading name using BigDB

Postby Henrik » September 11th, 2012, 9:29 pm

The easiest way is to read the connectuserid of the connection, for simpleusers it will be "simple" + username, so just remove "simple" from it and you've got the username.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Loading name using BigDB

Postby samsonadze » September 11th, 2012, 10:39 pm

Okay, but when i want to load his name when he will login what i shall do? :)
C#
samsonadze
 
Posts: 122
Joined: August 29th, 2012, 2:39 pm

Re: Loading name using BigDB

Postby dreamora » September 12th, 2012, 2:23 am

offer a corresponding input form upon first login and store its data into the PlayerObject and after future login, request it again from the PlayerObject of the player :)

The user has no name after the quickconnect or better there is not even a concept of a name aside of the login username which you can get through simply using the substring function to drop the first 6 letters (simple) of the connectuserid
dreamora
 
Posts: 225
Joined: March 2nd, 2012, 9:58 am

Re: Loading name using BigDB

Postby samsonadze » September 12th, 2012, 9:45 am

So what i shall script? client.BigDB.load(ConnectUserId)?
C#
samsonadze
 
Posts: 122
Joined: August 29th, 2012, 2:39 pm

Re: Loading name using BigDB

Postby dreamora » September 12th, 2012, 10:15 am

similar to that yes, just with the remaining parameters provided too like the PlayerObjects table name etc
dreamora
 
Posts: 225
Joined: March 2nd, 2012, 9:58 am

Re: Loading name using BigDB

Postby Henrik » September 12th, 2012, 11:25 am

samsonadze wrote:Okay, but when i want to load his name when he will login what i shall do? :)

What exactly are you trying to do?

Do you want the username of the user, after he has connected? Then just read the connectUserId property and remove "simple".

Do you want to store a user's full name after registration, and show it when the user has connected? Then you need to store the full name in the user's playerobject. Like this:

Code: Select all
//Register a user with QuickConnect for Simple Users
PlayerIO.quickConnect.simpleRegister(
    stage, 'your game id', username, password, email, null, null, null,
    function(client:Client):void {
        //Load the playerobject
        client.bigDB.loadMyPlayerObject(function(playerObj:DatabaseObject):void {
            //Store the full name
            playerObj.Fullname = 'The user's full name';
            //Save it to the database
            playerObj.Save();
        });
    }, function(e:PlayerIORegistrationError):void {
        trace("Error: ", e)
    }
);


And when you want to load the stored full name after a client has connected, you can do it like this:

Code: Select all
//Login for a user with QuickConnect for Simple Users
PlayerIO.quickConnect.simpleConnect(
    stage, 'your game id', username, password,
    function(client:Client):void{
        //Load the playerobject
        client.bigDB.loadMyPlayerObject(function(playerObj:DatabaseObject):void {
            trace(playerObj.Fullname);
        });
    }, function(e:PlayerIOError):void{
        trace("Error: ", e)
    }
);
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Loading name using BigDB

Postby samsonadze » September 12th, 2012, 4:35 pm

How can i read ConnectUserId? :roll:
C#
samsonadze
 
Posts: 122
Joined: August 29th, 2012, 2:39 pm

Re: Loading name using BigDB

Postby samsonadze » September 12th, 2012, 4:38 pm

My fault, ok got it with client.ConnectUserId .
How can i remove Simple there?
C#
samsonadze
 
Posts: 122
Joined: August 29th, 2012, 2:39 pm

Re: Loading name using BigDB

Postby Henrik » September 12th, 2012, 4:59 pm

Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to BigDB