-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f543ac2
Showing
1,267 changed files
with
118,167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# 3D models | ||
*.3dm filter=lfs diff=lfs merge=lfs -text | ||
*.3ds filter=lfs diff=lfs merge=lfs -text | ||
*.blend filter=lfs diff=lfs merge=lfs -text | ||
*.c4d filter=lfs diff=lfs merge=lfs -text | ||
*.collada filter=lfs diff=lfs merge=lfs -text | ||
*.dae filter=lfs diff=lfs merge=lfs -text | ||
*.dxf filter=lfs diff=lfs merge=lfs -text | ||
*.fbx filter=lfs diff=lfs merge=lfs -text | ||
*.jas filter=lfs diff=lfs merge=lfs -text | ||
*.lws filter=lfs diff=lfs merge=lfs -text | ||
*.lxo filter=lfs diff=lfs merge=lfs -text | ||
*.ma filter=lfs diff=lfs merge=lfs -text | ||
*.max filter=lfs diff=lfs merge=lfs -text | ||
*.mb filter=lfs diff=lfs merge=lfs -text | ||
*.obj filter=lfs diff=lfs merge=lfs -text | ||
*.ply filter=lfs diff=lfs merge=lfs -text | ||
*.skp filter=lfs diff=lfs merge=lfs -text | ||
*.stl filter=lfs diff=lfs merge=lfs -text | ||
*.ztl filter=lfs diff=lfs merge=lfs -text | ||
# Audio | ||
*.aif filter=lfs diff=lfs merge=lfs -text | ||
*.aiff filter=lfs diff=lfs merge=lfs -text | ||
*.it filter=lfs diff=lfs merge=lfs -text | ||
*.mod filter=lfs diff=lfs merge=lfs -text | ||
*.mp3 filter=lfs diff=lfs merge=lfs -text | ||
*.ogg filter=lfs diff=lfs merge=lfs -text | ||
*.s3m filter=lfs diff=lfs merge=lfs -text | ||
*.wav filter=lfs diff=lfs merge=lfs -text | ||
*.xm filter=lfs diff=lfs merge=lfs -text | ||
# Fonts | ||
*.otf filter=lfs diff=lfs merge=lfs -text | ||
*.ttf filter=lfs diff=lfs merge=lfs -text | ||
# Images | ||
*.bmp filter=lfs diff=lfs merge=lfs -text | ||
*.exr filter=lfs diff=lfs merge=lfs -text | ||
*.gif filter=lfs diff=lfs merge=lfs -text | ||
*.hdr filter=lfs diff=lfs merge=lfs -text | ||
*.iff filter=lfs diff=lfs merge=lfs -text | ||
*.jpeg filter=lfs diff=lfs merge=lfs -text | ||
*.jpg filter=lfs diff=lfs merge=lfs -text | ||
*.pict filter=lfs diff=lfs merge=lfs -text | ||
*.png filter=lfs diff=lfs merge=lfs -text | ||
*.psd filter=lfs diff=lfs merge=lfs -text | ||
*.tga filter=lfs diff=lfs merge=lfs -text | ||
*.tif filter=lfs diff=lfs merge=lfs -text | ||
*.tiff filter=lfs diff=lfs merge=lfs -text | ||
# Collapse Unity-generated files on GitHub | ||
*.asset linguist-generated | ||
*.mat linguist-generated | ||
*.meta linguist-generated | ||
*.prefab linguist-generated | ||
*.unity linguist-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# This .gitignore file should be placed at the root of your Unity project directory | ||
# | ||
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore | ||
# | ||
/[Ll]ibrary/ | ||
/[Tt]emp/ | ||
/[Oo]bj/ | ||
/[Bb]uild/ | ||
/[Bb]uilds/ | ||
/[Ll]ogs/ | ||
/[Mm]emoryCaptures/ | ||
|
||
# Asset meta data should only be ignored when the corresponding asset is also ignored | ||
!/[Aa]ssets/**/*.meta | ||
|
||
# Uncomment this line if you wish to ignore the asset store tools plugin | ||
# /[Aa]ssets/AssetStoreTools* | ||
|
||
# Autogenerated Jetbrains Rider plugin | ||
[Aa]ssets/Plugins/Editor/JetBrains* | ||
|
||
# Visual Studio cache directory | ||
.vs/ | ||
|
||
# Gradle cache directory | ||
.gradle/ | ||
|
||
# Autogenerated VS/MD/Consulo solution and project files | ||
ExportedObj/ | ||
.consulo/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
*.pdb | ||
*.mdb | ||
*.opendb | ||
*.VC.db | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
*.pdb.meta | ||
*.mdb.meta | ||
|
||
# Unity3D generated file on crash reports | ||
sysinfo.txt | ||
|
||
# Builds | ||
*.apk | ||
*.unitypackage | ||
|
||
# Crashlytics generated file | ||
crashlytics-build.properties | ||
|
||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# Peek | ||
Assets/Ludiq/Ludiq.PeekCore | ||
Assets/Ludiq/Ludiq.Peek | ||
Assets/Ludiq.Generated/Transient | ||
|
||
# Odin | ||
Assets/Plugins/Sirenix/Assemblies/AOT/* | ||
Assets/Plugins/Sirenix/Demos/* | ||
!/Assets/Plugins/Sirenix/Demos/*.unitypackage | ||
|
||
# Gaia | ||
Assets/Procedural*Worlds/Gaia/Asset*Samples/* | ||
Assets/Samples/Terrain*Tools/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"git.ignoreLimitWarning": true | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
using System.Collections; | ||
using UnityEngine; | ||
|
||
namespace Mirror.Authenticators | ||
{ | ||
[AddComponentMenu("Network/Authenticators/BasicAuthenticator")] | ||
public class BasicAuthenticator : NetworkAuthenticator | ||
{ | ||
[Header("Custom Properties")] | ||
|
||
// set these in the inspector | ||
public string username; | ||
public string password; | ||
|
||
#region Messages | ||
|
||
public struct AuthRequestMessage : NetworkMessage | ||
{ | ||
// use whatever credentials make sense for your game | ||
// for example, you might want to pass the accessToken if using oauth | ||
public string authUsername; | ||
public string authPassword; | ||
} | ||
|
||
public struct AuthResponseMessage : NetworkMessage | ||
{ | ||
public byte code; | ||
public string message; | ||
} | ||
|
||
#endregion | ||
|
||
#region Server | ||
|
||
/// <summary> | ||
/// Called on server from StartServer to initialize the Authenticator | ||
/// <para>Server message handlers should be registered in this method.</para> | ||
/// </summary> | ||
public override void OnStartServer() | ||
{ | ||
// register a handler for the authentication request we expect from client | ||
NetworkServer.RegisterHandler<AuthRequestMessage>(OnAuthRequestMessage, false); | ||
} | ||
|
||
/// <summary> | ||
/// Called on server from StopServer to reset the Authenticator | ||
/// <para>Server message handlers should be registered in this method.</para> | ||
/// </summary> | ||
public override void OnStopServer() | ||
{ | ||
// unregister the handler for the authentication request | ||
NetworkServer.UnregisterHandler<AuthRequestMessage>(); | ||
} | ||
|
||
/// <summary> | ||
/// Called on server from OnServerAuthenticateInternal when a client needs to authenticate | ||
/// </summary> | ||
/// <param name="conn">Connection to client.</param> | ||
public override void OnServerAuthenticate(NetworkConnection conn) | ||
{ | ||
// do nothing...wait for AuthRequestMessage from client | ||
} | ||
|
||
/// <summary> | ||
/// Called on server when the client's AuthRequestMessage arrives | ||
/// </summary> | ||
/// <param name="conn">Connection to client.</param> | ||
/// <param name="msg">The message payload</param> | ||
public void OnAuthRequestMessage(NetworkConnection conn, AuthRequestMessage msg) | ||
{ | ||
// Debug.LogFormat(LogType.Log, "Authentication Request: {0} {1}", msg.authUsername, msg.authPassword); | ||
|
||
// check the credentials by calling your web server, database table, playfab api, or any method appropriate. | ||
if (msg.authUsername == username && msg.authPassword == password) | ||
{ | ||
// create and send msg to client so it knows to proceed | ||
AuthResponseMessage authResponseMessage = new AuthResponseMessage | ||
{ | ||
code = 100, | ||
message = "Success" | ||
}; | ||
|
||
conn.Send(authResponseMessage); | ||
|
||
// Accept the successful authentication | ||
ServerAccept(conn); | ||
} | ||
else | ||
{ | ||
// create and send msg to client so it knows to disconnect | ||
AuthResponseMessage authResponseMessage = new AuthResponseMessage | ||
{ | ||
code = 200, | ||
message = "Invalid Credentials" | ||
}; | ||
|
||
conn.Send(authResponseMessage); | ||
|
||
// must set NetworkConnection isAuthenticated = false | ||
conn.isAuthenticated = false; | ||
|
||
// disconnect the client after 1 second so that response message gets delivered | ||
StartCoroutine(DelayedDisconnect(conn, 1)); | ||
} | ||
} | ||
|
||
IEnumerator DelayedDisconnect(NetworkConnection conn, float waitTime) | ||
{ | ||
yield return new WaitForSeconds(waitTime); | ||
|
||
// Reject the unsuccessful authentication | ||
ServerReject(conn); | ||
} | ||
|
||
#endregion | ||
|
||
#region Client | ||
|
||
/// <summary> | ||
/// Called on client from StartClient to initialize the Authenticator | ||
/// <para>Client message handlers should be registered in this method.</para> | ||
/// </summary> | ||
public override void OnStartClient() | ||
{ | ||
// register a handler for the authentication response we expect from server | ||
NetworkClient.RegisterHandler<AuthResponseMessage>(OnAuthResponseMessage, false); | ||
} | ||
|
||
/// <summary> | ||
/// Called on client from StopClient to reset the Authenticator | ||
/// <para>Client message handlers should be unregistered in this method.</para> | ||
/// </summary> | ||
public override void OnStopClient() | ||
{ | ||
// unregister the handler for the authentication response | ||
NetworkClient.UnregisterHandler<AuthResponseMessage>(); | ||
} | ||
|
||
/// <summary> | ||
/// Called on client from OnClientAuthenticateInternal when a client needs to authenticate | ||
/// </summary> | ||
/// <param name="conn">Connection of the client.</param> | ||
public override void OnClientAuthenticate(NetworkConnection conn) | ||
{ | ||
AuthRequestMessage authRequestMessage = new AuthRequestMessage | ||
{ | ||
authUsername = username, | ||
authPassword = password | ||
}; | ||
|
||
conn.Send(authRequestMessage); | ||
} | ||
|
||
/// <summary> | ||
/// Called on client when the server's AuthResponseMessage arrives | ||
/// </summary> | ||
/// <param name="conn">Connection to client.</param> | ||
/// <param name="msg">The message payload</param> | ||
public void OnAuthResponseMessage(NetworkConnection conn, AuthResponseMessage msg) | ||
{ | ||
if (msg.code == 100) | ||
{ | ||
// Debug.LogFormat(LogType.Log, "Authentication Response: {0}", msg.message); | ||
|
||
// Authentication has been accepted | ||
ClientAccept(conn); | ||
} | ||
else | ||
{ | ||
Debug.LogError($"Authentication Response: {msg.message}"); | ||
|
||
// Authentication has been rejected | ||
ClientReject(conn); | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.