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

    Show / Hide Table of Contents
    • LlamaSoftware.Chat
      • AbstractPlayerDatabase<T>
      • AreaTriggeredChannelJoiner
      • BaseNetworkManager
      • ChatSystem
      • ChatSystemConstants
      • 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
      • 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
    UnityEngine.Object
    UnityEngine.Component
    UnityEngine.Behaviour
    UnityEngine.MonoBehaviour
    UnityEngine.Networking.NetworkBehaviour
    LoginController
    LobbyLoginController
    Inherited Members
    UnityEngine.Networking.NetworkBehaviour.SetDirtyBit(System.UInt32)
    UnityEngine.Networking.NetworkBehaviour.ClearAllDirtyBits()
    UnityEngine.Networking.NetworkBehaviour.OnSerialize(UnityEngine.Networking.NetworkWriter, System.Boolean)
    UnityEngine.Networking.NetworkBehaviour.OnDeserialize(UnityEngine.Networking.NetworkReader, System.Boolean)
    UnityEngine.Networking.NetworkBehaviour.OnNetworkDestroy()
    UnityEngine.Networking.NetworkBehaviour.OnStartLocalPlayer()
    UnityEngine.Networking.NetworkBehaviour.OnStartAuthority()
    UnityEngine.Networking.NetworkBehaviour.OnStopAuthority()
    UnityEngine.Networking.NetworkBehaviour.OnRebuildObservers(System.Collections.Generic.HashSet<UnityEngine.Networking.NetworkConnection>, System.Boolean)
    UnityEngine.Networking.NetworkBehaviour.OnSetLocalVisibility(System.Boolean)
    UnityEngine.Networking.NetworkBehaviour.OnCheckObserver(UnityEngine.Networking.NetworkConnection)
    UnityEngine.Networking.NetworkBehaviour.GetNetworkChannel()
    UnityEngine.Networking.NetworkBehaviour.GetNetworkSendInterval()
    UnityEngine.Networking.NetworkBehaviour.localPlayerAuthority
    UnityEngine.Networking.NetworkBehaviour.isServer
    UnityEngine.Networking.NetworkBehaviour.isClient
    UnityEngine.Networking.NetworkBehaviour.isLocalPlayer
    UnityEngine.Networking.NetworkBehaviour.hasAuthority
    UnityEngine.Networking.NetworkBehaviour.netId
    UnityEngine.Networking.NetworkBehaviour.connectionToServer
    UnityEngine.Networking.NetworkBehaviour.connectionToClient
    UnityEngine.Networking.NetworkBehaviour.playerControllerId
    UnityEngine.Networking.NetworkBehaviour.syncVarDirtyBits
    UnityEngine.Networking.NetworkBehaviour.syncVarHookGuard
    UnityEngine.MonoBehaviour.IsInvoking()
    UnityEngine.MonoBehaviour.CancelInvoke()
    UnityEngine.MonoBehaviour.Invoke(System.String, System.Single)
    UnityEngine.MonoBehaviour.InvokeRepeating(System.String, System.Single, System.Single)
    UnityEngine.MonoBehaviour.CancelInvoke(System.String)
    UnityEngine.MonoBehaviour.IsInvoking(System.String)
    UnityEngine.MonoBehaviour.StartCoroutine(System.String)
    UnityEngine.MonoBehaviour.StartCoroutine(System.String, System.Object)
    UnityEngine.MonoBehaviour.StartCoroutine(System.Collections.IEnumerator)
    UnityEngine.MonoBehaviour.StartCoroutine_Auto(System.Collections.IEnumerator)
    UnityEngine.MonoBehaviour.StopCoroutine(System.Collections.IEnumerator)
    UnityEngine.MonoBehaviour.StopCoroutine(UnityEngine.Coroutine)
    UnityEngine.MonoBehaviour.StopCoroutine(System.String)
    UnityEngine.MonoBehaviour.StopAllCoroutines()
    UnityEngine.MonoBehaviour.print(System.Object)
    UnityEngine.MonoBehaviour.useGUILayout
    UnityEngine.MonoBehaviour.runInEditMode
    UnityEngine.Behaviour.enabled
    UnityEngine.Behaviour.isActiveAndEnabled
    UnityEngine.Component.GetComponent(System.Type)
    UnityEngine.Component.GetComponent<T>()
    UnityEngine.Component.GetComponent(System.String)
    UnityEngine.Component.GetComponentInChildren(System.Type, System.Boolean)
    UnityEngine.Component.GetComponentInChildren(System.Type)
    UnityEngine.Component.GetComponentInChildren<T>(System.Boolean)
    UnityEngine.Component.GetComponentInChildren<T>()
    UnityEngine.Component.GetComponentsInChildren(System.Type, System.Boolean)
    UnityEngine.Component.GetComponentsInChildren(System.Type)
    UnityEngine.Component.GetComponentsInChildren<T>(System.Boolean)
    UnityEngine.Component.GetComponentsInChildren<T>(System.Boolean, System.Collections.Generic.List<T>)
    UnityEngine.Component.GetComponentsInChildren<T>()
    UnityEngine.Component.GetComponentsInChildren<T>(System.Collections.Generic.List<T>)
    UnityEngine.Component.GetComponentInParent(System.Type)
    UnityEngine.Component.GetComponentInParent<T>()
    UnityEngine.Component.GetComponentsInParent(System.Type, System.Boolean)
    UnityEngine.Component.GetComponentsInParent(System.Type)
    UnityEngine.Component.GetComponentsInParent<T>(System.Boolean)
    UnityEngine.Component.GetComponentsInParent<T>(System.Boolean, System.Collections.Generic.List<T>)
    UnityEngine.Component.GetComponentsInParent<T>()
    UnityEngine.Component.GetComponents(System.Type)
    UnityEngine.Component.GetComponents(System.Type, System.Collections.Generic.List<UnityEngine.Component>)
    UnityEngine.Component.GetComponents<T>(System.Collections.Generic.List<T>)
    UnityEngine.Component.GetComponents<T>()
    UnityEngine.Component.CompareTag(System.String)
    UnityEngine.Component.SendMessageUpwards(System.String, System.Object, UnityEngine.SendMessageOptions)
    UnityEngine.Component.SendMessageUpwards(System.String, System.Object)
    UnityEngine.Component.SendMessageUpwards(System.String)
    UnityEngine.Component.SendMessageUpwards(System.String, UnityEngine.SendMessageOptions)
    UnityEngine.Component.SendMessage(System.String, System.Object)
    UnityEngine.Component.SendMessage(System.String)
    UnityEngine.Component.SendMessage(System.String, System.Object, UnityEngine.SendMessageOptions)
    UnityEngine.Component.SendMessage(System.String, UnityEngine.SendMessageOptions)
    UnityEngine.Component.BroadcastMessage(System.String, System.Object, UnityEngine.SendMessageOptions)
    UnityEngine.Component.BroadcastMessage(System.String, System.Object)
    UnityEngine.Component.BroadcastMessage(System.String)
    UnityEngine.Component.BroadcastMessage(System.String, UnityEngine.SendMessageOptions)
    UnityEngine.Component.transform
    UnityEngine.Component.gameObject
    UnityEngine.Component.tag
    UnityEngine.Object.GetInstanceID()
    UnityEngine.Object.GetHashCode()
    UnityEngine.Object.Equals(System.Object)
    UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
    UnityEngine.Object.Instantiate(UnityEngine.Object)
    UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Transform)
    UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Transform, System.Boolean)
    UnityEngine.Object.Instantiate<T>(T)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform, System.Boolean)
    UnityEngine.Object.Destroy(UnityEngine.Object, System.Single)
    UnityEngine.Object.Destroy(UnityEngine.Object)
    UnityEngine.Object.DestroyImmediate(UnityEngine.Object, System.Boolean)
    UnityEngine.Object.DestroyImmediate(UnityEngine.Object)
    UnityEngine.Object.FindObjectsOfType(System.Type)
    UnityEngine.Object.DontDestroyOnLoad(UnityEngine.Object)
    UnityEngine.Object.DestroyObject(UnityEngine.Object, System.Single)
    UnityEngine.Object.DestroyObject(UnityEngine.Object)
    UnityEngine.Object.FindSceneObjectsOfType(System.Type)
    UnityEngine.Object.FindObjectsOfTypeIncludingAssets(System.Type)
    UnityEngine.Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectsOfTypeAll(System.Type)
    UnityEngine.Object.FindObjectOfType(System.Type)
    UnityEngine.Object.ToString()
    UnityEngine.Object.name
    UnityEngine.Object.hideFlags
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    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
    [Client]
    protected virtual void ClientHandleRegisterUser(NetworkMessage message)
    Parameters
    Type Name Description
    UnityEngine.Networking.NetworkMessage message

    ClientHandleUserLogin(NetworkMessage)

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

    Declaration
    [Client]
    protected virtual void ClientHandleUserLogin(NetworkMessage message)
    Parameters
    Type Name Description
    UnityEngine.Networking.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
    [Server]
    protected virtual void CreatePlayerFromRow(SqliteDataReader reader, NetworkMessage message, bool isCreateAccount)
    Parameters
    Type Name Description
    Mono.Data.Sqlite.SqliteDataReader reader
    UnityEngine.Networking.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
    [Server]
    protected virtual void HandleRegisterUser(NetworkMessage message)
    Parameters
    Type Name Description
    UnityEngine.Networking.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
    [Server]
    protected virtual void HandleUserLogin(NetworkMessage message)
    Parameters
    Type Name Description
    UnityEngine.Networking.NetworkMessage message

    Network Message

    OnStartClient()

    Registers client handlers for RegisterUserResponseMessage and LoginResponseMessage.

    Declaration
    public override void OnStartClient()
    Overrides
    UnityEngine.Networking.NetworkBehaviour.OnStartClient()

    OnStartServer()

    Declaration
    public override void OnStartServer()
    Overrides
    UnityEngine.Networking.NetworkBehaviour.OnStartServer()
    In This Article
    Back to top Generated by DocFX