Initial Client/Server Communication
#1 Followed the MagicOnion quickstart guide, borrowing code from the chat sample app to get something working
This commit is contained in:
parent
52b0d4d8ff
commit
a0c8dbee72
493 changed files with 57790 additions and 3 deletions
27
Assets/Scripts/MagicOnion/Utils/FNV1A32.cs
Normal file
27
Assets/Scripts/MagicOnion/Utils/FNV1A32.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System.Text;
|
||||
|
||||
namespace MagicOnion.Utils
|
||||
{
|
||||
public static class FNV1A32
|
||||
{
|
||||
public static int GetHashCode(string str)
|
||||
{
|
||||
return GetHashCode(Encoding.UTF8.GetBytes(str));
|
||||
}
|
||||
|
||||
public static int GetHashCode(byte[] obj)
|
||||
{
|
||||
uint hash = 0;
|
||||
if (obj != null)
|
||||
{
|
||||
hash = 2166136261;
|
||||
for (int i = 0; i < obj.Length; i++)
|
||||
{
|
||||
hash = unchecked((obj[i] ^ hash) * 16777619);
|
||||
}
|
||||
}
|
||||
|
||||
return unchecked((int)hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue