Class InMemoryPlayerLogin
This class is used to demonstrate how you can effectively bypass the login mechanism used in the LoginController by default. While Llama Chat expects the user is "authenticated" in some way and each player has a unique id, you do not have to do authentication via your Unity code. The critical pieces here are that at the time of Player GameObject creation you must have:
- A unique identifier for each player (GUID or some other id)
- An active NetworkConnection for that player. See: "HandleUserLogin" on this class for how we "simulate" login. You can make API calls to authenticate the user, retrieve data about the user such as friends list, and more before creating the player, then hydrate the InMemoryPlayerDatabase if you are running with a database separate from your core game.
Inherited Members
Namespace: LlamaSoftware.Chat.Demo
Assembly: LlamaSoftware.Chat.Demo.dll
Syntax
public class InMemoryPlayerLogin : LoginController
Methods
HandleUserLogin(NetworkMessage)
Server request processor to handle existing users logging in. Checks email/password from the LoginMessage against the database and sends a LoginResponseMessage to the calling client.
Declaration
protected virtual void HandleUserLogin(NetworkMessage message)
Parameters
| Type | Name | Description |
|---|---|---|
| NetworkMessage | message | Network Message |
OnStartClient()
Registers client handlers for RegisterUserResponseMessage and LoginResponseMessage.
Declaration
public override void OnStartClient()
Overrides
OnStartServer()
Declaration
public override void OnStartServer()