Game Connect
Last updated
Last updated
GameConnect gives your users advantages of using playing the game as long as they are logged in the system. The difference with Email & Password Login is that the user should admitting the logging in attempt on the Reneverse website:
The ReneAPIManager
class is a utility class that manages connections and interactions with the ReneVerse API. It provides several static methods to initialize the API, handle user authentication, connect to games, and perform various other operations.
Method: GameConnect
Signature:
Description: The GameConnect
method connects to the ReneVerse game using the provided email. This connection requires user authorization on the ReneVerse website.
Parameters:
email
(string): The email address of the user. This email must be registered on the ReneVerse website.
Returns:
Task<bool>
: A task representing the asynchronous operation. The task result is a boolean indicating whether the connection was successful.
Method: GameConnectWithUserName
Signature:
Description: The GameConnectWithUserName
method connects to the ReneVerse game using the provided username. This connection also requires user authorization on the ReneVerse website.
Parameters:
userName
(string): The username of the user. This username must be registered on the ReneVerse website.
Returns:
Task<bool>
: A task representing the asynchronous operation. The task result is a boolean indicating whether the connection was successful.
The GameConnect
and GameConnectWithUserName
methods can be called from any script within the Unity project. Typically, they would be called when the user attempts to connect to the game through the game's user interface.
Example Usage in Unity
Here's an example of how to use the GameConnect
and GameConnectWithUserName
methods within a Unity script. This example assumes you have a basic UI setup with input fields for the email or username and a button to trigger the connection process.
Create a Connection UI:
Add Input Fields for email or username.
Add a Button for the connection action.
Attach a Script to the Button:
Initialize the ReneVerse API: Ensure that the API is initialized before calling the connection methods. This can be done in the Start
method of a Unity script or any other appropriate place in your game.
Initialization
Before calling the GameConnect or GameConnectWithUserName
method, it is crucial to initialize the ReneVerse API. The InitializeAPI
method sets up the API using the credentials stored in the ReneAPICreds
in the Reneverse Window that Rene Sdk Provides (Shift + R/ Window -> Reneverse Settings).
Handling Game Connection
The GameConnect
and GameConnectWithUserName
methods utilize the GameAPI
class to send a connection request to the ReneVerse backend. Upon sending the request, users need to authorize the connection on the ReneVerse website.
Customization
Developers can customize the connection implementation as needed. For instance, input parameters can be gathered through different UI elements, such as text fields or dropdowns. The process of integrating the connection functionality into the game's flow is flexible and can be adapted to fit various design requirements.
The ReneAPIManager.GameConnect
and ReneAPIManager.GameConnectWithUserName
methods provide a straightforward way to connect to the ReneVerse game environment in Unity games. These methods require user authorization through the ReneVerse website, ensuring secure connections. By following the steps outlined above, developers can easily integrate connection functionality into their games, allowing users to connect using their registered email or username. The methods are asynchronous and return a boolean indicating the success of the connection attempt, enabling developers to handle successful and failed connections appropriately within their game.