├── .gitattributes ├── .gitignore ├── DataTransferObjects ├── DTOs │ ├── AuthRequest.cs │ ├── ChatMessage.cs │ └── RemotePlayer.cs ├── DataTransferObjects.csproj ├── ISerializable.cs ├── MessageChannel.cs ├── Packet.cs └── PacketType.cs ├── GameClient ├── Assets │ ├── Assemblies │ │ └── Lidgren │ │ │ ├── Lidgren.Network.XML │ │ │ ├── Lidgren.Network.dll │ │ │ └── Lidgren.Network.dll.mdb │ ├── ChatManager.cs │ ├── ClientTest.cs │ ├── LidgrenClient.cs │ ├── Modules │ │ └── DataTransferObjects.dll │ ├── SimpleJSON.cs │ └── main.unity ├── GameClient.csproj ├── GameClient.sln └── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityAdsSettings.asset │ └── UnityConnectSettings.asset ├── GameServer ├── DataModel │ └── PlayerContext.cs ├── GameServer.csproj ├── Logging │ ├── ConsoleLogger.cs │ ├── FileLogger.cs │ ├── ILoggerProvider.cs │ ├── Logger.cs │ └── LoggerFactory.cs ├── Program.cs └── Services │ ├── ChatManager.cs │ ├── ServerEventLogger.cs │ └── SessionManager.cs ├── NetCoreGameServer.sln ├── NetworkLayer ├── IConnection.cs ├── IMessage.cs ├── IServer.cs ├── Lidgren │ ├── LidgrenConnection.cs │ ├── LidgrenMessage.cs │ └── LidgrenServer.cs └── NetworkLayer.csproj └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Microsoft Azure Build Output 166 | csx/ 167 | *.build.csdef 168 | 169 | # Microsoft Azure Emulator 170 | ecf/ 171 | rcf/ 172 | 173 | # Windows Store app package directories and files 174 | AppPackages/ 175 | BundleArtifacts/ 176 | Package.StoreAssociation.xml 177 | _pkginfo.txt 178 | 179 | # Visual Studio cache files 180 | # files ending in .cache can be ignored 181 | *.[Cc]ache 182 | # but keep track of directories ending in .cache 183 | !*.[Cc]ache/ 184 | 185 | # Others 186 | ClientBin/ 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # Since there are multiple workflows, uncomment next line to ignore bower_components 197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 | #bower_components/ 199 | 200 | # RIA/Silverlight projects 201 | Generated_Code/ 202 | 203 | # Backup & report files from converting an old project file 204 | # to a newer Visual Studio version. Backup files are not needed, 205 | # because we have git ;-) 206 | _UpgradeReport_Files/ 207 | Backup*/ 208 | UpgradeLog*.XML 209 | UpgradeLog*.htm 210 | 211 | # SQL Server files 212 | *.mdf 213 | *.ldf 214 | 215 | # Business Intelligence projects 216 | *.rdl.data 217 | *.bim.layout 218 | *.bim_*.settings 219 | 220 | # Microsoft Fakes 221 | FakesAssemblies/ 222 | 223 | # GhostDoc plugin setting file 224 | *.GhostDoc.xml 225 | 226 | # Node.js Tools for Visual Studio 227 | .ntvs_analysis.dat 228 | 229 | # Visual Studio 6 build log 230 | *.plg 231 | 232 | # Visual Studio 6 workspace options file 233 | *.opt 234 | 235 | # Visual Studio LightSwitch build output 236 | **/*.HTMLClient/GeneratedArtifacts 237 | **/*.DesktopClient/GeneratedArtifacts 238 | **/*.DesktopClient/ModelManifest.xml 239 | **/*.Server/GeneratedArtifacts 240 | **/*.Server/ModelManifest.xml 241 | _Pvt_Extensions 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | paket-files/ 246 | 247 | # FAKE - F# Make 248 | .fake/ 249 | 250 | # JetBrains Rider 251 | .idea/ 252 | *.sln.iml 253 | 254 | # ========================= 255 | # Operating System Files 256 | # ========================= 257 | 258 | # OSX 259 | # ========================= 260 | 261 | .DS_Store 262 | .AppleDouble 263 | .LSOverride 264 | 265 | # Thumbnails 266 | ._* 267 | 268 | # Files that might appear in the root of a volume 269 | .DocumentRevisions-V100 270 | .fseventsd 271 | .Spotlight-V100 272 | .TemporaryItems 273 | .Trashes 274 | .VolumeIcon.icns 275 | 276 | # Directories potentially created on remote AFP share 277 | .AppleDB 278 | .AppleDesktop 279 | Network Trash Folder 280 | Temporary Items 281 | .apdisk 282 | 283 | # Windows 284 | # ========================= 285 | 286 | # Windows image file caches 287 | Thumbs.db 288 | ehthumbs.db 289 | 290 | # Folder config file 291 | Desktop.ini 292 | 293 | # Recycle Bin used on file shares 294 | $RECYCLE.BIN/ 295 | 296 | # Windows Installer files 297 | *.cab 298 | *.msi 299 | *.msm 300 | *.msp 301 | 302 | # Windows shortcuts 303 | *.lnk 304 | 305 | /GameClient/[Ll]ibrary/ 306 | /GameClient/[Tt]emp/ 307 | /GameClient/[Oo]bj/ 308 | /GameClient/[Bb]uild/ 309 | /GameClient/[Bb]uilds/ 310 | /GameClient/Assets/AssetStoreTools* 311 | 312 | # Visual Studio 2015 cache directory 313 | /.vs/ 314 | 315 | # Autogenerated VS/MD/Consulo solution and project files 316 | ExportedObj/ 317 | .consulo/ 318 | *.unityproj 319 | *.suo 320 | *.tmp 321 | *.user 322 | *.userprefs 323 | *.pidb 324 | *.booproj 325 | *.svd 326 | *.pdb 327 | 328 | 329 | # Unity3D generated meta files 330 | *.pidb.meta 331 | 332 | # Unity3D Generated File On Crash Reports 333 | sysinfo.txt 334 | 335 | # Builds 336 | *.apk 337 | *.unitypackage 338 | -------------------------------------------------------------------------------- /DataTransferObjects/DTOs/AuthRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace DataTransferObjects 7 | { 8 | public class AuthRequest : ISerializable 9 | { 10 | public string Name { get; set; } 11 | 12 | public void Deserialize(byte[] data) 13 | { 14 | using (MemoryStream m = new MemoryStream(data)) 15 | { 16 | using (BinaryReader reader = new BinaryReader(m)) 17 | { 18 | Name = reader.ReadString(); 19 | } 20 | } 21 | } 22 | 23 | public byte[] Serialize() 24 | { 25 | using (MemoryStream m = new MemoryStream()) 26 | { 27 | using (BinaryWriter writer = new BinaryWriter(m)) 28 | { 29 | writer.Write(Name); 30 | } 31 | return m.ToArray(); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DataTransferObjects/DTOs/ChatMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace DataTransferObjects 5 | { 6 | public class ChatMessage : ISerializable 7 | { 8 | public long SenderId; 9 | public string Message; 10 | 11 | public void Deserialize(byte[] data) 12 | { 13 | using (MemoryStream m = new MemoryStream(data)) 14 | { 15 | using (BinaryReader reader = new BinaryReader(m)) 16 | { 17 | SenderId = reader.ReadInt64(); 18 | Message = reader.ReadString(); 19 | } 20 | } 21 | } 22 | 23 | public byte[] Serialize() 24 | { 25 | using (MemoryStream m = new MemoryStream()) 26 | { 27 | using (BinaryWriter writer = new BinaryWriter(m)) 28 | { 29 | writer.Write(SenderId); 30 | writer.Write(Message); 31 | } 32 | return m.ToArray(); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /DataTransferObjects/DTOs/RemotePlayer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace DataTransferObjects 7 | { 8 | public class RemotePlayer : ISerializable 9 | { 10 | public long Id; 11 | public string Name; 12 | public bool Connected { get; set; } 13 | 14 | public void Deserialize(byte[] data) 15 | { 16 | using (MemoryStream m = new MemoryStream(data)) 17 | { 18 | using (BinaryReader reader = new BinaryReader(m)) 19 | { 20 | Id = reader.ReadInt64(); 21 | Name = reader.ReadString(); 22 | Connected = reader.ReadBoolean(); 23 | } 24 | } 25 | } 26 | 27 | public byte[] Serialize() 28 | { 29 | using (MemoryStream m = new MemoryStream()) 30 | { 31 | using (BinaryWriter writer = new BinaryWriter(m)) 32 | { 33 | writer.Write(Id); 34 | writer.Write(Name); 35 | writer.Write(Connected); 36 | } 37 | return m.ToArray(); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /DataTransferObjects/DataTransferObjects.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp1.1 5 | 6 | 7 | 8 | netcoreapp1.1 9 | 10 | 11 | 12 | .NETFramework 13 | v3.5 14 | Unity Subset v3.5 15 | 16 | 17 | 18 | .NETFramework 19 | v3.5 20 | Unity Subset v3.5 21 | 22 | 23 | 24 | echo "$(SolutionDir)DataTransferObjects\bin\DebugUnity\DataTransferObjects.dll" "$(SolutionDir)GameClient\Assets\Modules\" 25 | xcopy /Y "$(SolutionDir)DataTransferObjects\bin\DebugUnity\DataTransferObjects.dll" "$(SolutionDir)GameClient\Assets\Modules\DataTransferObjects.dll" 26 | 27 | 28 | -------------------------------------------------------------------------------- /DataTransferObjects/ISerializable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DataTransferObjects 6 | { 7 | public interface ISerializable 8 | { 9 | byte[] Serialize(); 10 | void Deserialize(byte[] data); 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /DataTransferObjects/MessageChannel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DataTransferObjects 6 | { 7 | public enum MessageChannel 8 | { 9 | Chat 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DataTransferObjects/Packet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace DataTransferObjects 7 | { 8 | public class Packet 9 | { 10 | public ISerializable SerializedData; 11 | public PacketType Type; 12 | 13 | public Packet(PacketType packetType, ISerializable data) 14 | { 15 | Type = packetType; 16 | SerializedData = data; 17 | } 18 | 19 | public byte[] SerializePacket() 20 | { 21 | using (MemoryStream m = new MemoryStream()) 22 | { 23 | using (BinaryWriter writer = new BinaryWriter(m)) 24 | { 25 | writer.Write((byte)Type); 26 | writer.Write(SerializedData.Serialize()); 27 | } 28 | return m.ToArray(); 29 | } 30 | } 31 | 32 | public static Packet Read(byte[] packet) 33 | { 34 | PacketType p; 35 | byte[] data; 36 | using (MemoryStream m = new MemoryStream(packet)) 37 | { 38 | using (BinaryReader reader = new BinaryReader(m)) 39 | { 40 | p = (PacketType)reader.ReadByte(); 41 | data = reader.ReadAllBytes(); 42 | } 43 | } 44 | 45 | ISerializable sData = GetSerializedData(p, data); 46 | 47 | if (sData == null) 48 | { 49 | throw new ArgumentException("Invalid Packet"); 50 | } 51 | 52 | return new Packet(p,sData); 53 | } 54 | 55 | static ISerializable GetSerializedData(PacketType packetType, byte[] data) 56 | { 57 | switch (packetType) 58 | { 59 | case PacketType.ChatMessage: 60 | var cm = new ChatMessage(); 61 | cm.Deserialize(data); 62 | return cm; 63 | case PacketType.AuthRequest: 64 | var id = new AuthRequest(); 65 | id.Deserialize(data); 66 | return id; 67 | case PacketType.RemotePlayer: 68 | var rp = new RemotePlayer(); 69 | rp.Deserialize(data); 70 | return rp; 71 | 72 | } 73 | return null; 74 | } 75 | } 76 | 77 | public static class BinaryReaderExtensions 78 | { 79 | public static byte[] ReadAllBytes(this BinaryReader reader) 80 | { 81 | const int bufferSize = 4096; 82 | using (var ms = new MemoryStream()) 83 | { 84 | byte[] buffer = new byte[bufferSize]; 85 | int count; 86 | while ((count = reader.Read(buffer, 0, buffer.Length)) != 0) 87 | ms.Write(buffer, 0, count); 88 | return ms.ToArray(); 89 | } 90 | } 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /DataTransferObjects/PacketType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DataTransferObjects 6 | { 7 | public enum PacketType 8 | { 9 | ChatMessage, 10 | AuthRequest, 11 | RemotePlayer 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /GameClient/Assets/Assemblies/Lidgren/Lidgren.Network.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sam2/NetCoreGameServer/d312fb5793fca93dd8ac7988bdff49d8f368aaa4/GameClient/Assets/Assemblies/Lidgren/Lidgren.Network.dll -------------------------------------------------------------------------------- /GameClient/Assets/Assemblies/Lidgren/Lidgren.Network.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sam2/NetCoreGameServer/d312fb5793fca93dd8ac7988bdff49d8f368aaa4/GameClient/Assets/Assemblies/Lidgren/Lidgren.Network.dll.mdb -------------------------------------------------------------------------------- /GameClient/Assets/ChatManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Assets 7 | { 8 | class ChatManager 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /GameClient/Assets/ClientTest.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Lidgren.Network; 3 | using DataTransferObjects; 4 | using System.Collections; 5 | 6 | public class ClientTest : MonoBehaviour { 7 | 8 | LidgrenClient m_Client; 9 | bool connected = false; 10 | // Use this for initialization 11 | 12 | void Awake() 13 | { 14 | m_Client = new LidgrenClient(); 15 | } 16 | 17 | IEnumerator Start () 18 | { 19 | yield return m_Client.Connect(); 20 | } 21 | 22 | // Update is called once per frame 23 | void Update () 24 | { 25 | m_Client.ReadMessages(); 26 | } 27 | 28 | public void SendChatMessage(string message) 29 | { 30 | Debug.Log("sending message " + message); 31 | var cm = new ChatMessage() { Message = message, SenderId = m_Client.Id }; 32 | 33 | var dto = new Packet(PacketType.ChatMessage, cm); 34 | 35 | m_Client.SendMessage(dto.SerializePacket(), NetDeliveryMethod.ReliableOrdered, MessageChannel.Chat); 36 | } 37 | 38 | void OnApplicationQuit() 39 | { 40 | m_Client.Disconnect(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /GameClient/Assets/LidgrenClient.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using Lidgren.Network; 4 | using DataTransferObjects; 5 | 6 | public delegate void ChatEventHandler(ChatMessage message); 7 | public delegate void RemotePlayerJoinedHandler(RemotePlayer player); 8 | public delegate void RemotePlayerLeftHandler(RemotePlayer player); 9 | 10 | public class LidgrenClient 11 | { 12 | private NetClient m_Client; 13 | private const string k_ServerAddress = "127.0.0.1"; 14 | private const int k_Port = 12345; 15 | 16 | public LidgrenClient() 17 | { 18 | var config = new NetPeerConfiguration("test"); 19 | config.ConnectionTimeout = 10; 20 | m_Client = new NetClient(config); 21 | } 22 | 23 | public bool Connected { get { return m_Client.ConnectionStatus == NetConnectionStatus.Connected; } } 24 | public long Id { get { return m_Client.UniqueIdentifier; } } 25 | 26 | public IEnumerator Connect() 27 | { 28 | m_Client.Start(); 29 | var hail = m_Client.CreateMessage(); 30 | AuthRequest id = new AuthRequest() 31 | { 32 | Name = "ClientTest" 33 | }; 34 | 35 | hail.Write(new Packet(PacketType.AuthRequest, id).SerializePacket()); 36 | m_Client.Connect(k_ServerAddress, k_Port, hail); 37 | Debug.Log("Connecting " + id.Name + " to " + k_ServerAddress + ":" + k_Port); 38 | 39 | NetConnectionStatus status = m_Client.ConnectionStatus; 40 | while(m_Client.ConnectionStatus != NetConnectionStatus.Disconnected) 41 | { 42 | if(m_Client.ConnectionStatus != status) 43 | { 44 | status = m_Client.ConnectionStatus; 45 | Debug.Log("Status: " + status); 46 | } 47 | yield return null; 48 | } 49 | } 50 | 51 | public void Disconnect() 52 | { 53 | m_Client.Disconnect("on quit"); 54 | } 55 | 56 | public void ReadMessages() 57 | { 58 | NetIncomingMessage message; 59 | 60 | while ((message = m_Client.ReadMessage()) != null) 61 | { 62 | if (message.MessageType == NetIncomingMessageType.Data) 63 | { 64 | var packet = Packet.Read(message.Data); 65 | switch (packet.Type) 66 | { 67 | case PacketType.ChatMessage: 68 | var cm = (ChatMessage)packet.SerializedData; 69 | Debug.Log(cm.SenderId + ": " + cm.Message); 70 | break; 71 | case PacketType.RemotePlayer: 72 | var rp = (RemotePlayer)packet.SerializedData; 73 | if(rp.Connected) Debug.Log("Player " + rp.Name + " (" + rp.Id + ") has joined the game."); 74 | else Debug.Log("Player " + rp.Name + " (" + rp.Id + ") has left the game."); 75 | break; 76 | } 77 | } 78 | } 79 | 80 | } 81 | 82 | public void SendMessage(byte[] data, NetDeliveryMethod method, MessageChannel channel) 83 | { 84 | var msg = m_Client.CreateMessage(); 85 | msg.Write(data); 86 | m_Client.SendMessage(msg, method, (int)channel); 87 | } 88 | 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /GameClient/Assets/Modules/DataTransferObjects.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sam2/NetCoreGameServer/d312fb5793fca93dd8ac7988bdff49d8f368aaa4/GameClient/Assets/Modules/DataTransferObjects.dll -------------------------------------------------------------------------------- /GameClient/Assets/SimpleJSON.cs: -------------------------------------------------------------------------------- 1 | //#define USE_SharpZipLib 2 | #if !UNITY_WEBPLAYER 3 | #define USE_FileIO 4 | #endif 5 | /* * * * * 6 | * A simple JSON Parser / builder 7 | * ------------------------------ 8 | * 9 | * It mainly has been written as a simple JSON parser. It can build a JSON string 10 | * from the node-tree, or generate a node tree from any valid JSON string. 11 | * 12 | * If you want to use compression when saving to file / stream / B64 you have to include 13 | * SharpZipLib ( http://www.icsharpcode.net/opensource/sharpziplib/ ) in your project and 14 | * define "USE_SharpZipLib" at the top of the file 15 | * 16 | * Written by Bunny83 17 | * 2012-06-09 18 | * 19 | * 20 | * Features / attributes: 21 | * - provides strongly typed node classes and lists / dictionaries 22 | * - provides easy access to class members / array items / data values 23 | * - the parser now properly identifies types. So generating JSON with this framework should work. 24 | * - only double quotes (") are used for quoting strings. 25 | * - provides "casting" properties to easily convert to / from those types: 26 | * int / float / double / bool 27 | * - provides a common interface for each node so no explicit casting is required. 28 | * - the parser tries to avoid errors, but if malformed JSON is parsed the result is more or less undefined 29 | * - It can serialize/deserialize a node tree into/from an experimental compact binary format. It might 30 | * be handy if you want to store things in a file and don't want it to be easily modifiable 31 | * 32 | * 33 | * 2012-12-17 Update: 34 | * - Added internal JSONLazyCreator class which simplifies the construction of a JSON tree 35 | * Now you can simple reference any item that doesn't exist yet and it will return a JSONLazyCreator 36 | * The class determines the required type by it's further use, creates the type and removes itself. 37 | * - Added binary serialization / deserialization. 38 | * - Added support for BZip2 zipped binary format. Requires the SharpZipLib ( http://www.icsharpcode.net/opensource/sharpziplib/ ) 39 | * The usage of the SharpZipLib library can be disabled by removing or commenting out the USE_SharpZipLib define at the top 40 | * - The serializer uses different types when it comes to store the values. Since my data values 41 | * are all of type string, the serializer will "try" which format fits best. The order is: int, float, double, bool, string. 42 | * It's not the most efficient way but for a moderate amount of data it should work on all platforms. 43 | * 44 | * 2017-03-08 Update: 45 | * - Optimised parsing by using a StringBuilder for token. This prevents performance issues when large 46 | * string data fields are contained in the json data. 47 | * - Finally refactored the badly named JSONClass into JSONObject. 48 | * - Replaced the old JSONData class by distict typed classes ( JSONString, JSONNumber, JSONBool, JSONNull ) this 49 | * allows to propertly convert the node tree back to json without type information loss. The actual value 50 | * parsing now happens at parsing time and not when you actually access one of the casting properties. 51 | * 52 | * The MIT License (MIT) 53 | * 54 | * Copyright (c) 2012-2017 Markus Göbel 55 | * 56 | * Permission is hereby granted, free of charge, to any person obtaining a copy 57 | * of this software and associated documentation files (the "Software"), to deal 58 | * in the Software without restriction, including without limitation the rights 59 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 60 | * copies of the Software, and to permit persons to whom the Software is 61 | * furnished to do so, subject to the following conditions: 62 | * 63 | * The above copyright notice and this permission notice shall be included in all 64 | * copies or substantial portions of the Software. 65 | * 66 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 67 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 68 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 69 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 70 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 71 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 72 | * SOFTWARE. 73 | * 74 | * * * * */ 75 | using System; 76 | using System.Collections; 77 | using System.Collections.Generic; 78 | using System.Linq; 79 | using System.Text; 80 | 81 | namespace SimpleJSON 82 | { 83 | public enum JSONNodeType 84 | { 85 | Array = 1, 86 | Object = 2, 87 | String = 3, 88 | Number = 4, 89 | NullValue = 5, 90 | Boolean = 6, 91 | None = 7, 92 | } 93 | 94 | public abstract partial class JSONNode 95 | { 96 | #region common interface 97 | 98 | public virtual JSONNode this[int aIndex] { get { return null; } set { } } 99 | 100 | public virtual JSONNode this[string aKey] { get { return null; } set { } } 101 | 102 | public virtual string Value { get { return ""; } set { } } 103 | 104 | public virtual int Count { get { return 0; } } 105 | 106 | public virtual bool IsNumber { get { return false; } } 107 | public virtual bool IsString { get { return false; } } 108 | public virtual bool IsBoolean { get { return false; } } 109 | public virtual bool IsNull { get { return false; } } 110 | public virtual bool IsArray { get { return false; } } 111 | public virtual bool IsObject { get { return false; } } 112 | 113 | public virtual void Add(string aKey, JSONNode aItem) 114 | { 115 | } 116 | public virtual void Add(JSONNode aItem) 117 | { 118 | Add("", aItem); 119 | } 120 | 121 | public virtual JSONNode Remove(string aKey) 122 | { 123 | return null; 124 | } 125 | 126 | public virtual JSONNode Remove(int aIndex) 127 | { 128 | return null; 129 | } 130 | 131 | public virtual JSONNode Remove(JSONNode aNode) 132 | { 133 | return aNode; 134 | } 135 | 136 | public virtual IEnumerable Children 137 | { 138 | get 139 | { 140 | yield break; 141 | } 142 | } 143 | 144 | public IEnumerable DeepChildren 145 | { 146 | get 147 | { 148 | foreach (var C in Children) 149 | foreach (var D in C.DeepChildren) 150 | yield return D; 151 | } 152 | } 153 | 154 | public override string ToString() 155 | { 156 | return "JSONNode"; 157 | } 158 | 159 | public virtual string ToString(string aIndent) 160 | { 161 | return ToString(aIndent, ""); 162 | } 163 | 164 | internal abstract string ToString(string aIndent, string aPrefix); 165 | 166 | #endregion common interface 167 | 168 | #region typecasting properties 169 | 170 | public abstract JSONNodeType Tag { get; } 171 | 172 | public virtual double AsDouble 173 | { 174 | get 175 | { 176 | double v = 0.0; 177 | if (double.TryParse(Value, out v)) 178 | return v; 179 | return 0.0; 180 | } 181 | set 182 | { 183 | Value = value.ToString(); 184 | } 185 | } 186 | 187 | public virtual int AsInt 188 | { 189 | get { return (int)AsDouble; } 190 | set { AsDouble = value; } 191 | } 192 | 193 | public virtual float AsFloat 194 | { 195 | get { return (float)AsDouble; } 196 | set { AsDouble = value; } 197 | } 198 | 199 | public virtual bool AsBool 200 | { 201 | get 202 | { 203 | bool v = false; 204 | if (bool.TryParse(Value, out v)) 205 | return v; 206 | return !string.IsNullOrEmpty(Value); 207 | } 208 | set 209 | { 210 | Value = (value) ? "true" : "false"; 211 | } 212 | } 213 | 214 | public virtual JSONArray AsArray 215 | { 216 | get 217 | { 218 | return this as JSONArray; 219 | } 220 | } 221 | 222 | public virtual JSONObject AsObject 223 | { 224 | get 225 | { 226 | return this as JSONObject; 227 | } 228 | } 229 | 230 | 231 | #endregion typecasting properties 232 | 233 | #region operators 234 | 235 | public static implicit operator JSONNode(string s) 236 | { 237 | return new JSONString(s); 238 | } 239 | public static implicit operator string(JSONNode d) 240 | { 241 | return (d == null) ? null : d.Value; 242 | } 243 | 244 | public static implicit operator JSONNode(double n) 245 | { 246 | return new JSONNumber(n); 247 | } 248 | public static implicit operator double(JSONNode d) 249 | { 250 | return (d == null) ? 0 : d.AsDouble; 251 | } 252 | 253 | public static implicit operator JSONNode(float n) 254 | { 255 | return new JSONNumber(n); 256 | } 257 | public static implicit operator float(JSONNode d) 258 | { 259 | return (d == null) ? 0 : d.AsFloat; 260 | } 261 | 262 | public static implicit operator JSONNode(int n) 263 | { 264 | return new JSONNumber(n); 265 | } 266 | public static implicit operator int(JSONNode d) 267 | { 268 | return (d == null) ? 0 : d.AsInt; 269 | } 270 | 271 | public static implicit operator JSONNode(bool b) 272 | { 273 | return new JSONBool(b); 274 | } 275 | public static implicit operator bool(JSONNode d) 276 | { 277 | return (d == null) ? false : d.AsBool; 278 | } 279 | 280 | public static bool operator ==(JSONNode a, object b) 281 | { 282 | if (ReferenceEquals(a, b)) 283 | return true; 284 | bool aIsNull = a is JSONNull || ReferenceEquals(a, null) || a is JSONLazyCreator; 285 | bool bIsNull = b is JSONNull || ReferenceEquals(b, null) || b is JSONLazyCreator; 286 | return (aIsNull && bIsNull); 287 | } 288 | 289 | public static bool operator !=(JSONNode a, object b) 290 | { 291 | return !(a == b); 292 | } 293 | 294 | public override bool Equals(object obj) 295 | { 296 | return System.Object.ReferenceEquals(this, obj); 297 | } 298 | 299 | public override int GetHashCode() 300 | { 301 | return base.GetHashCode(); 302 | } 303 | 304 | #endregion operators 305 | internal static StringBuilder m_EscapeBuilder = new StringBuilder(); 306 | internal static string Escape(string aText) 307 | { 308 | m_EscapeBuilder.Length = 0; 309 | if (m_EscapeBuilder.Capacity < aText.Length + aText.Length / 10) 310 | m_EscapeBuilder.Capacity = aText.Length + aText.Length / 10; 311 | foreach (char c in aText) 312 | { 313 | switch (c) 314 | { 315 | case '\\': 316 | m_EscapeBuilder.Append("\\\\"); 317 | break; 318 | case '\"': 319 | m_EscapeBuilder.Append("\\\""); 320 | break; 321 | case '\n': 322 | m_EscapeBuilder.Append("\\n"); 323 | break; 324 | case '\r': 325 | m_EscapeBuilder.Append("\\r"); 326 | break; 327 | case '\t': 328 | m_EscapeBuilder.Append("\\t"); 329 | break; 330 | case '\b': 331 | m_EscapeBuilder.Append("\\b"); 332 | break; 333 | case '\f': 334 | m_EscapeBuilder.Append("\\f"); 335 | break; 336 | default: 337 | m_EscapeBuilder.Append(c); 338 | break; 339 | } 340 | } 341 | string result = m_EscapeBuilder.ToString(); 342 | m_EscapeBuilder.Length = 0; 343 | return result; 344 | } 345 | 346 | static void ParseElement(JSONNode ctx, string token, string tokenName, bool quoted) 347 | { 348 | if (quoted) 349 | { 350 | ctx.Add(tokenName, token); 351 | return; 352 | } 353 | string tmp = token.ToLower(); 354 | if (tmp == "false" || tmp == "true") 355 | ctx.Add(tokenName, tmp == "true"); 356 | else if (tmp == "null") 357 | ctx.Add(tokenName, null); 358 | else 359 | { 360 | double val; 361 | if (double.TryParse(token, out val)) 362 | ctx.Add(tokenName, val); 363 | else 364 | ctx.Add(tokenName, token); 365 | } 366 | } 367 | 368 | public static JSONNode Parse(string aJSON) 369 | { 370 | Stack stack = new Stack(); 371 | JSONNode ctx = null; 372 | int i = 0; 373 | StringBuilder Token = new StringBuilder(); 374 | string TokenName = ""; 375 | bool QuoteMode = false; 376 | bool TokenIsQuoted = false; 377 | while (i < aJSON.Length) 378 | { 379 | switch (aJSON[i]) 380 | { 381 | case '{': 382 | if (QuoteMode) 383 | { 384 | Token.Append(aJSON[i]); 385 | break; 386 | } 387 | stack.Push(new JSONObject()); 388 | if (ctx != null) 389 | { 390 | ctx.Add(TokenName, stack.Peek()); 391 | } 392 | TokenName = ""; 393 | Token.Length = 0; 394 | ctx = stack.Peek(); 395 | break; 396 | 397 | case '[': 398 | if (QuoteMode) 399 | { 400 | Token.Append(aJSON[i]); 401 | break; 402 | } 403 | 404 | stack.Push(new JSONArray()); 405 | if (ctx != null) 406 | { 407 | ctx.Add(TokenName, stack.Peek()); 408 | } 409 | TokenName = ""; 410 | Token.Length = 0; 411 | ctx = stack.Peek(); 412 | break; 413 | 414 | case '}': 415 | case ']': 416 | if (QuoteMode) 417 | { 418 | 419 | Token.Append(aJSON[i]); 420 | break; 421 | } 422 | if (stack.Count == 0) 423 | throw new Exception("JSON Parse: Too many closing brackets"); 424 | 425 | stack.Pop(); 426 | if (Token.Length > 0) 427 | { 428 | ParseElement(ctx, Token.ToString(), TokenName, TokenIsQuoted); 429 | TokenIsQuoted = false; 430 | } 431 | TokenName = ""; 432 | Token.Length = 0; 433 | if (stack.Count > 0) 434 | ctx = stack.Peek(); 435 | break; 436 | 437 | case ':': 438 | if (QuoteMode) 439 | { 440 | Token.Append(aJSON[i]); 441 | break; 442 | } 443 | TokenName = Token.ToString().Trim(); 444 | Token.Length = 0; 445 | TokenIsQuoted = false; 446 | break; 447 | 448 | case '"': 449 | QuoteMode ^= true; 450 | TokenIsQuoted |= QuoteMode; 451 | break; 452 | 453 | case ',': 454 | if (QuoteMode) 455 | { 456 | Token.Append(aJSON[i]); 457 | break; 458 | } 459 | if (Token.Length > 0) 460 | { 461 | ParseElement(ctx, Token.ToString(), TokenName, TokenIsQuoted); 462 | TokenIsQuoted = false; 463 | } 464 | TokenName = ""; 465 | Token.Length = 0; 466 | TokenIsQuoted = false; 467 | break; 468 | 469 | case '\r': 470 | case '\n': 471 | break; 472 | 473 | case ' ': 474 | case '\t': 475 | if (QuoteMode) 476 | Token.Append(aJSON[i]); 477 | break; 478 | 479 | case '\\': 480 | ++i; 481 | if (QuoteMode) 482 | { 483 | char C = aJSON[i]; 484 | switch (C) 485 | { 486 | case 't': 487 | Token.Append('\t'); 488 | break; 489 | case 'r': 490 | Token.Append('\r'); 491 | break; 492 | case 'n': 493 | Token.Append('\n'); 494 | break; 495 | case 'b': 496 | Token.Append('\b'); 497 | break; 498 | case 'f': 499 | Token.Append('\f'); 500 | break; 501 | case 'u': 502 | { 503 | string s = aJSON.Substring(i + 1, 4); 504 | Token.Append((char)int.Parse( 505 | s, 506 | System.Globalization.NumberStyles.AllowHexSpecifier)); 507 | i += 4; 508 | break; 509 | } 510 | default: 511 | Token.Append(C); 512 | break; 513 | } 514 | } 515 | break; 516 | 517 | default: 518 | Token.Append(aJSON[i]); 519 | break; 520 | } 521 | ++i; 522 | } 523 | if (QuoteMode) 524 | { 525 | throw new Exception("JSON Parse: Quotation marks seems to be messed up."); 526 | } 527 | return ctx; 528 | } 529 | 530 | public virtual void Serialize(System.IO.BinaryWriter aWriter) 531 | { 532 | } 533 | 534 | public void SaveToStream(System.IO.Stream aData) 535 | { 536 | var W = new System.IO.BinaryWriter(aData); 537 | Serialize(W); 538 | } 539 | 540 | #if USE_SharpZipLib 541 | public void SaveToCompressedStream(System.IO.Stream aData) 542 | { 543 | using (var gzipOut = new ICSharpCode.SharpZipLib.BZip2.BZip2OutputStream(aData)) 544 | { 545 | gzipOut.IsStreamOwner = false; 546 | SaveToStream(gzipOut); 547 | gzipOut.Close(); 548 | } 549 | } 550 | 551 | public void SaveToCompressedFile(string aFileName) 552 | { 553 | 554 | #if USE_FileIO 555 | System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); 556 | using(var F = System.IO.File.OpenWrite(aFileName)) 557 | { 558 | SaveToCompressedStream(F); 559 | } 560 | 561 | #else 562 | throw new Exception("Can't use File IO stuff in the webplayer"); 563 | #endif 564 | } 565 | public string SaveToCompressedBase64() 566 | { 567 | using (var stream = new System.IO.MemoryStream()) 568 | { 569 | SaveToCompressedStream(stream); 570 | stream.Position = 0; 571 | return System.Convert.ToBase64String(stream.ToArray()); 572 | } 573 | } 574 | 575 | #else 576 | public void SaveToCompressedStream(System.IO.Stream aData) 577 | { 578 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 579 | } 580 | 581 | public void SaveToCompressedFile(string aFileName) 582 | { 583 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 584 | } 585 | 586 | public string SaveToCompressedBase64() 587 | { 588 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 589 | } 590 | #endif 591 | 592 | public void SaveToFile(string aFileName) 593 | { 594 | #if USE_FileIO 595 | System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); 596 | using (var F = System.IO.File.OpenWrite(aFileName)) 597 | { 598 | SaveToStream(F); 599 | } 600 | #else 601 | throw new Exception ("Can't use File IO stuff in the webplayer"); 602 | #endif 603 | } 604 | 605 | public string SaveToBase64() 606 | { 607 | using (var stream = new System.IO.MemoryStream()) 608 | { 609 | SaveToStream(stream); 610 | stream.Position = 0; 611 | return System.Convert.ToBase64String(stream.ToArray()); 612 | } 613 | } 614 | 615 | public static JSONNode Deserialize(System.IO.BinaryReader aReader) 616 | { 617 | JSONNodeType type = (JSONNodeType)aReader.ReadByte(); 618 | switch (type) 619 | { 620 | case JSONNodeType.Array: 621 | { 622 | int count = aReader.ReadInt32(); 623 | JSONArray tmp = new JSONArray(); 624 | for (int i = 0; i < count; i++) 625 | tmp.Add(Deserialize(aReader)); 626 | return tmp; 627 | } 628 | case JSONNodeType.Object: 629 | { 630 | int count = aReader.ReadInt32(); 631 | JSONObject tmp = new JSONObject(); 632 | for (int i = 0; i < count; i++) 633 | { 634 | string key = aReader.ReadString(); 635 | var val = Deserialize(aReader); 636 | tmp.Add(key, val); 637 | } 638 | return tmp; 639 | } 640 | case JSONNodeType.String: 641 | { 642 | return new JSONString(aReader.ReadString()); 643 | } 644 | case JSONNodeType.Number: 645 | { 646 | return new JSONNumber(aReader.ReadDouble()); 647 | } 648 | case JSONNodeType.Boolean: 649 | { 650 | return new JSONBool(aReader.ReadBoolean()); 651 | } 652 | case JSONNodeType.NullValue: 653 | { 654 | return new JSONNull(); 655 | } 656 | default: 657 | { 658 | throw new Exception("Error deserializing JSON. Unknown tag: " + type); 659 | } 660 | } 661 | } 662 | 663 | #if USE_SharpZipLib 664 | public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) 665 | { 666 | var zin = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(aData); 667 | return LoadFromStream(zin); 668 | } 669 | public static JSONNode LoadFromCompressedFile(string aFileName) 670 | { 671 | #if USE_FileIO 672 | using(var F = System.IO.File.OpenRead(aFileName)) 673 | { 674 | return LoadFromCompressedStream(F); 675 | } 676 | #else 677 | throw new Exception("Can't use File IO stuff in the webplayer"); 678 | #endif 679 | } 680 | public static JSONNode LoadFromCompressedBase64(string aBase64) 681 | { 682 | var tmp = System.Convert.FromBase64String(aBase64); 683 | var stream = new System.IO.MemoryStream(tmp); 684 | stream.Position = 0; 685 | return LoadFromCompressedStream(stream); 686 | } 687 | #else 688 | public static JSONNode LoadFromCompressedFile(string aFileName) 689 | { 690 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 691 | } 692 | 693 | public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) 694 | { 695 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 696 | } 697 | 698 | public static JSONNode LoadFromCompressedBase64(string aBase64) 699 | { 700 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 701 | } 702 | #endif 703 | 704 | public static JSONNode LoadFromStream(System.IO.Stream aData) 705 | { 706 | using (var R = new System.IO.BinaryReader(aData)) 707 | { 708 | return Deserialize(R); 709 | } 710 | } 711 | 712 | public static JSONNode LoadFromFile(string aFileName) 713 | { 714 | #if USE_FileIO 715 | using (var F = System.IO.File.OpenRead(aFileName)) 716 | { 717 | return LoadFromStream(F); 718 | } 719 | #else 720 | throw new Exception ("Can't use File IO stuff in the webplayer"); 721 | #endif 722 | } 723 | 724 | public static JSONNode LoadFromBase64(string aBase64) 725 | { 726 | var tmp = System.Convert.FromBase64String(aBase64); 727 | var stream = new System.IO.MemoryStream(tmp); 728 | stream.Position = 0; 729 | return LoadFromStream(stream); 730 | } 731 | } 732 | // End of JSONNode 733 | 734 | public class JSONArray : JSONNode, IEnumerable 735 | { 736 | private List m_List = new List(); 737 | 738 | public override JSONNodeType Tag { get { return JSONNodeType.Array; } } 739 | public override bool IsArray { get { return true; } } 740 | 741 | 742 | 743 | public override JSONNode this[int aIndex] 744 | { 745 | get 746 | { 747 | if (aIndex < 0 || aIndex >= m_List.Count) 748 | return new JSONLazyCreator(this); 749 | return m_List[aIndex]; 750 | } 751 | set 752 | { 753 | if (value == null) 754 | value = new JSONNull(); 755 | if (aIndex < 0 || aIndex >= m_List.Count) 756 | m_List.Add(value); 757 | else 758 | m_List[aIndex] = value; 759 | } 760 | } 761 | 762 | public override JSONNode this[string aKey] 763 | { 764 | get { return new JSONLazyCreator(this); } 765 | set 766 | { 767 | if (value == null) 768 | value = new JSONNull(); 769 | m_List.Add(value); 770 | } 771 | } 772 | 773 | public override int Count 774 | { 775 | get { return m_List.Count; } 776 | } 777 | 778 | public override void Add(string aKey, JSONNode aItem) 779 | { 780 | if (aItem == null) 781 | aItem = new JSONNull(); 782 | m_List.Add(aItem); 783 | } 784 | 785 | public override JSONNode Remove(int aIndex) 786 | { 787 | if (aIndex < 0 || aIndex >= m_List.Count) 788 | return null; 789 | JSONNode tmp = m_List[aIndex]; 790 | m_List.RemoveAt(aIndex); 791 | return tmp; 792 | } 793 | 794 | public override JSONNode Remove(JSONNode aNode) 795 | { 796 | m_List.Remove(aNode); 797 | return aNode; 798 | } 799 | 800 | public override IEnumerable Children 801 | { 802 | get 803 | { 804 | foreach (JSONNode N in m_List) 805 | yield return N; 806 | } 807 | } 808 | 809 | public IEnumerator GetEnumerator() 810 | { 811 | foreach (JSONNode N in m_List) 812 | yield return N; 813 | } 814 | 815 | public override string ToString() 816 | { 817 | string result = "[ "; 818 | foreach (JSONNode N in m_List) 819 | { 820 | if (result.Length > 2) 821 | result += ", "; 822 | result += N.ToString(); 823 | } 824 | result += " ]"; 825 | return result; 826 | } 827 | 828 | internal override string ToString(string aIndent, string aPrefix) 829 | { 830 | string result = "[ "; 831 | foreach (JSONNode N in m_List) 832 | { 833 | if (result.Length > 3) 834 | result += ", "; 835 | result += "\n" + aPrefix + aIndent + N.ToString(aIndent, aPrefix + aIndent); 836 | } 837 | result += "\n" + aPrefix + "]"; 838 | return result; 839 | } 840 | 841 | public override void Serialize(System.IO.BinaryWriter aWriter) 842 | { 843 | aWriter.Write((byte)JSONNodeType.Array); 844 | aWriter.Write(m_List.Count); 845 | for (int i = 0; i < m_List.Count; i++) 846 | { 847 | m_List[i].Serialize(aWriter); 848 | } 849 | } 850 | } 851 | // End of JSONArray 852 | 853 | public class JSONObject : JSONNode, IEnumerable 854 | { 855 | private Dictionary m_Dict = new Dictionary(); 856 | 857 | public override JSONNodeType Tag { get { return JSONNodeType.Object; } } 858 | public override bool IsObject { get { return true; } } 859 | 860 | 861 | public override JSONNode this[string aKey] 862 | { 863 | get 864 | { 865 | if (m_Dict.ContainsKey(aKey)) 866 | return m_Dict[aKey]; 867 | else 868 | return new JSONLazyCreator(this, aKey); 869 | } 870 | set 871 | { 872 | if (value == null) 873 | value = new JSONNull(); 874 | if (m_Dict.ContainsKey(aKey)) 875 | m_Dict[aKey] = value; 876 | else 877 | m_Dict.Add(aKey, value); 878 | } 879 | } 880 | 881 | public override JSONNode this[int aIndex] 882 | { 883 | get 884 | { 885 | if (aIndex < 0 || aIndex >= m_Dict.Count) 886 | return null; 887 | return m_Dict.ElementAt(aIndex).Value; 888 | } 889 | set 890 | { 891 | if (value == null) 892 | value = new JSONNull(); 893 | if (aIndex < 0 || aIndex >= m_Dict.Count) 894 | return; 895 | string key = m_Dict.ElementAt(aIndex).Key; 896 | m_Dict[key] = value; 897 | } 898 | } 899 | 900 | public override int Count 901 | { 902 | get { return m_Dict.Count; } 903 | } 904 | 905 | public override void Add(string aKey, JSONNode aItem) 906 | { 907 | if (aItem == null) 908 | aItem = new JSONNull(); 909 | 910 | if (!string.IsNullOrEmpty(aKey)) 911 | { 912 | if (m_Dict.ContainsKey(aKey)) 913 | m_Dict[aKey] = aItem; 914 | else 915 | m_Dict.Add(aKey, aItem); 916 | } 917 | else 918 | m_Dict.Add(Guid.NewGuid().ToString(), aItem); 919 | } 920 | 921 | public override JSONNode Remove(string aKey) 922 | { 923 | if (!m_Dict.ContainsKey(aKey)) 924 | return null; 925 | JSONNode tmp = m_Dict[aKey]; 926 | m_Dict.Remove(aKey); 927 | return tmp; 928 | } 929 | 930 | public override JSONNode Remove(int aIndex) 931 | { 932 | if (aIndex < 0 || aIndex >= m_Dict.Count) 933 | return null; 934 | var item = m_Dict.ElementAt(aIndex); 935 | m_Dict.Remove(item.Key); 936 | return item.Value; 937 | } 938 | 939 | public override JSONNode Remove(JSONNode aNode) 940 | { 941 | try 942 | { 943 | var item = m_Dict.Where(k => k.Value == aNode).First(); 944 | m_Dict.Remove(item.Key); 945 | return aNode; 946 | } 947 | catch 948 | { 949 | return null; 950 | } 951 | } 952 | 953 | public override IEnumerable Children 954 | { 955 | get 956 | { 957 | foreach (KeyValuePair N in m_Dict) 958 | yield return N.Value; 959 | } 960 | } 961 | 962 | public IEnumerator GetEnumerator() 963 | { 964 | foreach (KeyValuePair N in m_Dict) 965 | yield return N; 966 | } 967 | 968 | public override string ToString() 969 | { 970 | string result = "{"; 971 | foreach (KeyValuePair N in m_Dict) 972 | { 973 | if (result.Length > 2) 974 | result += ", "; 975 | result += "\"" + Escape(N.Key) + "\":" + N.Value.ToString(); 976 | } 977 | result += "}"; 978 | return result; 979 | } 980 | 981 | internal override string ToString(string aIndent, string aPrefix) 982 | { 983 | string result = "{ "; 984 | foreach (KeyValuePair N in m_Dict) 985 | { 986 | if (result.Length > 3) 987 | result += ", "; 988 | result += "\n" + aPrefix + aIndent + "\"" + Escape(N.Key) + "\" : "; 989 | result += N.Value.ToString(aIndent, aPrefix + aIndent); 990 | } 991 | result += "\n" + aPrefix + "}"; 992 | return result; 993 | } 994 | 995 | public override void Serialize(System.IO.BinaryWriter aWriter) 996 | { 997 | aWriter.Write((byte)JSONNodeType.Object); 998 | aWriter.Write(m_Dict.Count); 999 | foreach (string K in m_Dict.Keys) 1000 | { 1001 | aWriter.Write(K); 1002 | m_Dict[K].Serialize(aWriter); 1003 | } 1004 | } 1005 | } 1006 | // End of JSONObject 1007 | 1008 | public class JSONString : JSONNode 1009 | { 1010 | private string m_Data; 1011 | 1012 | public override JSONNodeType Tag { get { return JSONNodeType.String; } } 1013 | public override bool IsString { get { return true; } } 1014 | 1015 | public override string Value 1016 | { 1017 | get { return m_Data; } 1018 | set 1019 | { 1020 | m_Data = value; 1021 | } 1022 | } 1023 | 1024 | public JSONString(string aData) 1025 | { 1026 | m_Data = aData; 1027 | } 1028 | 1029 | public override string ToString() 1030 | { 1031 | return "\"" + Escape(m_Data) + "\""; 1032 | } 1033 | 1034 | internal override string ToString(string aIndent, string aPrefix) 1035 | { 1036 | return "\"" + Escape(m_Data) + "\""; 1037 | } 1038 | 1039 | public override void Serialize(System.IO.BinaryWriter aWriter) 1040 | { 1041 | aWriter.Write((byte)JSONNodeType.String); 1042 | aWriter.Write(m_Data); 1043 | } 1044 | } 1045 | // End of JSONString 1046 | 1047 | 1048 | public class JSONNumber : JSONNode 1049 | { 1050 | private double m_Data; 1051 | 1052 | public override JSONNodeType Tag { get { return JSONNodeType.Number; } } 1053 | public override bool IsNumber { get { return true; } } 1054 | 1055 | 1056 | public override string Value 1057 | { 1058 | get { return m_Data.ToString(); } 1059 | set 1060 | { 1061 | double v; 1062 | if (double.TryParse(value, out v)) 1063 | m_Data = v; 1064 | } 1065 | } 1066 | 1067 | public override double AsDouble 1068 | { 1069 | get { return m_Data; } 1070 | set { m_Data = value; } 1071 | } 1072 | 1073 | public JSONNumber(double aData) 1074 | { 1075 | m_Data = aData; 1076 | } 1077 | 1078 | public JSONNumber(string aData) 1079 | { 1080 | Value = aData; 1081 | } 1082 | 1083 | public override string ToString() 1084 | { 1085 | return m_Data.ToString(); 1086 | } 1087 | 1088 | internal override string ToString(string aIndent, string aPrefix) 1089 | { 1090 | return m_Data.ToString(); 1091 | } 1092 | 1093 | public override void Serialize(System.IO.BinaryWriter aWriter) 1094 | { 1095 | aWriter.Write((byte)JSONNodeType.Number); 1096 | aWriter.Write(m_Data); 1097 | } 1098 | } 1099 | // End of JSONNumber 1100 | 1101 | 1102 | public class JSONBool : JSONNode 1103 | { 1104 | private bool m_Data; 1105 | 1106 | public override JSONNodeType Tag { get { return JSONNodeType.Boolean; } } 1107 | public override bool IsBoolean { get { return true; } } 1108 | 1109 | 1110 | public override string Value 1111 | { 1112 | get { return m_Data.ToString(); } 1113 | set 1114 | { 1115 | bool v; 1116 | if (bool.TryParse(value, out v)) 1117 | m_Data = v; 1118 | } 1119 | } 1120 | public override bool AsBool 1121 | { 1122 | get { return m_Data; } 1123 | set { m_Data = value; } 1124 | } 1125 | 1126 | public JSONBool(bool aData) 1127 | { 1128 | m_Data = aData; 1129 | } 1130 | 1131 | public JSONBool(string aData) 1132 | { 1133 | Value = aData; 1134 | } 1135 | 1136 | public override string ToString() 1137 | { 1138 | return (m_Data) ? "true" : "false"; 1139 | } 1140 | 1141 | internal override string ToString(string aIndent, string aPrefix) 1142 | { 1143 | return (m_Data) ? "true" : "false"; 1144 | } 1145 | 1146 | public override void Serialize(System.IO.BinaryWriter aWriter) 1147 | { 1148 | aWriter.Write((byte)JSONNodeType.Boolean); 1149 | aWriter.Write(m_Data); 1150 | } 1151 | } 1152 | // End of JSONBool 1153 | 1154 | 1155 | public class JSONNull : JSONNode 1156 | { 1157 | 1158 | public override JSONNodeType Tag { get { return JSONNodeType.NullValue; } } 1159 | public override bool IsNull { get { return true; } } 1160 | 1161 | 1162 | public override string Value 1163 | { 1164 | get { return "null"; } 1165 | set { } 1166 | } 1167 | public override bool AsBool 1168 | { 1169 | get { return false; } 1170 | set { } 1171 | } 1172 | 1173 | public override string ToString() 1174 | { 1175 | return "null"; 1176 | } 1177 | 1178 | internal override string ToString(string aIndent, string aPrefix) 1179 | { 1180 | return "null"; 1181 | } 1182 | 1183 | public override bool Equals(object obj) 1184 | { 1185 | if (object.ReferenceEquals(this, obj)) 1186 | return true; 1187 | return (obj is JSONNull); 1188 | } 1189 | public override int GetHashCode() 1190 | { 1191 | return base.GetHashCode(); 1192 | } 1193 | 1194 | public override void Serialize(System.IO.BinaryWriter aWriter) 1195 | { 1196 | aWriter.Write((byte)JSONNodeType.NullValue); 1197 | } 1198 | } 1199 | // End of JSONNull 1200 | 1201 | internal class JSONLazyCreator : JSONNode 1202 | { 1203 | private JSONNode m_Node = null; 1204 | private string m_Key = null; 1205 | 1206 | public override JSONNodeType Tag { get { return JSONNodeType.None; } } 1207 | 1208 | public JSONLazyCreator(JSONNode aNode) 1209 | { 1210 | m_Node = aNode; 1211 | m_Key = null; 1212 | } 1213 | 1214 | public JSONLazyCreator(JSONNode aNode, string aKey) 1215 | { 1216 | m_Node = aNode; 1217 | m_Key = aKey; 1218 | } 1219 | 1220 | private void Set(JSONNode aVal) 1221 | { 1222 | if (m_Key == null) 1223 | { 1224 | m_Node.Add(aVal); 1225 | } 1226 | else 1227 | { 1228 | m_Node.Add(m_Key, aVal); 1229 | } 1230 | m_Node = null; // Be GC friendly. 1231 | } 1232 | 1233 | public override JSONNode this[int aIndex] 1234 | { 1235 | get 1236 | { 1237 | return new JSONLazyCreator(this); 1238 | } 1239 | set 1240 | { 1241 | var tmp = new JSONArray(); 1242 | tmp.Add(value); 1243 | Set(tmp); 1244 | } 1245 | } 1246 | 1247 | public override JSONNode this[string aKey] 1248 | { 1249 | get 1250 | { 1251 | return new JSONLazyCreator(this, aKey); 1252 | } 1253 | set 1254 | { 1255 | var tmp = new JSONObject(); 1256 | tmp.Add(aKey, value); 1257 | Set(tmp); 1258 | } 1259 | } 1260 | 1261 | public override void Add(JSONNode aItem) 1262 | { 1263 | var tmp = new JSONArray(); 1264 | tmp.Add(aItem); 1265 | Set(tmp); 1266 | } 1267 | 1268 | public override void Add(string aKey, JSONNode aItem) 1269 | { 1270 | var tmp = new JSONObject(); 1271 | tmp.Add(aKey, aItem); 1272 | Set(tmp); 1273 | } 1274 | 1275 | public static bool operator ==(JSONLazyCreator a, object b) 1276 | { 1277 | if (b == null) 1278 | return true; 1279 | return System.Object.ReferenceEquals(a, b); 1280 | } 1281 | 1282 | public static bool operator !=(JSONLazyCreator a, object b) 1283 | { 1284 | return !(a == b); 1285 | } 1286 | 1287 | public override bool Equals(object obj) 1288 | { 1289 | if (obj == null) 1290 | return true; 1291 | return System.Object.ReferenceEquals(this, obj); 1292 | } 1293 | 1294 | public override int GetHashCode() 1295 | { 1296 | return base.GetHashCode(); 1297 | } 1298 | 1299 | public override string ToString() 1300 | { 1301 | return ""; 1302 | } 1303 | 1304 | internal override string ToString(string aIndent, string aPrefix) 1305 | { 1306 | return ""; 1307 | } 1308 | 1309 | public override int AsInt 1310 | { 1311 | get 1312 | { 1313 | JSONNumber tmp = new JSONNumber(0); 1314 | Set(tmp); 1315 | return 0; 1316 | } 1317 | set 1318 | { 1319 | JSONNumber tmp = new JSONNumber(value); 1320 | Set(tmp); 1321 | } 1322 | } 1323 | 1324 | public override float AsFloat 1325 | { 1326 | get 1327 | { 1328 | JSONNumber tmp = new JSONNumber(0.0f); 1329 | Set(tmp); 1330 | return 0.0f; 1331 | } 1332 | set 1333 | { 1334 | JSONNumber tmp = new JSONNumber(value); 1335 | Set(tmp); 1336 | } 1337 | } 1338 | 1339 | public override double AsDouble 1340 | { 1341 | get 1342 | { 1343 | JSONNumber tmp = new JSONNumber(0.0); 1344 | Set(tmp); 1345 | return 0.0; 1346 | } 1347 | set 1348 | { 1349 | JSONNumber tmp = new JSONNumber(value); 1350 | Set(tmp); 1351 | } 1352 | } 1353 | 1354 | public override bool AsBool 1355 | { 1356 | get 1357 | { 1358 | JSONBool tmp = new JSONBool(false); 1359 | Set(tmp); 1360 | return false; 1361 | } 1362 | set 1363 | { 1364 | JSONBool tmp = new JSONBool(value); 1365 | Set(tmp); 1366 | } 1367 | } 1368 | 1369 | public override JSONArray AsArray 1370 | { 1371 | get 1372 | { 1373 | JSONArray tmp = new JSONArray(); 1374 | Set(tmp); 1375 | return tmp; 1376 | } 1377 | } 1378 | 1379 | public override JSONObject AsObject 1380 | { 1381 | get 1382 | { 1383 | JSONObject tmp = new JSONObject(); 1384 | Set(tmp); 1385 | return tmp; 1386 | } 1387 | } 1388 | } 1389 | // End of JSONLazyCreator 1390 | 1391 | public static class JSON 1392 | { 1393 | public static JSONNode Parse(string aJSON) 1394 | { 1395 | return JSONNode.Parse(aJSON); 1396 | } 1397 | } 1398 | } -------------------------------------------------------------------------------- /GameClient/Assets/main.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | SceneSettings: 5 | m_ObjectHideFlags: 0 6 | m_PVSData: 7 | m_PVSObjectsArray: [] 8 | m_PVSPortalsArray: [] 9 | m_OcclusionBakeSettings: 10 | smallestOccluder: 5 11 | smallestHole: 0.25 12 | backfaceThreshold: 100 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 7 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 29 | m_HaloStrength: 0.5 30 | m_FlareStrength: 1 31 | m_FlareFadeSpeed: 3 32 | m_HaloTexture: {fileID: 0} 33 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 34 | m_DefaultReflectionMode: 0 35 | m_DefaultReflectionResolution: 128 36 | m_ReflectionBounces: 1 37 | m_ReflectionIntensity: 1 38 | m_CustomReflection: {fileID: 0} 39 | m_Sun: {fileID: 0} 40 | m_IndirectSpecularColor: {r: 0.44692534, g: 0.4967872, b: 0.57508564, a: 1} 41 | --- !u!157 &3 42 | LightmapSettings: 43 | m_ObjectHideFlags: 0 44 | serializedVersion: 7 45 | m_GIWorkflowMode: 0 46 | m_GISettings: 47 | serializedVersion: 2 48 | m_BounceScale: 1 49 | m_IndirectOutputScale: 1 50 | m_AlbedoBoost: 1 51 | m_TemporalCoherenceThreshold: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 1 54 | m_EnableRealtimeLightmaps: 1 55 | m_LightmapEditorSettings: 56 | serializedVersion: 4 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_TextureWidth: 1024 60 | m_TextureHeight: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_Padding: 2 66 | m_LightmapParameters: {fileID: 0} 67 | m_LightmapsBakeMode: 1 68 | m_TextureCompression: 1 69 | m_DirectLightInLightProbes: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_LightingDataAsset: {fileID: 0} 75 | m_RuntimeCPUUsage: 25 76 | --- !u!196 &4 77 | NavMeshSettings: 78 | serializedVersion: 2 79 | m_ObjectHideFlags: 0 80 | m_BuildSettings: 81 | serializedVersion: 2 82 | agentRadius: 0.5 83 | agentHeight: 2 84 | agentSlope: 45 85 | agentClimb: 0.4 86 | ledgeDropHeight: 0 87 | maxJumpAcrossDistance: 0 88 | accuratePlacement: 0 89 | minRegionArea: 2 90 | cellSize: 0.16666667 91 | manualCellSize: 0 92 | m_NavMeshData: {fileID: 0} 93 | --- !u!1 &325349511 94 | GameObject: 95 | m_ObjectHideFlags: 0 96 | m_PrefabParentObject: {fileID: 0} 97 | m_PrefabInternal: {fileID: 0} 98 | serializedVersion: 4 99 | m_Component: 100 | - 224: {fileID: 325349512} 101 | - 222: {fileID: 325349514} 102 | - 114: {fileID: 325349513} 103 | m_Layer: 5 104 | m_Name: Text 105 | m_TagString: Untagged 106 | m_Icon: {fileID: 0} 107 | m_NavMeshLayer: 0 108 | m_StaticEditorFlags: 0 109 | m_IsActive: 1 110 | --- !u!224 &325349512 111 | RectTransform: 112 | m_ObjectHideFlags: 0 113 | m_PrefabParentObject: {fileID: 0} 114 | m_PrefabInternal: {fileID: 0} 115 | m_GameObject: {fileID: 325349511} 116 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 117 | m_LocalPosition: {x: 0, y: 0, z: 0} 118 | m_LocalScale: {x: 1, y: 1, z: 1} 119 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 120 | m_Children: [] 121 | m_Father: {fileID: 2127102796} 122 | m_RootOrder: 0 123 | m_AnchorMin: {x: 0, y: 0} 124 | m_AnchorMax: {x: 1, y: 1} 125 | m_AnchoredPosition: {x: 0, y: 0} 126 | m_SizeDelta: {x: 0, y: 0} 127 | m_Pivot: {x: 0.5, y: 0.5} 128 | --- !u!114 &325349513 129 | MonoBehaviour: 130 | m_ObjectHideFlags: 0 131 | m_PrefabParentObject: {fileID: 0} 132 | m_PrefabInternal: {fileID: 0} 133 | m_GameObject: {fileID: 325349511} 134 | m_Enabled: 1 135 | m_EditorHideFlags: 0 136 | m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 137 | m_Name: 138 | m_EditorClassIdentifier: 139 | m_Material: {fileID: 0} 140 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 141 | m_RaycastTarget: 1 142 | m_OnCullStateChanged: 143 | m_PersistentCalls: 144 | m_Calls: [] 145 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 146 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 147 | m_FontData: 148 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 149 | m_FontSize: 14 150 | m_FontStyle: 0 151 | m_BestFit: 0 152 | m_MinSize: 10 153 | m_MaxSize: 40 154 | m_Alignment: 4 155 | m_AlignByGeometry: 0 156 | m_RichText: 1 157 | m_HorizontalOverflow: 0 158 | m_VerticalOverflow: 0 159 | m_LineSpacing: 1 160 | m_Text: Button 161 | --- !u!222 &325349514 162 | CanvasRenderer: 163 | m_ObjectHideFlags: 0 164 | m_PrefabParentObject: {fileID: 0} 165 | m_PrefabInternal: {fileID: 0} 166 | m_GameObject: {fileID: 325349511} 167 | --- !u!1 &1715958100 168 | GameObject: 169 | m_ObjectHideFlags: 0 170 | m_PrefabParentObject: {fileID: 0} 171 | m_PrefabInternal: {fileID: 0} 172 | serializedVersion: 4 173 | m_Component: 174 | - 224: {fileID: 1715958104} 175 | - 223: {fileID: 1715958103} 176 | - 114: {fileID: 1715958102} 177 | - 114: {fileID: 1715958101} 178 | m_Layer: 5 179 | m_Name: Canvas 180 | m_TagString: Untagged 181 | m_Icon: {fileID: 0} 182 | m_NavMeshLayer: 0 183 | m_StaticEditorFlags: 0 184 | m_IsActive: 1 185 | --- !u!114 &1715958101 186 | MonoBehaviour: 187 | m_ObjectHideFlags: 0 188 | m_PrefabParentObject: {fileID: 0} 189 | m_PrefabInternal: {fileID: 0} 190 | m_GameObject: {fileID: 1715958100} 191 | m_Enabled: 1 192 | m_EditorHideFlags: 0 193 | m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 194 | m_Name: 195 | m_EditorClassIdentifier: 196 | m_IgnoreReversedGraphics: 1 197 | m_BlockingObjects: 0 198 | m_BlockingMask: 199 | serializedVersion: 2 200 | m_Bits: 4294967295 201 | --- !u!114 &1715958102 202 | MonoBehaviour: 203 | m_ObjectHideFlags: 0 204 | m_PrefabParentObject: {fileID: 0} 205 | m_PrefabInternal: {fileID: 0} 206 | m_GameObject: {fileID: 1715958100} 207 | m_Enabled: 1 208 | m_EditorHideFlags: 0 209 | m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 210 | m_Name: 211 | m_EditorClassIdentifier: 212 | m_UiScaleMode: 0 213 | m_ReferencePixelsPerUnit: 100 214 | m_ScaleFactor: 1 215 | m_ReferenceResolution: {x: 800, y: 600} 216 | m_ScreenMatchMode: 0 217 | m_MatchWidthOrHeight: 0 218 | m_PhysicalUnit: 3 219 | m_FallbackScreenDPI: 96 220 | m_DefaultSpriteDPI: 96 221 | m_DynamicPixelsPerUnit: 1 222 | --- !u!223 &1715958103 223 | Canvas: 224 | m_ObjectHideFlags: 0 225 | m_PrefabParentObject: {fileID: 0} 226 | m_PrefabInternal: {fileID: 0} 227 | m_GameObject: {fileID: 1715958100} 228 | m_Enabled: 1 229 | serializedVersion: 2 230 | m_RenderMode: 0 231 | m_Camera: {fileID: 0} 232 | m_PlaneDistance: 100 233 | m_PixelPerfect: 0 234 | m_ReceivesEvents: 1 235 | m_OverrideSorting: 0 236 | m_OverridePixelPerfect: 0 237 | m_SortingBucketNormalizedSize: 0 238 | m_SortingLayerID: 0 239 | m_SortingOrder: 0 240 | m_TargetDisplay: 0 241 | --- !u!224 &1715958104 242 | RectTransform: 243 | m_ObjectHideFlags: 0 244 | m_PrefabParentObject: {fileID: 0} 245 | m_PrefabInternal: {fileID: 0} 246 | m_GameObject: {fileID: 1715958100} 247 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 248 | m_LocalPosition: {x: 0, y: 0, z: 0} 249 | m_LocalScale: {x: 0, y: 0, z: 0} 250 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 251 | m_Children: 252 | - {fileID: 2127102796} 253 | m_Father: {fileID: 0} 254 | m_RootOrder: 2 255 | m_AnchorMin: {x: 0, y: 0} 256 | m_AnchorMax: {x: 0, y: 0} 257 | m_AnchoredPosition: {x: 0, y: 0} 258 | m_SizeDelta: {x: 0, y: 0} 259 | m_Pivot: {x: 0, y: 0} 260 | --- !u!1 &1849114409 261 | GameObject: 262 | m_ObjectHideFlags: 0 263 | m_PrefabParentObject: {fileID: 0} 264 | m_PrefabInternal: {fileID: 0} 265 | serializedVersion: 4 266 | m_Component: 267 | - 4: {fileID: 1849114415} 268 | - 20: {fileID: 1849114414} 269 | - 92: {fileID: 1849114413} 270 | - 124: {fileID: 1849114412} 271 | - 81: {fileID: 1849114411} 272 | - 114: {fileID: 1849114410} 273 | m_Layer: 0 274 | m_Name: Main Camera 275 | m_TagString: MainCamera 276 | m_Icon: {fileID: 0} 277 | m_NavMeshLayer: 0 278 | m_StaticEditorFlags: 0 279 | m_IsActive: 1 280 | --- !u!114 &1849114410 281 | MonoBehaviour: 282 | m_ObjectHideFlags: 0 283 | m_PrefabParentObject: {fileID: 0} 284 | m_PrefabInternal: {fileID: 0} 285 | m_GameObject: {fileID: 1849114409} 286 | m_Enabled: 1 287 | m_EditorHideFlags: 0 288 | m_Script: {fileID: 11500000, guid: b61e97a1682d9ec41a913839c498d3f2, type: 3} 289 | m_Name: 290 | m_EditorClassIdentifier: 291 | --- !u!81 &1849114411 292 | AudioListener: 293 | m_ObjectHideFlags: 0 294 | m_PrefabParentObject: {fileID: 0} 295 | m_PrefabInternal: {fileID: 0} 296 | m_GameObject: {fileID: 1849114409} 297 | m_Enabled: 1 298 | --- !u!124 &1849114412 299 | Behaviour: 300 | m_ObjectHideFlags: 0 301 | m_PrefabParentObject: {fileID: 0} 302 | m_PrefabInternal: {fileID: 0} 303 | m_GameObject: {fileID: 1849114409} 304 | m_Enabled: 1 305 | --- !u!92 &1849114413 306 | Behaviour: 307 | m_ObjectHideFlags: 0 308 | m_PrefabParentObject: {fileID: 0} 309 | m_PrefabInternal: {fileID: 0} 310 | m_GameObject: {fileID: 1849114409} 311 | m_Enabled: 1 312 | --- !u!20 &1849114414 313 | Camera: 314 | m_ObjectHideFlags: 0 315 | m_PrefabParentObject: {fileID: 0} 316 | m_PrefabInternal: {fileID: 0} 317 | m_GameObject: {fileID: 1849114409} 318 | m_Enabled: 1 319 | serializedVersion: 2 320 | m_ClearFlags: 1 321 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 322 | m_NormalizedViewPortRect: 323 | serializedVersion: 2 324 | x: 0 325 | y: 0 326 | width: 1 327 | height: 1 328 | near clip plane: 0.3 329 | far clip plane: 1000 330 | field of view: 60 331 | orthographic: 0 332 | orthographic size: 5 333 | m_Depth: -1 334 | m_CullingMask: 335 | serializedVersion: 2 336 | m_Bits: 4294967295 337 | m_RenderingPath: -1 338 | m_TargetTexture: {fileID: 0} 339 | m_TargetDisplay: 0 340 | m_TargetEye: 3 341 | m_HDR: 0 342 | m_OcclusionCulling: 1 343 | m_StereoConvergence: 10 344 | m_StereoSeparation: 0.022 345 | m_StereoMirrorMode: 0 346 | --- !u!4 &1849114415 347 | Transform: 348 | m_ObjectHideFlags: 0 349 | m_PrefabParentObject: {fileID: 0} 350 | m_PrefabInternal: {fileID: 0} 351 | m_GameObject: {fileID: 1849114409} 352 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 353 | m_LocalPosition: {x: 0, y: 1, z: -10} 354 | m_LocalScale: {x: 1, y: 1, z: 1} 355 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 356 | m_Children: [] 357 | m_Father: {fileID: 0} 358 | m_RootOrder: 0 359 | --- !u!1 &1927130867 360 | GameObject: 361 | m_ObjectHideFlags: 0 362 | m_PrefabParentObject: {fileID: 0} 363 | m_PrefabInternal: {fileID: 0} 364 | serializedVersion: 4 365 | m_Component: 366 | - 4: {fileID: 1927130870} 367 | - 114: {fileID: 1927130869} 368 | - 114: {fileID: 1927130868} 369 | m_Layer: 0 370 | m_Name: EventSystem 371 | m_TagString: Untagged 372 | m_Icon: {fileID: 0} 373 | m_NavMeshLayer: 0 374 | m_StaticEditorFlags: 0 375 | m_IsActive: 1 376 | --- !u!114 &1927130868 377 | MonoBehaviour: 378 | m_ObjectHideFlags: 0 379 | m_PrefabParentObject: {fileID: 0} 380 | m_PrefabInternal: {fileID: 0} 381 | m_GameObject: {fileID: 1927130867} 382 | m_Enabled: 1 383 | m_EditorHideFlags: 0 384 | m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 385 | m_Name: 386 | m_EditorClassIdentifier: 387 | m_HorizontalAxis: Horizontal 388 | m_VerticalAxis: Vertical 389 | m_SubmitButton: Submit 390 | m_CancelButton: Cancel 391 | m_InputActionsPerSecond: 10 392 | m_RepeatDelay: 0.5 393 | m_ForceModuleActive: 0 394 | --- !u!114 &1927130869 395 | MonoBehaviour: 396 | m_ObjectHideFlags: 0 397 | m_PrefabParentObject: {fileID: 0} 398 | m_PrefabInternal: {fileID: 0} 399 | m_GameObject: {fileID: 1927130867} 400 | m_Enabled: 1 401 | m_EditorHideFlags: 0 402 | m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 403 | m_Name: 404 | m_EditorClassIdentifier: 405 | m_FirstSelected: {fileID: 0} 406 | m_sendNavigationEvents: 1 407 | m_DragThreshold: 5 408 | --- !u!4 &1927130870 409 | Transform: 410 | m_ObjectHideFlags: 0 411 | m_PrefabParentObject: {fileID: 0} 412 | m_PrefabInternal: {fileID: 0} 413 | m_GameObject: {fileID: 1927130867} 414 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 415 | m_LocalPosition: {x: 0, y: 0, z: 0} 416 | m_LocalScale: {x: 1, y: 1, z: 1} 417 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 418 | m_Children: [] 419 | m_Father: {fileID: 0} 420 | m_RootOrder: 3 421 | --- !u!1 &2064787034 422 | GameObject: 423 | m_ObjectHideFlags: 0 424 | m_PrefabParentObject: {fileID: 0} 425 | m_PrefabInternal: {fileID: 0} 426 | serializedVersion: 4 427 | m_Component: 428 | - 4: {fileID: 2064787036} 429 | - 108: {fileID: 2064787035} 430 | m_Layer: 0 431 | m_Name: Directional Light 432 | m_TagString: Untagged 433 | m_Icon: {fileID: 0} 434 | m_NavMeshLayer: 0 435 | m_StaticEditorFlags: 0 436 | m_IsActive: 1 437 | --- !u!108 &2064787035 438 | Light: 439 | m_ObjectHideFlags: 0 440 | m_PrefabParentObject: {fileID: 0} 441 | m_PrefabInternal: {fileID: 0} 442 | m_GameObject: {fileID: 2064787034} 443 | m_Enabled: 1 444 | serializedVersion: 7 445 | m_Type: 1 446 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 447 | m_Intensity: 1 448 | m_Range: 10 449 | m_SpotAngle: 30 450 | m_CookieSize: 10 451 | m_Shadows: 452 | m_Type: 2 453 | m_Resolution: -1 454 | m_CustomResolution: -1 455 | m_Strength: 1 456 | m_Bias: 0.05 457 | m_NormalBias: 0.4 458 | m_NearPlane: 0.2 459 | m_Cookie: {fileID: 0} 460 | m_DrawHalo: 0 461 | m_Flare: {fileID: 0} 462 | m_RenderMode: 0 463 | m_CullingMask: 464 | serializedVersion: 2 465 | m_Bits: 4294967295 466 | m_Lightmapping: 4 467 | m_AreaSize: {x: 1, y: 1} 468 | m_BounceIntensity: 1 469 | m_ShadowRadius: 0 470 | m_ShadowAngle: 0 471 | --- !u!4 &2064787036 472 | Transform: 473 | m_ObjectHideFlags: 0 474 | m_PrefabParentObject: {fileID: 0} 475 | m_PrefabInternal: {fileID: 0} 476 | m_GameObject: {fileID: 2064787034} 477 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 478 | m_LocalPosition: {x: 0, y: 3, z: 0} 479 | m_LocalScale: {x: 1, y: 1, z: 1} 480 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 481 | m_Children: [] 482 | m_Father: {fileID: 0} 483 | m_RootOrder: 1 484 | --- !u!1 &2127102795 485 | GameObject: 486 | m_ObjectHideFlags: 0 487 | m_PrefabParentObject: {fileID: 0} 488 | m_PrefabInternal: {fileID: 0} 489 | serializedVersion: 4 490 | m_Component: 491 | - 224: {fileID: 2127102796} 492 | - 222: {fileID: 2127102799} 493 | - 114: {fileID: 2127102798} 494 | - 114: {fileID: 2127102797} 495 | m_Layer: 5 496 | m_Name: Button 497 | m_TagString: Untagged 498 | m_Icon: {fileID: 0} 499 | m_NavMeshLayer: 0 500 | m_StaticEditorFlags: 0 501 | m_IsActive: 1 502 | --- !u!224 &2127102796 503 | RectTransform: 504 | m_ObjectHideFlags: 0 505 | m_PrefabParentObject: {fileID: 0} 506 | m_PrefabInternal: {fileID: 0} 507 | m_GameObject: {fileID: 2127102795} 508 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 509 | m_LocalPosition: {x: 0, y: 0, z: 0} 510 | m_LocalScale: {x: 1, y: 1, z: 1} 511 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 512 | m_Children: 513 | - {fileID: 325349512} 514 | m_Father: {fileID: 1715958104} 515 | m_RootOrder: 0 516 | m_AnchorMin: {x: 0.5, y: 0.5} 517 | m_AnchorMax: {x: 0.5, y: 0.5} 518 | m_AnchoredPosition: {x: -240, y: -225} 519 | m_SizeDelta: {x: 160, y: 30} 520 | m_Pivot: {x: 0.5, y: 0.5} 521 | --- !u!114 &2127102797 522 | MonoBehaviour: 523 | m_ObjectHideFlags: 0 524 | m_PrefabParentObject: {fileID: 0} 525 | m_PrefabInternal: {fileID: 0} 526 | m_GameObject: {fileID: 2127102795} 527 | m_Enabled: 1 528 | m_EditorHideFlags: 0 529 | m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 530 | m_Name: 531 | m_EditorClassIdentifier: 532 | m_Navigation: 533 | m_Mode: 3 534 | m_SelectOnUp: {fileID: 0} 535 | m_SelectOnDown: {fileID: 0} 536 | m_SelectOnLeft: {fileID: 0} 537 | m_SelectOnRight: {fileID: 0} 538 | m_Transition: 1 539 | m_Colors: 540 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 541 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 542 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 543 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 544 | m_ColorMultiplier: 1 545 | m_FadeDuration: 0.1 546 | m_SpriteState: 547 | m_HighlightedSprite: {fileID: 0} 548 | m_PressedSprite: {fileID: 0} 549 | m_DisabledSprite: {fileID: 0} 550 | m_AnimationTriggers: 551 | m_NormalTrigger: Normal 552 | m_HighlightedTrigger: Highlighted 553 | m_PressedTrigger: Pressed 554 | m_DisabledTrigger: Disabled 555 | m_Interactable: 1 556 | m_TargetGraphic: {fileID: 2127102798} 557 | m_OnClick: 558 | m_PersistentCalls: 559 | m_Calls: 560 | - m_Target: {fileID: 1849114410} 561 | m_MethodName: SendChatMessage 562 | m_Mode: 5 563 | m_Arguments: 564 | m_ObjectArgument: {fileID: 0} 565 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 566 | m_IntArgument: 0 567 | m_FloatArgument: 0 568 | m_StringArgument: test 569 | m_BoolArgument: 0 570 | m_CallState: 2 571 | m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, 572 | Culture=neutral, PublicKeyToken=null 573 | --- !u!114 &2127102798 574 | MonoBehaviour: 575 | m_ObjectHideFlags: 0 576 | m_PrefabParentObject: {fileID: 0} 577 | m_PrefabInternal: {fileID: 0} 578 | m_GameObject: {fileID: 2127102795} 579 | m_Enabled: 1 580 | m_EditorHideFlags: 0 581 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 582 | m_Name: 583 | m_EditorClassIdentifier: 584 | m_Material: {fileID: 0} 585 | m_Color: {r: 1, g: 1, b: 1, a: 1} 586 | m_RaycastTarget: 1 587 | m_OnCullStateChanged: 588 | m_PersistentCalls: 589 | m_Calls: [] 590 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 591 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 592 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 593 | m_Type: 1 594 | m_PreserveAspect: 0 595 | m_FillCenter: 1 596 | m_FillMethod: 4 597 | m_FillAmount: 1 598 | m_FillClockwise: 1 599 | m_FillOrigin: 0 600 | --- !u!222 &2127102799 601 | CanvasRenderer: 602 | m_ObjectHideFlags: 0 603 | m_PrefabParentObject: {fileID: 0} 604 | m_PrefabInternal: {fileID: 0} 605 | m_GameObject: {fileID: 2127102795} 606 | -------------------------------------------------------------------------------- /GameClient/GameClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | {BE4413C2-C6D9-E653-9119-676C36C93C18} 9 | Library 10 | Assembly-CSharp 11 | 512 12 | {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 13 | .NETFramework 14 | v3.5 15 | Unity Subset v3.5 16 | 17 | Game:1 18 | StandaloneWindows:5 19 | 5.4.0f3 20 | 21 | 4 22 | 23 | 24 | pdbonly 25 | false 26 | Temp\UnityVS_bin\Debug\ 27 | Temp\UnityVS_obj\Debug\ 28 | prompt 29 | 4 30 | DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_4_0;UNITY_5_4;UNITY_5;UNITY_ANALYTICS;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_EDITOR_RETINA;ENABLE_RETINA_GUISTYLES;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE;ENABLE_VSTU 31 | false 32 | 33 | 34 | pdbonly 35 | false 36 | Temp\UnityVS_bin\Release\ 37 | Temp\UnityVS_obj\Release\ 38 | prompt 39 | 4 40 | TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_4_0;UNITY_5_4;UNITY_5;UNITY_ANALYTICS;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_EDITOR_RETINA;ENABLE_RETINA_GUISTYLES;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE;ENABLE_VSTU 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Library\UnityAssemblies\UnityEngine.dll 54 | 55 | 56 | Library\UnityAssemblies\UnityEngine.UI.dll 57 | 58 | 59 | Library\UnityAssemblies\UnityEngine.Networking.dll 60 | 61 | 62 | Library\UnityAssemblies\UnityEngine.Analytics.dll 63 | 64 | 65 | Library\UnityAssemblies\UnityEditor.dll 66 | 67 | 68 | Assets\Assemblies\Lidgren\Lidgren.Network.dll 69 | 70 | 71 | Assets\Modules\DataTransferObjects.dll 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /GameClient/GameClient.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2015 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameClient", "GameClient.csproj", "{BE4413C2-C6D9-E653-9119-676C36C93C18}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {BE4413C2-C6D9-E653-9119-676C36C93C18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {BE4413C2-C6D9-E653-9119-676C36C93C18}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {BE4413C2-C6D9-E653-9119-676C36C93C18}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {BE4413C2-C6D9-E653-9119-676C36C93C18}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_SolverIterationCount: 6 13 | m_SolverVelocityIterations: 1 14 | m_QueriesHitTriggers: 1 15 | m_EnableAdaptiveForce: 0 16 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 17 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/main.unity 10 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d 11 | m_DefaultBehaviorMode: 0 12 | m_SpritePackerMode: 2 13 | m_SpritePackerPaddingPower: 1 14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 15 | m_ProjectGenerationRootNamespace: 16 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 39 | m_PreloadedShaders: [] 40 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 41 | type: 0} 42 | m_ShaderSettings_Tier1: 43 | useCascadedShadowMaps: 1 44 | standardShaderQuality: 2 45 | useReflectionProbeBoxProjection: 1 46 | useReflectionProbeBlending: 1 47 | m_ShaderSettings_Tier2: 48 | useCascadedShadowMaps: 1 49 | standardShaderQuality: 2 50 | useReflectionProbeBoxProjection: 1 51 | useReflectionProbeBlending: 1 52 | m_ShaderSettings_Tier3: 53 | useCascadedShadowMaps: 1 54 | standardShaderQuality: 2 55 | useReflectionProbeBoxProjection: 1 56 | useReflectionProbeBlending: 1 57 | m_BuildTargetShaderSettings: [] 58 | m_LightmapStripping: 0 59 | m_FogStripping: 0 60 | m_LightmapKeepPlain: 1 61 | m_LightmapKeepDirCombined: 1 62 | m_LightmapKeepDirSeparate: 1 63 | m_LightmapKeepDynamicPlain: 1 64 | m_LightmapKeepDynamicDirCombined: 1 65 | m_LightmapKeepDynamicDirSeparate: 1 66 | m_FogKeepLinear: 1 67 | m_FogKeepExp: 1 68 | m_FogKeepExp2: 1 69 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshAreas: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ContactArrowScale: 0.2 29 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 30 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 31 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 32 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 33 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 8 7 | productGUID: b3bfc400032cd0a4f8352d3cf680be99 8 | AndroidProfiler: 0 9 | defaultScreenOrientation: 4 10 | targetDevice: 2 11 | useOnDemandResources: 0 12 | accelerometerFrequency: 60 13 | companyName: DefaultCompany 14 | productName: GameClient 15 | defaultCursor: {fileID: 0} 16 | cursorHotspot: {x: 0, y: 0} 17 | m_SplashScreenStyle: 0 18 | m_ShowUnitySplashScreen: 1 19 | m_VirtualRealitySplashScreen: {fileID: 0} 20 | defaultScreenWidth: 640 21 | defaultScreenHeight: 480 22 | defaultScreenWidthWeb: 960 23 | defaultScreenHeightWeb: 600 24 | m_RenderingPath: 1 25 | m_MobileRenderingPath: 1 26 | m_ActiveColorSpace: 0 27 | m_MTRendering: 1 28 | m_MobileMTRendering: 0 29 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 30 | iosShowActivityIndicatorOnLoading: -1 31 | androidShowActivityIndicatorOnLoading: -1 32 | iosAppInBackgroundBehavior: 0 33 | displayResolutionDialog: 0 34 | iosAllowHTTPDownload: 1 35 | allowedAutorotateToPortrait: 1 36 | allowedAutorotateToPortraitUpsideDown: 1 37 | allowedAutorotateToLandscapeRight: 1 38 | allowedAutorotateToLandscapeLeft: 1 39 | useOSAutorotation: 1 40 | use32BitDisplayBuffer: 1 41 | disableDepthAndStencilBuffers: 0 42 | defaultIsFullScreen: 0 43 | defaultIsNativeResolution: 1 44 | runInBackground: 1 45 | captureSingleScreen: 0 46 | Override IPod Music: 0 47 | Prepare IOS For Recording: 0 48 | submitAnalytics: 1 49 | usePlayerLog: 1 50 | bakeCollisionMeshes: 0 51 | forceSingleInstance: 0 52 | resizableWindow: 1 53 | useMacAppStoreValidation: 0 54 | gpuSkinning: 0 55 | graphicsJobs: 0 56 | xboxPIXTextureCapture: 0 57 | xboxEnableAvatar: 0 58 | xboxEnableKinect: 0 59 | xboxEnableKinectAutoTracking: 0 60 | xboxEnableFitness: 0 61 | visibleInBackground: 0 62 | allowFullscreenSwitch: 1 63 | macFullscreenMode: 2 64 | d3d9FullscreenMode: 1 65 | d3d11FullscreenMode: 1 66 | xboxSpeechDB: 0 67 | xboxEnableHeadOrientation: 0 68 | xboxEnableGuest: 0 69 | xboxEnablePIXSampling: 0 70 | n3dsDisableStereoscopicView: 0 71 | n3dsEnableSharedListOpt: 1 72 | n3dsEnableVSync: 0 73 | uiUse16BitDepthBuffer: 0 74 | ignoreAlphaClear: 0 75 | xboxOneResolution: 0 76 | xboxOneMonoLoggingLevel: 0 77 | ps3SplashScreen: {fileID: 0} 78 | videoMemoryForVertexBuffers: 0 79 | psp2PowerMode: 0 80 | psp2AcquireBGM: 1 81 | wiiUTVResolution: 0 82 | wiiUGamePadMSAA: 1 83 | wiiUSupportsNunchuk: 0 84 | wiiUSupportsClassicController: 0 85 | wiiUSupportsBalanceBoard: 0 86 | wiiUSupportsMotionPlus: 0 87 | wiiUSupportsProController: 0 88 | wiiUAllowScreenCapture: 1 89 | wiiUControllerCount: 0 90 | m_SupportedAspectRatios: 91 | 4:3: 1 92 | 5:4: 1 93 | 16:10: 1 94 | 16:9: 1 95 | Others: 1 96 | bundleIdentifier: com.Company.ProductName 97 | bundleVersion: 1.0 98 | preloadedAssets: [] 99 | metroEnableIndependentInputSource: 0 100 | xboxOneDisableKinectGpuReservation: 0 101 | singlePassStereoRendering: 0 102 | protectGraphicsMemory: 0 103 | AndroidBundleVersionCode: 1 104 | AndroidMinSdkVersion: 9 105 | AndroidPreferredInstallLocation: 1 106 | aotOptions: 107 | apiCompatibilityLevel: 2 108 | stripEngineCode: 1 109 | iPhoneStrippingLevel: 0 110 | iPhoneScriptCallOptimization: 0 111 | iPhoneBuildNumber: 0 112 | ForceInternetPermission: 0 113 | ForceSDCardPermission: 0 114 | CreateWallpaper: 0 115 | APKExpansionFiles: 0 116 | preloadShaders: 0 117 | StripUnusedMeshComponents: 0 118 | VertexChannelCompressionMask: 119 | serializedVersion: 2 120 | m_Bits: 238 121 | iPhoneSdkVersion: 988 122 | iPhoneTargetOSVersion: 24 123 | tvOSSdkVersion: 0 124 | tvOSTargetOSVersion: 900 125 | uIPrerenderedIcon: 0 126 | uIRequiresPersistentWiFi: 0 127 | uIRequiresFullScreen: 1 128 | uIStatusBarHidden: 1 129 | uIExitOnSuspend: 0 130 | uIStatusBarStyle: 0 131 | iPhoneSplashScreen: {fileID: 0} 132 | iPhoneHighResSplashScreen: {fileID: 0} 133 | iPhoneTallHighResSplashScreen: {fileID: 0} 134 | iPhone47inSplashScreen: {fileID: 0} 135 | iPhone55inPortraitSplashScreen: {fileID: 0} 136 | iPhone55inLandscapeSplashScreen: {fileID: 0} 137 | iPadPortraitSplashScreen: {fileID: 0} 138 | iPadHighResPortraitSplashScreen: {fileID: 0} 139 | iPadLandscapeSplashScreen: {fileID: 0} 140 | iPadHighResLandscapeSplashScreen: {fileID: 0} 141 | appleTVSplashScreen: {fileID: 0} 142 | tvOSSmallIconLayers: [] 143 | tvOSLargeIconLayers: [] 144 | tvOSTopShelfImageLayers: [] 145 | iOSLaunchScreenType: 0 146 | iOSLaunchScreenPortrait: {fileID: 0} 147 | iOSLaunchScreenLandscape: {fileID: 0} 148 | iOSLaunchScreenBackgroundColor: 149 | serializedVersion: 2 150 | rgba: 0 151 | iOSLaunchScreenFillPct: 100 152 | iOSLaunchScreenSize: 100 153 | iOSLaunchScreenCustomXibPath: 154 | iOSLaunchScreeniPadType: 0 155 | iOSLaunchScreeniPadImage: {fileID: 0} 156 | iOSLaunchScreeniPadBackgroundColor: 157 | serializedVersion: 2 158 | rgba: 0 159 | iOSLaunchScreeniPadFillPct: 100 160 | iOSLaunchScreeniPadSize: 100 161 | iOSLaunchScreeniPadCustomXibPath: 162 | iOSDeviceRequirements: [] 163 | iOSURLSchemes: [] 164 | AndroidTargetDevice: 0 165 | AndroidSplashScreenScale: 0 166 | androidSplashScreen: {fileID: 0} 167 | AndroidKeystoreName: 168 | AndroidKeyaliasName: 169 | AndroidTVCompatibility: 1 170 | AndroidIsGame: 1 171 | androidEnableBanner: 1 172 | m_AndroidBanners: 173 | - width: 320 174 | height: 180 175 | banner: {fileID: 0} 176 | androidGamepadSupportLevel: 0 177 | resolutionDialogBanner: {fileID: 0} 178 | m_BuildTargetIcons: 179 | - m_BuildTarget: 180 | m_Icons: 181 | - serializedVersion: 2 182 | m_Icon: {fileID: 0} 183 | m_Width: 128 184 | m_Height: 128 185 | m_BuildTargetBatching: [] 186 | m_BuildTargetGraphicsAPIs: [] 187 | webPlayerTemplate: APPLICATION:Default 188 | m_TemplateCustomTags: {} 189 | wiiUTitleID: 0005000011000000 190 | wiiUGroupID: 00010000 191 | wiiUCommonSaveSize: 4096 192 | wiiUAccountSaveSize: 2048 193 | wiiUOlvAccessKey: 0 194 | wiiUTinCode: 0 195 | wiiUJoinGameId: 0 196 | wiiUJoinGameModeMask: 0000000000000000 197 | wiiUCommonBossSize: 0 198 | wiiUAccountBossSize: 0 199 | wiiUAddOnUniqueIDs: [] 200 | wiiUMainThreadStackSize: 3072 201 | wiiULoaderThreadStackSize: 1024 202 | wiiUSystemHeapSize: 128 203 | wiiUTVStartupScreen: {fileID: 0} 204 | wiiUGamePadStartupScreen: {fileID: 0} 205 | wiiUProfilerLibPath: 206 | actionOnDotNetUnhandledException: 1 207 | enableInternalProfiler: 0 208 | logObjCUncaughtExceptions: 1 209 | enableCrashReportAPI: 0 210 | locationUsageDescription: 211 | XboxTitleId: 212 | XboxImageXexPath: 213 | XboxSpaPath: 214 | XboxGenerateSpa: 0 215 | XboxDeployKinectResources: 0 216 | XboxSplashScreen: {fileID: 0} 217 | xboxEnableSpeech: 0 218 | xboxAdditionalTitleMemorySize: 0 219 | xboxDeployKinectHeadOrientation: 0 220 | xboxDeployKinectHeadPosition: 0 221 | ps3TitleConfigPath: 222 | ps3DLCConfigPath: 223 | ps3ThumbnailPath: 224 | ps3BackgroundPath: 225 | ps3SoundPath: 226 | ps3NPAgeRating: 12 227 | ps3TrophyCommId: 228 | ps3NpCommunicationPassphrase: 229 | ps3TrophyPackagePath: 230 | ps3BootCheckMaxSaveGameSizeKB: 128 231 | ps3TrophyCommSig: 232 | ps3SaveGameSlots: 1 233 | ps3TrialMode: 0 234 | ps3VideoMemoryForAudio: 0 235 | ps3EnableVerboseMemoryStats: 0 236 | ps3UseSPUForUmbra: 0 237 | ps3EnableMoveSupport: 1 238 | ps3DisableDolbyEncoding: 0 239 | ps4NPAgeRating: 12 240 | ps4NPTitleSecret: 241 | ps4NPTrophyPackPath: 242 | ps4ParentalLevel: 1 243 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 244 | ps4Category: 0 245 | ps4MasterVersion: 01.00 246 | ps4AppVersion: 01.00 247 | ps4AppType: 0 248 | ps4ParamSfxPath: 249 | ps4VideoOutPixelFormat: 0 250 | ps4VideoOutResolution: 4 251 | ps4PronunciationXMLPath: 252 | ps4PronunciationSIGPath: 253 | ps4BackgroundImagePath: 254 | ps4StartupImagePath: 255 | ps4SaveDataImagePath: 256 | ps4SdkOverride: 257 | ps4BGMPath: 258 | ps4ShareFilePath: 259 | ps4ShareOverlayImagePath: 260 | ps4PrivacyGuardImagePath: 261 | ps4NPtitleDatPath: 262 | ps4RemotePlayKeyAssignment: -1 263 | ps4RemotePlayKeyMappingDir: 264 | ps4PlayTogetherPlayerCount: 0 265 | ps4EnterButtonAssignment: 1 266 | ps4ApplicationParam1: 0 267 | ps4ApplicationParam2: 0 268 | ps4ApplicationParam3: 0 269 | ps4ApplicationParam4: 0 270 | ps4DownloadDataSize: 0 271 | ps4GarlicHeapSize: 2048 272 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 273 | ps4UseDebugIl2cppLibs: 0 274 | ps4pnSessions: 1 275 | ps4pnPresence: 1 276 | ps4pnFriends: 1 277 | ps4pnGameCustomData: 1 278 | playerPrefsSupport: 0 279 | ps4ReprojectionSupport: 0 280 | ps4UseAudio3dBackend: 0 281 | ps4SocialScreenEnabled: 0 282 | ps4Audio3dVirtualSpeakerCount: 14 283 | ps4attribCpuUsage: 0 284 | ps4PatchPkgPath: 285 | ps4PatchLatestPkgPath: 286 | ps4PatchChangeinfoPath: 287 | ps4attribUserManagement: 0 288 | ps4attribMoveSupport: 0 289 | ps4attrib3DSupport: 0 290 | ps4attribShareSupport: 0 291 | ps4attribExclusiveVR: 0 292 | ps4disableAutoHideSplash: 0 293 | ps4IncludedModules: [] 294 | monoEnv: 295 | psp2Splashimage: {fileID: 0} 296 | psp2NPTrophyPackPath: 297 | psp2NPSupportGBMorGJP: 0 298 | psp2NPAgeRating: 12 299 | psp2NPTitleDatPath: 300 | psp2NPCommsID: 301 | psp2NPCommunicationsID: 302 | psp2NPCommsPassphrase: 303 | psp2NPCommsSig: 304 | psp2ParamSfxPath: 305 | psp2ManualPath: 306 | psp2LiveAreaGatePath: 307 | psp2LiveAreaBackroundPath: 308 | psp2LiveAreaPath: 309 | psp2LiveAreaTrialPath: 310 | psp2PatchChangeInfoPath: 311 | psp2PatchOriginalPackage: 312 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 313 | psp2KeystoneFile: 314 | psp2MemoryExpansionMode: 0 315 | psp2DRMType: 0 316 | psp2StorageType: 0 317 | psp2MediaCapacity: 0 318 | psp2DLCConfigPath: 319 | psp2ThumbnailPath: 320 | psp2BackgroundPath: 321 | psp2SoundPath: 322 | psp2TrophyCommId: 323 | psp2TrophyPackagePath: 324 | psp2PackagedResourcesPath: 325 | psp2SaveDataQuota: 10240 326 | psp2ParentalLevel: 1 327 | psp2ShortTitle: Not Set 328 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 329 | psp2Category: 0 330 | psp2MasterVersion: 01.00 331 | psp2AppVersion: 01.00 332 | psp2TVBootMode: 0 333 | psp2EnterButtonAssignment: 2 334 | psp2TVDisableEmu: 0 335 | psp2AllowTwitterDialog: 1 336 | psp2Upgradable: 0 337 | psp2HealthWarning: 0 338 | psp2UseLibLocation: 0 339 | psp2InfoBarOnStartup: 0 340 | psp2InfoBarColor: 0 341 | psp2UseDebugIl2cppLibs: 0 342 | psmSplashimage: {fileID: 0} 343 | spritePackerPolicy: 344 | scriptingDefineSymbols: {} 345 | metroPackageName: GameClient 346 | metroPackageVersion: 347 | metroCertificatePath: 348 | metroCertificatePassword: 349 | metroCertificateSubject: 350 | metroCertificateIssuer: 351 | metroCertificateNotAfter: 0000000000000000 352 | metroApplicationDescription: GameClient 353 | wsaImages: {} 354 | metroTileShortName: 355 | metroCommandLineArgsFile: 356 | metroTileShowName: 0 357 | metroMediumTileShowName: 0 358 | metroLargeTileShowName: 0 359 | metroWideTileShowName: 0 360 | metroDefaultTileSize: 1 361 | metroTileForegroundText: 1 362 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 363 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 364 | a: 1} 365 | metroSplashScreenUseBackgroundColor: 0 366 | platformCapabilities: {} 367 | metroFTAName: 368 | metroFTAFileTypes: [] 369 | metroProtocolName: 370 | metroCompilationOverrides: 1 371 | tizenProductDescription: 372 | tizenProductURL: 373 | tizenSigningProfileName: 374 | tizenGPSPermissions: 0 375 | tizenMicrophonePermissions: 0 376 | n3dsUseExtSaveData: 0 377 | n3dsCompressStaticMem: 1 378 | n3dsExtSaveDataNumber: 0x12345 379 | n3dsStackSize: 131072 380 | n3dsTargetPlatform: 2 381 | n3dsRegion: 7 382 | n3dsMediaSize: 0 383 | n3dsLogoStyle: 3 384 | n3dsTitle: GameName 385 | n3dsProductCode: 386 | n3dsApplicationId: 0xFF3FF 387 | stvDeviceAddress: 388 | stvProductDescription: 389 | stvProductAuthor: 390 | stvProductAuthorEmail: 391 | stvProductLink: 392 | stvProductCategory: 0 393 | XboxOneProductId: 394 | XboxOneUpdateKey: 395 | XboxOneSandboxId: 396 | XboxOneContentId: 397 | XboxOneTitleId: 398 | XboxOneSCId: 399 | XboxOneGameOsOverridePath: 400 | XboxOnePackagingOverridePath: 401 | XboxOneAppManifestOverridePath: 402 | XboxOnePackageEncryption: 0 403 | XboxOnePackageUpdateGranularity: 2 404 | XboxOneDescription: 405 | XboxOneIsContentPackage: 0 406 | XboxOneEnableGPUVariability: 0 407 | XboxOneSockets: {} 408 | XboxOneSplashScreen: {fileID: 0} 409 | XboxOneAllowedProductIds: [] 410 | XboxOnePersistentLocalStorageSize: 0 411 | intPropertyNames: 412 | - Standalone::ScriptingBackend 413 | - WebPlayer::ScriptingBackend 414 | Standalone::ScriptingBackend: 0 415 | WebPlayer::ScriptingBackend: 0 416 | boolPropertyNames: 417 | - Android::VR::enable 418 | - Metro::VR::enable 419 | - N3DS::VR::enable 420 | - PS3::VR::enable 421 | - PS4::VR::enable 422 | - PSM::VR::enable 423 | - PSP2::VR::enable 424 | - SamsungTV::VR::enable 425 | - Standalone::VR::enable 426 | - Tizen::VR::enable 427 | - WebGL::VR::enable 428 | - WebPlayer::VR::enable 429 | - WiiU::VR::enable 430 | - Xbox360::VR::enable 431 | - XboxOne::VR::enable 432 | - XboxOne::enus 433 | - iOS::VR::enable 434 | - tvOS::VR::enable 435 | Android::VR::enable: 0 436 | Metro::VR::enable: 0 437 | N3DS::VR::enable: 0 438 | PS3::VR::enable: 0 439 | PS4::VR::enable: 0 440 | PSM::VR::enable: 0 441 | PSP2::VR::enable: 0 442 | SamsungTV::VR::enable: 0 443 | Standalone::VR::enable: 0 444 | Tizen::VR::enable: 0 445 | WebGL::VR::enable: 0 446 | WebPlayer::VR::enable: 0 447 | WiiU::VR::enable: 0 448 | Xbox360::VR::enable: 0 449 | XboxOne::VR::enable: 0 450 | XboxOne::enus: 1 451 | iOS::VR::enable: 0 452 | tvOS::VR::enable: 0 453 | stringPropertyNames: 454 | - Analytics_ServiceEnabled::Analytics_ServiceEnabled 455 | - Build_ServiceEnabled::Build_ServiceEnabled 456 | - Collab_ServiceEnabled::Collab_ServiceEnabled 457 | - ErrorHub_ServiceEnabled::ErrorHub_ServiceEnabled 458 | - Game_Performance_ServiceEnabled::Game_Performance_ServiceEnabled 459 | - Hub_ServiceEnabled::Hub_ServiceEnabled 460 | - Purchasing_ServiceEnabled::Purchasing_ServiceEnabled 461 | - UNet_ServiceEnabled::UNet_ServiceEnabled 462 | - Unity_Ads_ServiceEnabled::Unity_Ads_ServiceEnabled 463 | Analytics_ServiceEnabled::Analytics_ServiceEnabled: False 464 | Build_ServiceEnabled::Build_ServiceEnabled: False 465 | Collab_ServiceEnabled::Collab_ServiceEnabled: False 466 | ErrorHub_ServiceEnabled::ErrorHub_ServiceEnabled: False 467 | Game_Performance_ServiceEnabled::Game_Performance_ServiceEnabled: False 468 | Hub_ServiceEnabled::Hub_ServiceEnabled: False 469 | Purchasing_ServiceEnabled::Purchasing_ServiceEnabled: False 470 | UNet_ServiceEnabled::UNet_ServiceEnabled: False 471 | Unity_Ads_ServiceEnabled::Unity_Ads_ServiceEnabled: False 472 | vectorPropertyNames: 473 | - Android::VR::enabledDevices 474 | - Metro::VR::enabledDevices 475 | - N3DS::VR::enabledDevices 476 | - PS3::VR::enabledDevices 477 | - PS4::VR::enabledDevices 478 | - PSM::VR::enabledDevices 479 | - PSP2::VR::enabledDevices 480 | - SamsungTV::VR::enabledDevices 481 | - Standalone::VR::enabledDevices 482 | - Tizen::VR::enabledDevices 483 | - WebGL::VR::enabledDevices 484 | - WebPlayer::VR::enabledDevices 485 | - WiiU::VR::enabledDevices 486 | - Xbox360::VR::enabledDevices 487 | - XboxOne::VR::enabledDevices 488 | - iOS::VR::enabledDevices 489 | - tvOS::VR::enabledDevices 490 | Android::VR::enabledDevices: 491 | - Oculus 492 | Metro::VR::enabledDevices: [] 493 | N3DS::VR::enabledDevices: [] 494 | PS3::VR::enabledDevices: [] 495 | PS4::VR::enabledDevices: 496 | - PlayStationVR 497 | PSM::VR::enabledDevices: [] 498 | PSP2::VR::enabledDevices: [] 499 | SamsungTV::VR::enabledDevices: [] 500 | Standalone::VR::enabledDevices: 501 | - Oculus 502 | Tizen::VR::enabledDevices: [] 503 | WebGL::VR::enabledDevices: [] 504 | WebPlayer::VR::enabledDevices: [] 505 | WiiU::VR::enabledDevices: [] 506 | Xbox360::VR::enabledDevices: [] 507 | XboxOne::VR::enabledDevices: [] 508 | iOS::VR::enabledDevices: [] 509 | tvOS::VR::enabledDevices: [] 510 | cloudProjectId: a580580f-fdf1-4666-b289-307e142cae27 511 | projectName: GameClient 512 | organizationId: omahans 513 | cloudEnabled: 0 514 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.4.0f3 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 2 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 2 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 1 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 2 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 2 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 2 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | Nintendo 3DS: 5 168 | PS3: 5 169 | PS4: 5 170 | PSM: 5 171 | PSP2: 2 172 | Samsung TV: 2 173 | Standalone: 5 174 | Tizen: 2 175 | Web: 5 176 | WebGL: 3 177 | WiiU: 5 178 | Windows Store Apps: 5 179 | XBOX360: 5 180 | XboxOne: 5 181 | iPhone: 2 182 | tvOS: 5 183 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!292 &1 4 | UnityAdsSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_InitializeOnStartup: 1 8 | m_TestMode: 0 9 | m_EnabledPlatforms: 4294967295 10 | m_IosGameId: 11 | m_AndroidGameId: 12 | -------------------------------------------------------------------------------- /GameClient/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | CrashReportingSettings: 11 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 12 | m_Enabled: 0 13 | UnityPurchasingSettings: 14 | m_Enabled: 0 15 | m_TestMode: 0 16 | UnityAnalyticsSettings: 17 | m_Enabled: 1 18 | m_InitializeOnStartup: 1 19 | m_TestMode: 0 20 | m_TestEventUrl: 21 | m_TestConfigUrl: 22 | -------------------------------------------------------------------------------- /GameServer/DataModel/PlayerContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace GameServer.DataModel 7 | { 8 | public class PlayerContext 9 | { 10 | public long Id { get; } 11 | public string Name { get; set;} 12 | 13 | public PlayerContext(long id) 14 | { 15 | Id = id; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /GameServer/GameServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp1.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /GameServer/Logging/ConsoleLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GameServer.Logging 8 | { 9 | class ConsoleLogger : ILoggerProvider 10 | { 11 | public void Log(string message) 12 | { 13 | Console.WriteLine(message); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /GameServer/Logging/FileLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace GameServer.Logging 10 | { 11 | /* 12 | class FileLogger : ILoggerProvider 13 | { 14 | private string m_Path; 15 | 16 | public FileLogger() 17 | { 18 | m_Path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + "logs"; 19 | if(!Directory.Exists(m_Path)) 20 | { 21 | Directory.CreateDirectory(m_Path); 22 | } 23 | } 24 | 25 | public void Log(string message) 26 | { 27 | string path = m_Path + "\\" + DateTime.Today.ToShortDateString() + ".txt"; 28 | 29 | using (StreamWriter sw = new StreamWriter(path, true)) 30 | { 31 | sw.WriteLine(message); 32 | } 33 | } 34 | }*/ 35 | } 36 | -------------------------------------------------------------------------------- /GameServer/Logging/ILoggerProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GameServer.Logging 8 | { 9 | public interface ILoggerProvider 10 | { 11 | void Log(string message); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /GameServer/Logging/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GameServer.Logging 8 | { 9 | public enum LogLevel 10 | { 11 | Fatal, 12 | Error, 13 | Warning, 14 | Info, 15 | Debug, 16 | Trace 17 | } 18 | 19 | public class Logger 20 | { 21 | public static bool IsEnabled { get; set; } = true; 22 | 23 | private string m_Name; 24 | private IEnumerable m_Loggers; 25 | 26 | public Logger(IEnumerable loggers) 27 | { 28 | m_Loggers = loggers; 29 | m_Name = typeof(T).Name; 30 | } 31 | 32 | public void Log(LogLevel logLevel, string message) 33 | { 34 | if(!IsEnabled) 35 | { 36 | return; 37 | } 38 | 39 | foreach(ILoggerProvider logger in m_Loggers) 40 | { 41 | logger.Log(DateTime.Now.ToString("t")+" - "+m_Name + "::" + logLevel.ToString() + " - " + message); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /GameServer/Logging/LoggerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GameServer.Logging 8 | { 9 | public class LoggerFactory 10 | { 11 | private Dictionary m_Loggers = new Dictionary(); 12 | 13 | public void AddProvider(ILoggerProvider provider) 14 | { 15 | string providerName = provider.ToString(); 16 | if (!m_Loggers.ContainsKey(providerName)) 17 | { 18 | m_Loggers[providerName] = provider; 19 | } 20 | } 21 | 22 | public Logger GetLogger() 23 | { 24 | return new Logger(m_Loggers.Values); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /GameServer/Program.cs: -------------------------------------------------------------------------------- 1 | using GameServer.Logging; 2 | using NetworkLayer; 3 | using System; 4 | using DataTransferObjects; 5 | using System.Threading; 6 | using NetworkLayer.Lidgren; 7 | using GameServer.Services; 8 | 9 | namespace GameServer 10 | { 11 | public class Program 12 | { 13 | public static void Main(string[] args) 14 | { 15 | var server = new LidgrenServer(); 16 | var loggerFactory = new LoggerFactory(); 17 | var sessionManager = new SessionManager(loggerFactory, server); 18 | var chatManager = new ChatManager(server, loggerFactory, sessionManager); 19 | //var eventLogger = new ServerEventLogger(serverManager, loggerFactory); 20 | 21 | loggerFactory.AddProvider(new ConsoleLogger()); 22 | 23 | server.Start(); 24 | 25 | Console.WriteLine(DateTime.Now.ToString("d") +" "+ DateTime.Now.ToString("t") + " - Server Started on port: " + server.Port); 26 | 27 | while (true) 28 | { 29 | server.HandleMessages(); 30 | Thread.Sleep(10); 31 | } 32 | } 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /GameServer/Services/ChatManager.cs: -------------------------------------------------------------------------------- 1 | using DataTransferObjects; 2 | using GameServer.Logging; 3 | using NetworkLayer; 4 | using System; 5 | 6 | namespace GameServer.Services 7 | { 8 | public class ChatManager 9 | { 10 | private IServer m_Server; 11 | private Logger m_Logger; 12 | private SessionManager m_SessionManager; 13 | 14 | public ChatManager(IServer server, LoggerFactory loggerFactory, SessionManager sessionManager) 15 | { 16 | m_Server = server; 17 | m_Logger = loggerFactory.GetLogger(); 18 | m_SessionManager = sessionManager; 19 | 20 | m_Server.RegisterDataCallback(ChatMessage); 21 | } 22 | 23 | public void ChatMessage(IConnection connection, ChatMessage c) 24 | { 25 | if(c.SenderId != connection.Id) 26 | { 27 | m_Logger.Log(LogLevel.Warning, "Sender ID " + c.SenderId + " does not match connection ID " + connection.Id); 28 | return; 29 | } 30 | Packet message = new Packet(PacketType.ChatMessage, c); 31 | m_Server.SendAll(message.SerializePacket(), null, DeliveryMethod.ReliableOrdered, (int)MessageChannel.Chat); 32 | } 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /GameServer/Services/ServerEventLogger.cs: -------------------------------------------------------------------------------- 1 | using GameServer.Logging; 2 | using NetworkLayer; 3 | 4 | namespace GameServer.Services 5 | { 6 | public class ServerEventLogger 7 | { 8 | private Logger m_Logger; 9 | 10 | public ServerEventLogger(IServer manager, LoggerFactory loggerFactory) 11 | { 12 | m_Logger = loggerFactory.GetLogger(); 13 | 14 | manager.OnConnected += LogEvent; 15 | manager.OnConnectionApproved += LogEvent; 16 | manager.OnConnectionDenied += LogEvent; 17 | manager.OnDisconnected += LogEvent; 18 | manager.OnReceivedData += LogEvent; 19 | } 20 | 21 | public void LogEvent(IMessage message) 22 | { 23 | m_Logger.Log(LogLevel.Info, message.Description()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /GameServer/Services/SessionManager.cs: -------------------------------------------------------------------------------- 1 | using GameServer.Logging; 2 | using System; 3 | using System.Collections.Generic; 4 | using NetworkLayer; 5 | using DataTransferObjects; 6 | using GameServer.DataModel; 7 | 8 | namespace GameServer.Services 9 | { 10 | public class SessionManager 11 | { 12 | 13 | private Dictionary m_Sessions; 14 | private Logger m_Logger; 15 | private IServer m_Server; 16 | 17 | public SessionManager(LoggerFactory factory, IServer server) 18 | { 19 | m_Logger = factory.GetLogger(); 20 | m_Sessions = new Dictionary(); 21 | m_Server = server; 22 | 23 | server.OnConnectionApproved += CreateSession; 24 | server.OnConnected += PlayerConnected; 25 | server.OnDisconnecting += PlayerDisconnected; 26 | server.OnDisconnected += EndSession; 27 | } 28 | 29 | public PlayerContext GetPlayerContext(long connectionId) 30 | { 31 | if (!m_Sessions.TryGetValue(connectionId, out PlayerContext ctx)) 32 | { 33 | m_Logger.Log(LogLevel.Error, "Could not find session for " + connectionId); 34 | } 35 | 36 | return ctx; 37 | } 38 | 39 | private void CreateSession(IMessage message) 40 | { 41 | try 42 | { 43 | var id = (AuthRequest)Packet.Read(message.Data).SerializedData; 44 | 45 | PlayerContext player = new PlayerContext(message.Connection.Id) 46 | { 47 | Name = id.Name 48 | }; 49 | 50 | m_Sessions.Add(message.Connection.Id, player); 51 | m_Logger.Log(LogLevel.Info, "Created session for PeerId " + message.Connection.Id + " at " + message.Connection.Ip); 52 | } 53 | catch (Exception e) 54 | { 55 | m_Logger.Log(LogLevel.Error, e.Message); 56 | } 57 | 58 | } 59 | 60 | private void EndSession(IMessage message) 61 | { 62 | var connection = message.Connection; 63 | m_Logger.Log(LogLevel.Info, "Ended session for PeerId " + connection.Id + " at " + connection.Ip); 64 | m_Sessions.Remove(connection.Id); 65 | } 66 | 67 | private void PlayerConnected(IMessage message) 68 | { 69 | string name = GetPlayerContext(message.Connection.Id)?.Name; 70 | if (name == null) 71 | { 72 | m_Logger.Log(LogLevel.Error, "No session found for " + message.Connection.Id); 73 | } 74 | 75 | RemotePlayer p = new RemotePlayer() 76 | { 77 | Name = name, 78 | Id = message.Connection.Id, 79 | Connected = true 80 | }; 81 | 82 | Packet packet = new Packet(PacketType.RemotePlayer, p); 83 | m_Server.SendAll(packet.SerializePacket(), null, DeliveryMethod.ReliableOrdered, (int)MessageChannel.Chat); 84 | } 85 | 86 | private void PlayerDisconnected(IMessage message) 87 | { 88 | string name = GetPlayerContext(message.Connection.Id)?.Name; 89 | if (name == null) 90 | { 91 | m_Logger.Log(LogLevel.Error, "No session found for " + message.Connection.Id); 92 | } 93 | 94 | RemotePlayer p = new RemotePlayer() 95 | { 96 | Name = name, 97 | Id = message.Connection.Id, 98 | Connected = false 99 | }; 100 | 101 | Packet packet = new Packet(PacketType.RemotePlayer, p); 102 | m_Server.SendAll(packet.SerializePacket(), null, DeliveryMethod.ReliableOrdered, (int)MessageChannel.Chat); 103 | } 104 | 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /NetCoreGameServer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.4 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkLayer", "NetworkLayer\NetworkLayer.csproj", "{E545D767-2C5C-42A9-8FD6-B16E5A200384}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameServer", "GameServer\GameServer.csproj", "{059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataTransferObjects", "DataTransferObjects\DataTransferObjects.csproj", "{538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | DebugUnity|Any CPU = DebugUnity|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | ReleaseUnity|Any CPU = ReleaseUnity|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {E545D767-2C5C-42A9-8FD6-B16E5A200384}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {E545D767-2C5C-42A9-8FD6-B16E5A200384}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {E545D767-2C5C-42A9-8FD6-B16E5A200384}.DebugUnity|Any CPU.ActiveCfg = Debug|Any CPU 23 | {E545D767-2C5C-42A9-8FD6-B16E5A200384}.DebugUnity|Any CPU.Build.0 = Debug|Any CPU 24 | {E545D767-2C5C-42A9-8FD6-B16E5A200384}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {E545D767-2C5C-42A9-8FD6-B16E5A200384}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {E545D767-2C5C-42A9-8FD6-B16E5A200384}.ReleaseUnity|Any CPU.ActiveCfg = Release|Any CPU 27 | {E545D767-2C5C-42A9-8FD6-B16E5A200384}.ReleaseUnity|Any CPU.Build.0 = Release|Any CPU 28 | {059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}.DebugUnity|Any CPU.ActiveCfg = Debug|Any CPU 31 | {059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}.DebugUnity|Any CPU.Build.0 = Debug|Any CPU 32 | {059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}.ReleaseUnity|Any CPU.ActiveCfg = Release|Any CPU 35 | {059E0F79-6C2C-4AFB-AACE-13DA7E85B5C8}.ReleaseUnity|Any CPU.Build.0 = Release|Any CPU 36 | {538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}.DebugUnity|Any CPU.ActiveCfg = DebugUnity|Any CPU 39 | {538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}.DebugUnity|Any CPU.Build.0 = DebugUnity|Any CPU 40 | {538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}.ReleaseUnity|Any CPU.ActiveCfg = ReleaseUnity|Any CPU 43 | {538B1B88-47F3-43F8-BA4E-0C9F9E9CAF63}.ReleaseUnity|Any CPU.Build.0 = ReleaseUnity|Any CPU 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | EndGlobal 49 | -------------------------------------------------------------------------------- /NetworkLayer/IConnection.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace NetworkLayer 3 | { 4 | public interface IConnection 5 | { 6 | long Id { get; } 7 | string Ip { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /NetworkLayer/IMessage.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace NetworkLayer 3 | { 4 | public interface IMessage 5 | { 6 | string Description(); 7 | IConnection Connection { get; } 8 | byte[] Data { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /NetworkLayer/IServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NetworkLayer 4 | { 5 | public delegate void MessageEventHandler(IMessage message); 6 | 7 | public enum DeliveryMethod 8 | { 9 | //No guarantees, except for preventing duplicates. 10 | Unreliable, 11 | 12 | //Late messages will be dropped if newer ones were already received 13 | UnreliableSequenced, 14 | 15 | //All packages will arrive, but not necessarily in the same order. 16 | ReliableUnordered, 17 | 18 | //All packages will arrive, but late ones will be dropped. 19 | //This means that we will always receive the latest message eventually, but may miss older ones. 20 | ReliableSequenced, 21 | 22 | //All packages will arrive, and they will do so in the same order. 23 | //Unlike all the other methods, here the library will hold back messages until all previous ones are received, before handing them to us. 24 | ReliableOrdered 25 | } 26 | 27 | public interface IServer 28 | { 29 | event MessageEventHandler OnConnectionApproved; 30 | event MessageEventHandler OnConnectionDenied; 31 | event MessageEventHandler OnConnected; 32 | event MessageEventHandler OnDisconnected; 33 | event MessageEventHandler OnDisconnecting; 34 | event MessageEventHandler OnReceivedData; 35 | 36 | void RegisterDataCallback(Action callback); 37 | 38 | void Start(); 39 | 40 | int Port { get; } 41 | 42 | void HandleMessages(); 43 | 44 | void SendAll(byte[] message, IConnection except, DeliveryMethod method, int channel); 45 | void Send(IConnection connection, byte[] message, DeliveryMethod method, int channel); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /NetworkLayer/Lidgren/LidgrenConnection.cs: -------------------------------------------------------------------------------- 1 | using Lidgren.Network; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace NetworkLayer.Lidgren 7 | { 8 | class LidgrenConnection : IConnection 9 | { 10 | private NetConnection m_NetConnection; 11 | public LidgrenConnection(NetConnection connection) 12 | { 13 | m_NetConnection = connection; 14 | } 15 | 16 | public long Id { get => m_NetConnection.RemoteUniqueIdentifier; } 17 | public string Ip { get => m_NetConnection.RemoteEndPoint.ToString(); } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /NetworkLayer/Lidgren/LidgrenMessage.cs: -------------------------------------------------------------------------------- 1 | using Lidgren.Network; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace NetworkLayer.Lidgren 8 | { 9 | public class LidgrenMessage : IMessage 10 | { 11 | private NetIncomingMessage m_Message; 12 | 13 | public LidgrenMessage(NetIncomingMessage message) 14 | { 15 | m_Message = message; 16 | } 17 | 18 | public IConnection Connection 19 | { 20 | get 21 | { 22 | return new LidgrenConnection(m_Message.SenderConnection); 23 | } 24 | } 25 | 26 | public string Description() 27 | { 28 | return m_Message.MessageType + " - " + m_Message.ReadString(); 29 | } 30 | 31 | public byte[] Data 32 | { 33 | get 34 | { 35 | return m_Message.Data; 36 | } 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /NetworkLayer/Lidgren/LidgrenServer.cs: -------------------------------------------------------------------------------- 1 | using DataTransferObjects; 2 | using Lidgren.Network; 3 | using NetworkLayer.Lidgren; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Collections; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace NetworkLayer.Lidgren 11 | { 12 | 13 | public class LidgrenServer : IServer 14 | { 15 | private NetServer m_Server; 16 | private Dictionary> m_MessageTypes; 17 | 18 | private Dictionary m_DeliveryMethodMap = new Dictionary() 19 | { 20 | { DeliveryMethod.Unreliable, NetDeliveryMethod.Unreliable }, 21 | { DeliveryMethod.UnreliableSequenced, NetDeliveryMethod.UnreliableSequenced }, 22 | { DeliveryMethod.ReliableUnordered, NetDeliveryMethod.ReliableUnordered }, 23 | { DeliveryMethod.ReliableSequenced, NetDeliveryMethod.ReliableSequenced }, 24 | { DeliveryMethod.ReliableOrdered, NetDeliveryMethod.ReliableOrdered } 25 | }; 26 | 27 | public event MessageEventHandler OnConnectionApproved; 28 | public event MessageEventHandler OnConnectionDenied; 29 | public event MessageEventHandler OnConnected; 30 | public event MessageEventHandler OnDisconnected; 31 | public event MessageEventHandler OnDisconnecting; 32 | public event MessageEventHandler OnReceivedData; 33 | 34 | public LidgrenServer() 35 | { 36 | var config = new NetPeerConfiguration("test"); 37 | config.Port = 12345; 38 | config.MaximumConnections = 10; 39 | config.ConnectionTimeout = 10; 40 | config.EnableMessageType(NetIncomingMessageType.ConnectionApproval); 41 | 42 | m_Server = new NetServer(config); 43 | m_Server.Configuration.ConnectionTimeout = 10; 44 | 45 | m_MessageTypes = new Dictionary>(); 46 | } 47 | 48 | public int Port { get { return m_Server.Port; } } 49 | 50 | public void Start() 51 | { 52 | m_Server.Start(); 53 | } 54 | 55 | public void HandleMessages() 56 | { 57 | NetIncomingMessage message; 58 | while ((message = m_Server.ReadMessage()) != null) 59 | { 60 | switch (message.MessageType) 61 | { 62 | case NetIncomingMessageType.ConnectionApproval: 63 | try 64 | { 65 | var packet = Packet.Read(message.Data); 66 | ApproveConnection(message.SenderConnection); 67 | OnConnectionApproved?.Invoke(new LidgrenMessage(message)); 68 | } 69 | catch (Exception e) 70 | { 71 | DenyConnection(message.SenderConnection); 72 | OnConnectionDenied?.Invoke(new LidgrenMessage(message)); 73 | } 74 | break; 75 | case NetIncomingMessageType.StatusChanged: 76 | switch (message.SenderConnection.Status) 77 | { 78 | case NetConnectionStatus.Connected: 79 | OnConnected?.Invoke(new LidgrenMessage(message)); 80 | break; 81 | case NetConnectionStatus.Disconnected: 82 | OnDisconnecting?.Invoke(new LidgrenMessage(message)); //not firing from lidgren 83 | OnDisconnected?.Invoke(new LidgrenMessage(message)); 84 | break; 85 | 86 | } 87 | break; 88 | case NetIncomingMessageType.Data: 89 | TriggerCallback(new LidgrenConnection(message.SenderConnection), message.Data); 90 | OnReceivedData?.Invoke(new LidgrenMessage(message)); 91 | break; 92 | case NetIncomingMessageType.DebugMessage: 93 | // handle debug messages 94 | // (only received when compiled in DEBUG mode) 95 | Console.WriteLine("DEBUG: "+message.ReadString()); 96 | break; 97 | case NetIncomingMessageType.WarningMessage: 98 | Console.WriteLine("WARNING: "+message.ReadString()); 99 | break; 100 | /* .. */ 101 | default: 102 | Console.WriteLine("unhandled message with type: " 103 | + message.MessageType); 104 | break; 105 | } 106 | } 107 | } 108 | 109 | public void RegisterDataCallback(Action callback) 110 | { 111 | m_MessageTypes.Add(typeof(T), (connection, cb) => callback(connection, (T)cb)); 112 | } 113 | 114 | public void SendAll(byte[] message, IConnection except, DeliveryMethod method, int channel) 115 | { 116 | NetConnection sender = null; 117 | if (except != null) 118 | { 119 | sender = m_Server.Connections.FirstOrDefault(x => x.RemoteUniqueIdentifier == except.Id); 120 | 121 | if (sender == null) 122 | { 123 | throw new ArgumentException("Invalid except connection with id " + except.Id); } 124 | } 125 | 126 | 127 | NetOutgoingMessage msg = m_Server.CreateMessage(); 128 | msg.Write(message); 129 | m_Server.SendToAll(msg, sender, m_DeliveryMethodMap[method], channel); 130 | } 131 | 132 | public void Send(IConnection connection, byte[] message, DeliveryMethod method, int channel) 133 | { 134 | NetConnection recipient = m_Server.Connections.FirstOrDefault(x => x.RemoteUniqueIdentifier == connection.Id); 135 | 136 | if(recipient == null) 137 | { 138 | throw new ArgumentException("Could not send message to connectionId " + connection.Id + ", connection does not exist."); 139 | } 140 | 141 | NetOutgoingMessage msg = m_Server.CreateMessage(); 142 | msg.Write(message); 143 | m_Server.SendMessage(msg, recipient, m_DeliveryMethodMap[method], channel); 144 | } 145 | 146 | private void TriggerCallback(IConnection connection, byte[] data) 147 | { 148 | var dto = Packet.Read(data); 149 | var obj = dto.SerializedData; 150 | 151 | m_MessageTypes[obj.GetType()](connection, obj); 152 | } 153 | 154 | private void ApproveConnection(NetConnection connection) 155 | { 156 | var msg = m_Server.CreateMessage(); 157 | msg.Write("connected"); 158 | connection.Approve(msg); 159 | } 160 | 161 | private void DenyConnection(NetConnection connection) 162 | { 163 | connection.Deny("denied"); 164 | } 165 | 166 | 167 | } 168 | 169 | 170 | } 171 | -------------------------------------------------------------------------------- /NetworkLayer/NetworkLayer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp1.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetCoreGameServer 2 | A very simple skeleton for a real time game server built in dotnet core. Also contains an example Unity client, and an example transport layer implementation with lidgren. 3 | --------------------------------------------------------------------------------