Browse Source

Added .asset to gitLFS

Started Server Code.
Moved Amplified to thirpartyy folder
Moved MainScene to Scenes folder
master
JoshuaReason 5 years ago
parent
commit
6853e0efeb
2610 changed files with 592 additions and 14 deletions
  1. +1
    -14
      .gitattributes
  2. +0
    -0
      Assets/Scenes/MainScene.unity
  3. +0
    -0
      Assets/Scenes/MainScene.unity.meta
  4. +8
    -0
      Assets/Scipts/Multiplayer.meta
  5. +8
    -0
      Assets/Scipts/Multiplayer/Client.meta
  6. +88
    -0
      Assets/Scipts/Multiplayer/Client/ClientManager.cs
  7. +11
    -0
      Assets/Scipts/Multiplayer/Client/ClientManager.cs.meta
  8. +8
    -0
      Assets/Scipts/Multiplayer/Core.meta
  9. +50
    -0
      Assets/Scipts/Multiplayer/Core/ChannelConfig.cs
  10. +11
    -0
      Assets/Scipts/Multiplayer/Core/ChannelConfig.cs.meta
  11. +12
    -0
      Assets/Scipts/Multiplayer/Core/LoginProtocol.cs
  12. +11
    -0
      Assets/Scipts/Multiplayer/Core/LoginProtocol.cs.meta
  13. +117
    -0
      Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs
  14. +11
    -0
      Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs.meta
  15. +36
    -0
      Assets/Scipts/Multiplayer/Core/Utility.cs
  16. +11
    -0
      Assets/Scipts/Multiplayer/Core/Utility.cs.meta
  17. +8
    -0
      Assets/Scipts/Multiplayer/Server.meta
  18. +42
    -0
      Assets/Scipts/Multiplayer/Server/LoginManager.cs
  19. +11
    -0
      Assets/Scipts/Multiplayer/Server/LoginManager.cs.meta
  20. +33
    -0
      Assets/Scipts/Multiplayer/Server/Player.cs
  21. +11
    -0
      Assets/Scipts/Multiplayer/Server/Player.cs.meta
  22. +85
    -0
      Assets/Scipts/Multiplayer/Server/ServerManager.cs
  23. +11
    -0
      Assets/Scipts/Multiplayer/Server/ServerManager.cs.meta
  24. +8
    -0
      Assets/ThirdParty.meta
  25. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor.meta
  26. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/ChangeLog.txt
  27. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/ChangeLog.txt.meta
  28. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/CreatingTerrainsWithASE.txt
  29. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/CreatingTerrainsWithASE.txt.meta
  30. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples.meta
  31. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets.meta
  32. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials.meta
  33. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/BrushedMetal.mat
  34. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/BrushedMetal.mat.meta
  35. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/CalibrationFloor.mat
  36. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/CalibrationFloor.mat.meta
  37. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/RedLight.mat
  38. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/RedLight.mat.meta
  39. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/Rock.mat
  40. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/Rock.mat.meta
  41. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/Rubber.mat
  42. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/Rubber.mat.meta
  43. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models.meta
  44. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/CalibrationScaleRGB.fbx
  45. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/CalibrationScaleRGB.fbx.meta
  46. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials.meta
  47. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/CalibrationRGBScale.mat
  48. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/CalibrationRGBScale.mat.meta
  49. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/Ground.mat
  50. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/Ground.mat.meta
  51. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/No Name.mat
  52. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/No Name.mat.meta
  53. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/Terrain.mat
  54. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/Terrain.mat.meta
  55. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/ae5524-1.mat
  56. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/ae5524-1.mat.meta
  57. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/default.mat
  58. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/default.mat.meta
  59. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/df5524-4.mat
  60. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/df5524-4.mat.meta
  61. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/RoundedCube.fbx
  62. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/RoundedCube.fbx.meta
  63. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Shaderball2.FBX
  64. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Shaderball2.FBX.meta
  65. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/headlow.fbx
  66. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/headlow.fbx.meta
  67. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/smallmountain.fbx
  68. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/smallmountain.fbx.meta
  69. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/smallwater.fbx
  70. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/smallwater.fbx.meta
  71. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs.meta
  72. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion.meta
  73. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion/GrassBlades.prefab
  74. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion/GrassBlades.prefab.meta
  75. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Plane.prefab
  76. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Plane.prefab.meta
  77. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/RoundedCube.prefab
  78. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/RoundedCube.prefab.meta
  79. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/SceneElements.prefab
  80. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/SceneElements.prefab.meta
  81. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/ShaderBall.prefab
  82. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/ShaderBall.prefab.meta
  83. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/StencilObjects.prefab
  84. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/StencilObjects.prefab.meta
  85. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/TerrainWater.prefab
  86. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/TerrainWater.prefab.meta
  87. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions.meta
  88. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official.meta
  89. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/Simple HUE.asset
  90. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/Simple HUE.asset.meta
  91. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/SphereMask.asset
  92. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/SphereMask.asset.meta
  93. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures.meta
  94. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow.meta
  95. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/FakeWindowsMask.png
  96. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/FakeWindowsMask.png.meta
  97. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v1.jpg
  98. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v1.jpg.meta
  99. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v2.jpg
  100. +0
    -0
      Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v2.jpg.meta

+ 1
- 14
.gitattributes View File

@ -1,5 +1,4 @@
## git-lfs ## ## git-lfs ##
#Image #Image
*.jpg filter=lfs diff=lfs merge=lfs -text *.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text *.jpeg filter=lfs diff=lfs merge=lfs -text
@ -10,42 +9,30 @@
*.tga filter=lfs diff=lfs merge=lfs -text *.tga filter=lfs diff=lfs merge=lfs -text
*.hdr filter=lfs diff=lfs merge=lfs -text *.hdr filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text *.exr filter=lfs diff=lfs merge=lfs -text
#Audio #Audio
*.mp3 filter=lfs diff=lfs merge=lfs -text *.mp3 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text *.wav filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text *.ogg filter=lfs diff=lfs merge=lfs -text
*.aif filter=lfs diff=lfs merge=lfs -text *.aif filter=lfs diff=lfs merge=lfs -text
*.aiff filter=lfs diff=lfs merge=lfs -text *.aiff filter=lfs diff=lfs merge=lfs -text
#Video #Video
*.mp4 filter=lfs diff=lfs merge=lfs -text *.mp4 filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text *.mov filter=lfs diff=lfs merge=lfs -text
#3D Object #3D Object
*.FBX filter=lfs diff=lfs merge=lfs -text *.FBX filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text *.fbx filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text *.blend filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text *.obj filter=lfs diff=lfs merge=lfs -text
*.lxo filter=lfs diff=lfs merge=lfs -text *.lxo filter=lfs diff=lfs merge=lfs -text
#Font #Font
*.otf filter=lfs diff=lfs merge=lfs -text *.otf filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text *.ttf filter=lfs diff=lfs merge=lfs -text
#Unity #Unity
*.unitypackage filter=lfs diff=lfs merge=lfs -text *.unitypackage filter=lfs diff=lfs merge=lfs -text
#Code #Code
*.a filter=lfs diff=lfs merge=lfs -text *.a filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text *.dll filter=lfs diff=lfs merge=lfs -text
#ETC #ETC
*.pdf filter=lfs diff=lfs merge=lfs -text *.pdf filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text
.asset filter=lfs diff=lfs merge=lfs -text

Assets/MainScene.unity → Assets/Scenes/MainScene.unity View File


Assets/MainScene.unity.meta → Assets/Scenes/MainScene.unity.meta View File


+ 8
- 0
Assets/Scipts/Multiplayer.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 327c41c2e9379314baa6354c2ad8a92d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Scipts/Multiplayer/Client.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 27ae4060de79ea84d9854b62d3cd73ee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 88
- 0
Assets/Scipts/Multiplayer/Client/ClientManager.cs View File

@ -0,0 +1,88 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Multiplayer
{
public class ClientManager : MonoBehaviour
{
#region Inspector Variables
[Header("Client Settings")]
[Tooltip("Address server is hosted on")]
[SerializeField]
private string ServerAddress = "127.0.0.1";
[Tooltip("Port to connect to server on")]
[SerializeField]
private int Port = 4444;
[Tooltip("Connects client to server on awake")]
[SerializeField]
private bool ConnectOnStart = false;
#endregion
//Returns if client is current connected to a server
public bool IsConnected { get; private set; }
//UNET client class which connects to the server;
private NetworkClient uNetClient;
/// <summary>
/// Call to connect client to host
/// </summary>
[ContextMenu("Start Client")]
public void StartClient()
{
StartClient(ServerAddress, Port);
}
/// <summary>
/// Call to connect the client to the host
/// </summary>
/// <param name="ServerAddress">Server Address to connect to</param>
/// <param name="Port">Port to connect on</param>
public void StartClient(string ServerAddress, int Port)
{
//If client is already connected to don't continue
if (IsConnected)
{
Debug.Log("Client already connected to a server. Client needs to disconnect before it can connect to a server");
return;
}
Debug.Log("Attempting to connect to: '" + ServerAddress + "' on port : '" + Port + "'");
uNetClient = new NetworkClient();
RegisterHandlers(uNetClient);
uNetClient.Configure(ChannelConfig.DefaultTopology());
uNetClient.Connect(ServerAddress, Port);
}
/// <summary>
/// Helper function which sets up all necessary handlers for message types
/// </summary>
/// <param name="client"></param>
private void RegisterHandlers(NetworkClient client)
{
client.RegisterHandler(MsgType.Connect, OnConnected);
client.RegisterHandler(MsgType.Disconnect, OnDisconnected);
}
private void OnConnected(NetworkMessage msg)
{
IsConnected = true;
Debug.Log("Successfully connected to server");
Debug.Log("Connection ID: " + msg.conn.connectionId);
}
private void OnDisconnected(NetworkMessage msg)
{
IsConnected = false;
Debug.Log("Disconnected from Server");
}
}
}

+ 11
- 0
Assets/Scipts/Multiplayer/Client/ClientManager.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4286216c0dea5f64e8d5a8b674f60424
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Scipts/Multiplayer/Core.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1ffdf64b9bb5ef145aa798d9faa3762e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 50
- 0
Assets/Scipts/Multiplayer/Core/ChannelConfig.cs View File

@ -0,0 +1,50 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Multiplayer
{
public static class ChannelConfig
{
public static QosType[] GetDefaultChannels()
{
QosType[] retVal = new QosType[3];
retVal[0] = QosType.Reliable;
retVal[1] = QosType.StateUpdate;
retVal[2] = QosType.UnreliableSequenced;
return retVal;
}
public static HostTopology DefaultTopology()
{
ConnectionConfig config = DefaultConfig();
return new HostTopology(config, 8);
}
public static ConnectionConfig DefaultConfig()
{
ConnectionConfig DefaultConfig = new ConnectionConfig();
QosType[] Channels = GetDefaultChannels();
foreach (QosType channel in Channels)
DefaultConfig.AddChannel(channel);
return DefaultConfig;
}
}
public enum ServerChannel
{
Reliable = 0,
StateUpdate = 1,
UnreliableSequenced = 2,
}
}

+ 11
- 0
Assets/Scipts/Multiplayer/Core/ChannelConfig.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 016335d6e296c0b42a4f0eaa04459635
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 12
- 0
Assets/Scipts/Multiplayer/Core/LoginProtocol.cs View File

@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Multiplayer
{
public class LoginMsgID
{
public const short QueryName = 200;
public const short Name = 201;
}
}

+ 11
- 0
Assets/Scipts/Multiplayer/Core/LoginProtocol.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f6d48a9f61750cd4ca5b651ad1c34bb7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 117
- 0
Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs View File

@ -0,0 +1,117 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Multiplayer
{
public class PlayerMsgID
{
public const short Position = 200;
public const short Rotation = 201;
}
public class PlayerMsg : MessageBase
{
public ushort playerID;
public PlayerMsg() { }
public PlayerMsg(ushort playerID)
{
this.playerID = playerID;
}
public override void Serialize(NetworkWriter writer)
{
writer.Write(playerID);
}
public override void Deserialize(NetworkReader reader)
{
playerID = reader.ReadUInt16();
}
}
public class VectorMsg : PlayerMsg
{
public Vector3 vector;
public VectorMsg() { }
public VectorMsg(ushort PlayerID, Vector3 Vector) : base(PlayerID)
{
this.vector = Vector;
}
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(vector);
}
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
vector = reader.ReadVector3();
}
}
public class QuaternionMsg : PlayerMsg
{
public Quaternion quaternion;
public QuaternionMsg() { }
public QuaternionMsg(ushort PlayerID, Quaternion quaternion) : base(PlayerID)
{
this.quaternion = quaternion;
}
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(quaternion);
}
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
quaternion = reader.ReadQuaternion();
}
}
public class StringMsg : PlayerMsg
{
public string String;
public StringMsg() { }
public StringMsg(ushort PlayerID, string String) : base(PlayerID)
{
this.String = String;
}
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(String);
}
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
String = reader.ReadString();
}
}
}

+ 11
- 0
Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9ec233016f3f5db4a84bdf1ee5ca34d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 36
- 0
Assets/Scipts/Multiplayer/Core/Utility.cs View File

@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Multiplayer
{
public static class Utility
{
public static bool ReadMessage<T>(NetworkMessage msg, out T outMsg, bool logError = true) where T : MessageBase, new()
{
outMsg = new T();
bool isValid = true;
try
{
outMsg = msg.ReadMessage<T>();
isValid = true;
}
catch (UnityException e)
{
isValid = false;
msg.reader.SeekZero();
#if UNITY_EDITOR
Debug.LogError(e);
#endif
}
return isValid;
}
}
}

+ 11
- 0
Assets/Scipts/Multiplayer/Core/Utility.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: efc41e9e8a034494cb4a4e8d3d09cd9b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Scipts/Multiplayer/Server.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b0e9417df7ca8104196e1e80eb099f13
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 42
- 0
Assets/Scipts/Multiplayer/Server/LoginManager.cs View File

@ -0,0 +1,42 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Multiplayer
{
public class LoginManager
{
private ServerManager ServerManager;
public void RegisterHandles()
{
ServerManager.Server.RegisterHandler(LoginMsgID.Name, OnPlayerLogin);
}
//Called when a player logs in
public void OnPlayerLogin(NetworkMessage msg)
{
StringMsg stringMsg;
if (!Utility.ReadMessage<StringMsg>(msg, out stringMsg))
return;
Debug.Log("Player login: " + stringMsg.String);
if (ServerManager.AllPlayers.ContainsKey(stringMsg.playerID))
{
Debug.Log(stringMsg.String + " already logged in");
return;
}
Player newPlayer = new Player(msg.conn, stringMsg.String);
ServerManager.AllPlayers.Add(newPlayer.ID, newPlayer);
}
}
}

+ 11
- 0
Assets/Scipts/Multiplayer/Server/LoginManager.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: abaefae4f67ed3649a0c9403438fde91
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 33
- 0
Assets/Scipts/Multiplayer/Server/Player.cs View File

@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Multiplayer
{
public class Player
{
public byte ID;
public NetworkConnection Connection;
public Vector3 Position { get; private set; }
public Quaternion Rotation { get; private set; }
public string Name { get; private set; }
public Player(NetworkConnection Connection, string Name)
{
this.ID = (byte)Connection.connectionId;
this.Connection = Connection;
this.Name = Name;
}
}
}

+ 11
- 0
Assets/Scipts/Multiplayer/Server/Player.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee044eb57634ca44288ae705c819ca76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 85
- 0
Assets/Scipts/Multiplayer/Server/ServerManager.cs View File

@ -0,0 +1,85 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Multiplayer
{
public class ServerManager : MonoBehaviour
{
[SerializeField]
private bool StartOnAwake = true;
[SerializeField]
private int Port = 4444;
public Dictionary<int, Player> AllPlayers;
public NetworkServerSimple Server { get; private set; }
private void Start()
{
if (StartOnAwake)
StartServer();
}
[ContextMenu("Start Server")]
public void StartServer()
{
StartServer(Port);
}
public void StartServer(int Port)
{
this.Port = Port;
AllPlayers = new Dictionary<int, Player>();
Server = new NetworkServerSimple();
Server.RegisterHandler(MsgType.Connect, OnConnect);
Server.RegisterHandler(MsgType.Disconnect, OnDisconnect);
Server.Configure(ChannelConfig.DefaultTopology());
Debug.Log("Starting Server on " + Port);
Server.Listen(Port);
}
private void Update()
{
if (Server != null)
Server.Update();
}
private void OnConnect(NetworkMessage msg)
{
Debug.Log("New Connection: \n Address: " + msg.conn.address + "\n ID: " + msg.conn.connectionId);
msg.conn.Send(LoginMsgID.QueryName, new PlayerMsg((byte)msg.conn.connectionId));
}
private void OnDisconnect(NetworkMessage msg)
{
if (AllPlayers.ContainsKey(msg.conn.connectionId))
{
Debug.Log(AllPlayers[msg.conn.connectionId].Name + "has disconnected.");
AllPlayers.Remove(msg.conn.connectionId);
}
else
Debug.Log("Unkown player has disconnected.");
}
}
}

+ 11
- 0
Assets/Scipts/Multiplayer/Server/ServerManager.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6f767c4220f486f49aba41a71b372a1f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/ThirdParty.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c026360f17cae77439eaac0f099f965e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Assets/AmplifyShaderEditor.meta → Assets/ThirdParty/AmplifyShaderEditor.meta View File


Assets/AmplifyShaderEditor/ChangeLog.txt → Assets/ThirdParty/AmplifyShaderEditor/ChangeLog.txt View File


Assets/AmplifyShaderEditor/ChangeLog.txt.meta → Assets/ThirdParty/AmplifyShaderEditor/ChangeLog.txt.meta View File


Assets/AmplifyShaderEditor/CreatingTerrainsWithASE.txt → Assets/ThirdParty/AmplifyShaderEditor/CreatingTerrainsWithASE.txt View File


Assets/AmplifyShaderEditor/CreatingTerrainsWithASE.txt.meta → Assets/ThirdParty/AmplifyShaderEditor/CreatingTerrainsWithASE.txt.meta View File


Assets/AmplifyShaderEditor/Examples.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples.meta View File


Assets/AmplifyShaderEditor/Examples/Assets.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/BrushedMetal.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/BrushedMetal.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/BrushedMetal.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/BrushedMetal.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/CalibrationFloor.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/CalibrationFloor.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/CalibrationFloor.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/CalibrationFloor.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/RedLight.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/RedLight.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/RedLight.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/RedLight.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/Rock.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/Rock.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/Rock.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/Rock.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/Rubber.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/Rubber.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Materials/Rubber.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Materials/Rubber.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/CalibrationScaleRGB.fbx → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/CalibrationScaleRGB.fbx View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/CalibrationScaleRGB.fbx.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/CalibrationScaleRGB.fbx.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/CalibrationRGBScale.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/CalibrationRGBScale.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/CalibrationRGBScale.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/CalibrationRGBScale.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/Ground.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/Ground.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/Ground.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/Ground.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/No Name.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/No Name.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/No Name.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/No Name.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/Terrain.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/Terrain.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/Terrain.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/Terrain.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/ae5524-1.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/ae5524-1.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/ae5524-1.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/ae5524-1.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/default.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/default.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/default.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/default.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/df5524-4.mat → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/df5524-4.mat View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Materials/df5524-4.mat.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Materials/df5524-4.mat.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/RoundedCube.fbx → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/RoundedCube.fbx View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/RoundedCube.fbx.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/RoundedCube.fbx.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Shaderball2.FBX → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Shaderball2.FBX View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/Shaderball2.FBX.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/Shaderball2.FBX.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/headlow.fbx → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/headlow.fbx View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/headlow.fbx.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/headlow.fbx.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/smallmountain.fbx → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/smallmountain.fbx View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/smallmountain.fbx.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/smallmountain.fbx.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/smallwater.fbx → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/smallwater.fbx View File


Assets/AmplifyShaderEditor/Examples/Assets/Models/smallwater.fbx.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Models/smallwater.fbx.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion/GrassBlades.prefab → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion/GrassBlades.prefab View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion/GrassBlades.prefab.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Ambient-Occlusion/GrassBlades.prefab.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/Plane.prefab → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Plane.prefab View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/Plane.prefab.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/Plane.prefab.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/RoundedCube.prefab → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/RoundedCube.prefab View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/RoundedCube.prefab.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/RoundedCube.prefab.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/SceneElements.prefab → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/SceneElements.prefab View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/SceneElements.prefab.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/SceneElements.prefab.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/ShaderBall.prefab → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/ShaderBall.prefab View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/ShaderBall.prefab.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/ShaderBall.prefab.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/StencilObjects.prefab → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/StencilObjects.prefab View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/StencilObjects.prefab.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/StencilObjects.prefab.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/TerrainWater.prefab → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/TerrainWater.prefab View File


Assets/AmplifyShaderEditor/Examples/Assets/Prefabs/TerrainWater.prefab.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Prefabs/TerrainWater.prefab.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/ShaderFunctions.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/Simple HUE.asset → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/Simple HUE.asset View File


Assets/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/Simple HUE.asset.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/Simple HUE.asset.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/SphereMask.asset → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/SphereMask.asset View File


Assets/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/SphereMask.asset.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/ShaderFunctions/Official/SphereMask.asset.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Textures.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/FakeWindowsMask.png → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/FakeWindowsMask.png View File


Assets/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/FakeWindowsMask.png.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/FakeWindowsMask.png.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v1.jpg → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v1.jpg View File


Assets/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v1.jpg.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v1.jpg.meta View File


Assets/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v2.jpg → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v2.jpg View File


Assets/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v2.jpg.meta → Assets/ThirdParty/AmplifyShaderEditor/Examples/Assets/Textures/FakeWindow/Fakewindow_v2.jpg.meta View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save