Game Connect
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.
Methods: GameConnect and GameConnectWithUserName
Method: GameConnect
Signature:
public static async Task<bool> GameConnect(string email)
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:
public static async Task<bool> GameConnectWithUserName(string userName)
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.
Usage
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:
csharpCopy codeusing UnityEngine; using UnityEngine.UI; using ReneVerse; public class ConnectionManager : MonoBehaviour { public InputField emailInputField; public InputField userNameInputField; public Text statusText; public async void OnConnectButtonClicked() { string email = emailInputField.text; string userName = userNameInputField.text; bool connectionSuccessful; if (!string.IsNullOrEmpty(email)) { connectionSuccessful = await ReneAPIManager.GameConnect(email); } else { connectionSuccessful = await ReneAPIManager.GameConnectWithUserName(userName); } if (connectionSuccessful) { statusText.text = "Connection successful! Please authorize on the ReneVerse website."; // Proceed to the next scene or game state // Now players have the benefits of logging in } else { statusText.text = "Connection failed. Please check your credentials or registration status."; } } }
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.csharpCopy codevoid Start() { ReneAPIManager.InitializeAPI(); }
Detailed Explanation
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.
public static async Task<bool> GameConnect(string email)
{
GameAPI gameAPI = api.Game();
return await gameAPI.Connect(email);
}
public static async Task<bool> GameConnectWithUserName(string userName)
{
GameAPI gameAPI = api.Game();
return await gameAPI.ConnectWithUserName(userName);
}
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.
Summary
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.
Last updated