Moved a couple of folders and wrote some code
This commit is contained in:
@ -0,0 +1,51 @@
|
||||
using FishNet.Connection;
|
||||
using FishNet.Managing;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FishNet.Authenticating
|
||||
{
|
||||
/// <summary>
|
||||
/// When inherited from this can be used to create a custom authentication process before clients may communicate with the server.
|
||||
/// </summary>
|
||||
public abstract class Authenticator : MonoBehaviour
|
||||
{
|
||||
#region Public.
|
||||
/// <summary>
|
||||
/// True if this authenticator has been intiialzied.
|
||||
/// </summary>
|
||||
public bool Initialized { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region Protected.
|
||||
/// <summary>
|
||||
/// NetworkManager for this Authenticator.
|
||||
/// </summary>
|
||||
protected NetworkManager NetworkManager { get; private set; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Called when authenticator has concluded a result for a connection. Boolean is true if authentication passed, false if failed.
|
||||
/// Server listens for this event automatically.
|
||||
/// </summary>
|
||||
public abstract event Action<NetworkConnection, bool> OnAuthenticationResult;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this script for use.
|
||||
/// </summary>
|
||||
/// <param name="networkManager"></param>
|
||||
public virtual void InitializeOnce(NetworkManager networkManager)
|
||||
{
|
||||
NetworkManager = networkManager;
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called on the server immediately after a client connects. Can be used to send data to the client for authentication.
|
||||
/// </summary>
|
||||
/// <param name="connection">Connection which is not yet authenticated.</param>
|
||||
public virtual void OnRemoteConnection(NetworkConnection connection) { }
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9adfb82407774645a1f455ceb9298f9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user