ctalyst® – Using your own Registration Menu

This article will discuss how to implement ctalyst® registration system with Registration Menu of your own. This article assume that ctalyst® Unity SDK is already installed in you project.

Prerequisites:

Download the ctalyst® Unity Plugin and set it up in your project. For more details on setting up ctalsyt® SDK read Unity 3D – Getting Started with ctalyst

Register a User to ctalyst®:

Initializing Plugin:

Following code will initialize the Registration-Login Component of ctalyst® Unity Plugin. It will also add method RunOnRegistrationSuccessful to be executed when registration is successful and method RunOnRegistrationNotSuccessful when registration is unsuccessful. You can define your own code in these methods to implement.


  private ctalyst.ctalyst_Game_Registration ctalystRegisterLogin;
  void Awake()
  {
      ctalystRegisterLogin= gameObject.GetComponent();
      
      // Add custom method to execute when Registration is Successful
      ctalyst.ctalyst_Game_Registration.AddUserRegisterSuccessfulEventListener(RunOnRegistrationSuccessful);

      // Add custom method to execute when Registration is Successful
      ctalyst.ctalyst_Game_Registration.AddRegistrationErrorEventListener(RunOnRegistrationNotSuccessful);
  }
  public void RunOnRegistrationSuccessful()
  {
      // This method will execute if registration is successful
      // You can put custom code here ...
  }

  public void RunOnRegistrationNotSuccessful()
  {
      // This method will execute if registration is not successful
      // You can put custom code here ...
  }

Now the plugin is configured to be used to register user to ctalyst®. Following method should be used to make API call to register the user to ctalyst®.


   ctalystRegisterLogin.Register(
      user_email,             // string
      user_password,          // string
      user_confirm_password,  // string
      user_year_of_birth,     // positive int
      user_approx_income,     // positive int
      user_gender             // "Male", "Female" or "Unknown"
    );

“user_gender” have only 3 specific values as mentioned in the comment of the above code, “Male”, “Female” or “Unknown”. “Unknown” is used if a user do not want to disclose there gender.