Addon Mobile Register

Mobile Register

this addon allows you to use the google signin in your mobile game, but also a guest user system based on the phone's unique id

Tutoriel for installation

1) Verry important

First need visit this page and create you API --https://developers.google.com/identity/sign-in/android/start Next go here for find your WebClientId --https://console.developers.google.com/apis/credentials?project=_

2 ) Open NetworkAuthenticatorMMO.cs

A.1 - find this :

    // login info for the local player
    // we don't just name it 'account' to avoid collisions in handshake
    [Header("Login")]
    public string loginAccount = "";
    public string loginPassword = "";

    [Header("Security")]
    public string passwordSalt = "at_least_16_byte";
    public int accountMaxLength = 16;

A.2 Replace to :

    // login info for the local player
    // we don't just name it 'account' to avoid collisions in handshake
    [Header("Login")]
    public string loginAccount = "";
    public string loginPassword = "";

#if _iMMOREGISTERMOBILE
    public string guestUserUniqID;
    public string googleSignInToken;

    public int loginType = 0; // 0 login/pass , 1 GuestUSer, 2 Google SignIn
#endif

    [Header("Security")]
    public string passwordSalt = "at_least_16_byte";
    public int accountMaxLength = 16;

B - 1) Find this

        string hash = Utils.PBKDF2Hash(loginPassword, passwordSalt + loginAccount);
        LoginMsg message = new LoginMsg{account=loginAccount, password=hash, version=Application.version};
        NetworkClient.connection.Send(message);
        Debug.Log("login message was sent");

B - 2) Replace to

#if _iMMOREGISTERMOBILE
        if(loginType == 1)
        {
            // 1 ) if faut check si le guestUserUniqID à un compte associer
            string account = Database.singleton.isRegistered_user(loginType, guestUserUniqID);
            loginPassword = account;
            loginAccount = account;

        }
        else if(loginType == 2)
        {
            // Is a google login
            string account = Database.singleton.isRegistered_user(loginType, googleSignInToken, manager.networkManagerMMORegisterMobile.WebClientID);
            loginPassword = account;
            loginAccount = account;
        }
#endif


        string hash = Utils.PBKDF2Hash(loginPassword, passwordSalt + loginAccount);
        LoginMsg message = new LoginMsg{account=loginAccount, password=hash, version=Application.version};
        NetworkClient.connection.Send(message);
        Debug.Log("login message was sent");
3) Drag and drop Login_Mobile in canvas and paste your WebClientId

3.1) Assign UIPopup

3.2) Assign NetworkManagerMMO

3.3) Assign NetworkAuthenticator (drag NetworkManagerMMO too)

3.4) if you want try autologin client move slider AutoLogin > 0

4) in NetworkManagerMMO (in scene)

4.1) Add new component : NetworkManagerMMORegisterMobile and in this, add you WebClienID (Step 1)

4.2) in component NetworkManagerMMO Component search NetworkManagerMMORegisterMobile and assign it

5) in Editor open menu "Assets/External Dependency Manager/Android Resolver/Resolve" and wait finished
6) For test Require a Android Build and a online server (or edit code for force use google signin for host&play)

Requirement

  1. No addons required

Add Define

  1. No define

Video Tutoriel

  1. No video tutoriel

Addons idea :

addon name
addon name
addon name