• Home
  • Documentation
  • Guides
  • FAQ
  • Get Llama Chat
Search Results for

    Show / Hide Table of Contents
    • LlamaSoftware.Chat
      • AbstractPlayerDatabase<T>
      • AreaTriggeredChannelJoiner
      • BaseNetworkManager
      • ChatSystem
      • ChatSystemConstants
      • InMemoryPlayerDatabase
      • LlamaChatSettings
      • LlamaChatSettingsProvider
      • Player_Chat
      • SQLitePlayerDatabase
    • LlamaSoftware.Chat.CustomEditors
      • ChatPanelEditor
      • ChatPopupEditor
      • ChatSystemEditor
      • LlamaChatSettingsCreator
      • Player_ChatEditor
      • SocialUIPopupEditor
      • Utilities
    • LlamaSoftware.Chat.Demo
      • ChatCommandHandler
      • CreateAccount
      • DemoGuildJoiner
      • DemoGuildLeaver
      • DummyNameGenerator
      • DynamicChatPopup
      • InMemoryPlayerLogin
      • Login
      • LoginController
      • SettingsPanel
    • LlamaSoftware.Chat.Demo.Lobby
      • LobbyController
      • LobbyLoginController
      • LobbyNetworkManager
      • LobbyPlayer
      • StressTestSender
    • LlamaSoftware.Chat.Demo.Model
      • LobbyPlayerListMessage
      • LoginMessage
      • LoginResponseMessage
      • RegisterPlayerMessage
      • RegisterUserResponseMessage
    • LlamaSoftware.Chat.Model
      • AddRemoveFriendMessage
      • BlockListMessage
      • BlockUnblockPlayerMessage
      • ChatChannel
      • ChatChannel.ChatType
      • ChatEntry
      • ChatMessage
      • FriendsListMessage
      • FriendUpdateMessage
      • Player
      • PlayerToSocialPlayerConverter
      • ServerBroadcastMessage
      • SocialPlayer
      • SubscribeToChannelsMessage
    • LlamaSoftware.Chat.UI
      • BlockedPlayer
      • ChatChannelClickHandler
      • ChatPanel
      • ChatPanel.DirectChatPlayer
      • ChatPanel.UIChatChannel
      • ChatPopup
      • ChatPopupClickHandler
      • Command
      • DynamicChatItem
      • DynamicChatItemEvent
      • Friend
      • Friend.Status
      • LinkType
      • SocialClickHandler
      • SocialUI
      • SocialUIClickHandler
      • SocialUIPopup
      • UIChatMessage
      • WordFilter

    Class LoginController

    Note this is in LlamaSoftware.Chat.Demo namespace so it works in the demo but may require modification to work in your game. Specifically, database management should be much more complex than this. This Controller is meant to provide the concept of what needs to be done, and can be utilized as a base, but does not handle all the nuances that need to be handled in a production application.

    Inheritance
    System.Object
    LoginController
    InMemoryPlayerLogin
    LobbyLoginController
    Namespace: LlamaSoftware.Chat.Demo
    Assembly: LlamaSoftware.Chat.Demo.dll
    Syntax
    public class LoginController : NetworkBehaviour

    Fields

    Connection

    Declaration
    protected SqliteConnection Connection
    Field Value
    Type Description
    Mono.Data.Sqlite.SqliteConnection

    InGameUICanvas

    Declaration
    [SerializeField]
    protected Canvas InGameUICanvas
    Field Value
    Type Description
    UnityEngine.Canvas

    LOGIN_CHANNEL

    Network channel to send Login messages on.

    Declaration
    public const short LOGIN_CHANNEL = 998
    Field Value
    Type Description
    System.Int16

    LoginDemoUI

    Declaration
    [SerializeField]
    protected GameObject LoginDemoUI
    Field Value
    Type Description
    UnityEngine.GameObject

    PathToDatabase

    Path to the database file. If you update this, you will also probably want to update it in SQLitePlayerDatabase.cs.

    Declaration
    [SerializeField]
    [Tooltip("Path to the database file.\nIf you update this, you will also probably want to update it in SQLitePlayerDatabase.cs.")]
    protected string PathToDatabase
    Field Value
    Type Description
    System.String

    PlayerControllerId

    Declaration
    protected short PlayerControllerId
    Field Value
    Type Description
    System.Int16

    REGISTER_USER_CHANNEL

    Network channel to send Register User messages on.

    Declaration
    public const short REGISTER_USER_CHANNEL = 999
    Field Value
    Type Description
    System.Int16

    Methods

    ClientHandleRegisterUser(NetworkMessage)

    Response processor for receiving RegisterUserResponseMessage messages. If Message is not SUCCESS it's assumed to be an error message.

    Declaration
    protected virtual void ClientHandleRegisterUser(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    ClientHandleUserLogin(NetworkMessage)

    Response processor for LoginResponseMessage messages. If Message is not SUCCESS it's assumed to be an error message.

    Declaration
    protected virtual void ClientHandleUserLogin(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    CreatePlayerFromRow(SqliteDataReader, NetworkMessage, Boolean)

    Note this assumes 1 character per account. If you would like to support multiple characters, then you'll need to:

    1. Create a new table mapping characters to login table in the database like: create table character( ID INTEGER PRIMARY KEY AUTOINCREMENT, ACCOUNT_ID INTEGER, CHARACTER_NAME TEXT NOT NULL, -- whatever else... FOREIGN KEY (ACCOUNT_ID) REFERENCES login(ID) );
    2. On successful login, do query the characters and display them somehow to allow the user to select which one they want to start playing as
    3. Send a new NetworkMessage(similar to LoginMessage, maybe just with the CharacterId)
    4. Add a Handler on Client and Server to handle that message, where this function is called to create the player, and Client does whatever they need on success.
    Declaration
    protected virtual void CreatePlayerFromRow(SqliteDataReader reader, NetworkMessage message, bool isCreateAccount)
    Parameters
    Type Name Description
    Mono.Data.Sqlite.SqliteDataReader reader
    NetworkMessage message
    System.Boolean isCreateAccount

    HandleRegisterUser(NetworkMessage)

    Server request processor for RegisterPlayerMessages. Validates there's not already a user with the same email then sends a RegisterUserResponseMessage with SUCCESS if successful, otherwise Message is an error message.

    Declaration
    protected virtual void HandleRegisterUser(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    Network Message

    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()

    OnStartServer()

    Declaration
    public override void OnStartServer()
    In This Article
    Back to top Generated by DocFX