From d9ac54bd3d506a0c9bedba0a851f0e05a31c5b2b Mon Sep 17 00:00:00 2001 From: teascade Date: Fri, 7 Aug 2020 21:20:13 +0300 Subject: [PATCH] Rename Net namespace to Networking and add MultiplePlayerUpdatePckt --- .../{Net => Networking}/CanvasInput.cs | 4 ++-- .../{Net => Networking}/CanvasInput.cs.meta | 0 .../{Net => Networking}/GameProtocol.cs | 6 +++--- .../{Net => Networking}/GameProtocol.cs.meta | 0 .../{Net => Networking}/Instances.meta | 0 .../{Net => Networking}/Instances/Client.cs | 4 ++-- .../Instances/Client.cs.meta | 0 .../Instances/NetInstance.cs | 4 ++-- .../Instances/NetInstance.cs.meta | 0 .../{Net => Networking}/Instances/Server.cs | 4 ++-- .../Instances/Server.cs.meta | 0 Assets/Scripts/{Net => Networking}/Net.cs | 4 ++-- .../Scripts/{Net => Networking}/Net.cs.meta | 0 .../{Net => Networking}/NetChaperone.cs | 4 ++-- .../{Net => Networking}/NetChaperone.cs.meta | 0 .../Scripts/{Net => Networking}/NetPlayer.cs | 3 ++- .../{Net => Networking}/NetPlayer.cs.meta | 0 .../Scripts/{Net => Networking}/Packets.meta | 0 .../{Net => Networking}/Packets/HelloPckt.cs | 2 +- .../Packets/HelloPckt.cs.meta | 0 .../Packets/PlayerUpdatePckt.cs | 21 ++++++++++++++++++- .../Packets/PlayerUpdatePckt.cs.meta | 0 .../{Net => Networking}/Packets/SpawnPckt.cs | 2 +- .../Packets/SpawnPckt.cs.meta | 0 Assets/Scripts/Player/LocalPlayer.cs | 8 +++---- Assets/Scripts/Player/Player.cs | 2 +- Assets/Scripts/Player/RemotePlayer.cs | 2 +- 27 files changed, 45 insertions(+), 25 deletions(-) rename Assets/Scripts/{Net => Networking}/CanvasInput.cs (96%) rename Assets/Scripts/{Net => Networking}/CanvasInput.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/GameProtocol.cs (90%) rename Assets/Scripts/{Net => Networking}/GameProtocol.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/Instances.meta (100%) rename Assets/Scripts/{Net => Networking}/Instances/Client.cs (97%) rename Assets/Scripts/{Net => Networking}/Instances/Client.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/Instances/NetInstance.cs (90%) rename Assets/Scripts/{Net => Networking}/Instances/NetInstance.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/Instances/Server.cs (97%) rename Assets/Scripts/{Net => Networking}/Instances/Server.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/Net.cs (90%) rename Assets/Scripts/{Net => Networking}/Net.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/NetChaperone.cs (97%) rename Assets/Scripts/{Net => Networking}/NetChaperone.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/NetPlayer.cs (76%) rename Assets/Scripts/{Net => Networking}/NetPlayer.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/Packets.meta (100%) rename Assets/Scripts/{Net => Networking}/Packets/HelloPckt.cs (86%) rename Assets/Scripts/{Net => Networking}/Packets/HelloPckt.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/Packets/PlayerUpdatePckt.cs (73%) rename Assets/Scripts/{Net => Networking}/Packets/PlayerUpdatePckt.cs.meta (100%) rename Assets/Scripts/{Net => Networking}/Packets/SpawnPckt.cs (95%) rename Assets/Scripts/{Net => Networking}/Packets/SpawnPckt.cs.meta (100%) diff --git a/Assets/Scripts/Net/CanvasInput.cs b/Assets/Scripts/Networking/CanvasInput.cs similarity index 96% rename from Assets/Scripts/Net/CanvasInput.cs rename to Assets/Scripts/Networking/CanvasInput.cs index 84cec5d..6a4d447 100644 --- a/Assets/Scripts/Net/CanvasInput.cs +++ b/Assets/Scripts/Networking/CanvasInput.cs @@ -2,10 +2,10 @@ using UnityEngine; using UnityEngine.UI; using NeonTea.Quakeball.TeaNet.Peers; -using NeonTea.Quakeball.Net.Packets; +using NeonTea.Quakeball.Networking.Packets; using System; -namespace NeonTea.Quakeball.Net { +namespace NeonTea.Quakeball.Networking { public class CanvasInput : MonoBehaviour, PeerMessageListener { public Button Host; public Button Join; diff --git a/Assets/Scripts/Net/CanvasInput.cs.meta b/Assets/Scripts/Networking/CanvasInput.cs.meta similarity index 100% rename from Assets/Scripts/Net/CanvasInput.cs.meta rename to Assets/Scripts/Networking/CanvasInput.cs.meta diff --git a/Assets/Scripts/Net/GameProtocol.cs b/Assets/Scripts/Networking/GameProtocol.cs similarity index 90% rename from Assets/Scripts/Net/GameProtocol.cs rename to Assets/Scripts/Networking/GameProtocol.cs index f7cc225..1b6c4fb 100644 --- a/Assets/Scripts/Net/GameProtocol.cs +++ b/Assets/Scripts/Networking/GameProtocol.cs @@ -3,10 +3,10 @@ using System; using UnityEngine; using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Packets; -using NeonTea.Quakeball.Net.Packets; -using NeonTea.Quakeball.Net.Instances; +using NeonTea.Quakeball.Networking.Packets; +using NeonTea.Quakeball.Networking.Instances; -namespace NeonTea.Quakeball.Net { +namespace NeonTea.Quakeball.Networking { public class GameProtocol : Protocol { public override byte Identifier => 0x7A; diff --git a/Assets/Scripts/Net/GameProtocol.cs.meta b/Assets/Scripts/Networking/GameProtocol.cs.meta similarity index 100% rename from Assets/Scripts/Net/GameProtocol.cs.meta rename to Assets/Scripts/Networking/GameProtocol.cs.meta diff --git a/Assets/Scripts/Net/Instances.meta b/Assets/Scripts/Networking/Instances.meta similarity index 100% rename from Assets/Scripts/Net/Instances.meta rename to Assets/Scripts/Networking/Instances.meta diff --git a/Assets/Scripts/Net/Instances/Client.cs b/Assets/Scripts/Networking/Instances/Client.cs similarity index 97% rename from Assets/Scripts/Net/Instances/Client.cs rename to Assets/Scripts/Networking/Instances/Client.cs index b56bc34..0ef9a1a 100644 --- a/Assets/Scripts/Net/Instances/Client.cs +++ b/Assets/Scripts/Networking/Instances/Client.cs @@ -2,12 +2,12 @@ using System.Collections.Generic; using UnityEngine; using NeonTea.Quakeball.Player; -using NeonTea.Quakeball.Net.Packets; +using NeonTea.Quakeball.Networking.Packets; using NeonTea.Quakeball.Interface; using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Packets; -namespace NeonTea.Quakeball.Net.Instances { +namespace NeonTea.Quakeball.Networking.Instances { public class Client : NetInstance { private NetChaperone Net; diff --git a/Assets/Scripts/Net/Instances/Client.cs.meta b/Assets/Scripts/Networking/Instances/Client.cs.meta similarity index 100% rename from Assets/Scripts/Net/Instances/Client.cs.meta rename to Assets/Scripts/Networking/Instances/Client.cs.meta diff --git a/Assets/Scripts/Net/Instances/NetInstance.cs b/Assets/Scripts/Networking/Instances/NetInstance.cs similarity index 90% rename from Assets/Scripts/Net/Instances/NetInstance.cs rename to Assets/Scripts/Networking/Instances/NetInstance.cs index ab41ef4..a9fb0c0 100644 --- a/Assets/Scripts/Net/Instances/NetInstance.cs +++ b/Assets/Scripts/Networking/Instances/NetInstance.cs @@ -1,11 +1,11 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using NeonTea.Quakeball.Net.Packets; +using NeonTea.Quakeball.Networking.Packets; using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Packets; -namespace NeonTea.Quakeball.Net.Instances { +namespace NeonTea.Quakeball.Networking.Instances { public abstract class NetInstance { protected static byte[] Fingerprint = new byte[] { 0xFF, 0xF7 }; diff --git a/Assets/Scripts/Net/Instances/NetInstance.cs.meta b/Assets/Scripts/Networking/Instances/NetInstance.cs.meta similarity index 100% rename from Assets/Scripts/Net/Instances/NetInstance.cs.meta rename to Assets/Scripts/Networking/Instances/NetInstance.cs.meta diff --git a/Assets/Scripts/Net/Instances/Server.cs b/Assets/Scripts/Networking/Instances/Server.cs similarity index 97% rename from Assets/Scripts/Net/Instances/Server.cs rename to Assets/Scripts/Networking/Instances/Server.cs index 9614c22..eb1cea1 100644 --- a/Assets/Scripts/Net/Instances/Server.cs +++ b/Assets/Scripts/Networking/Instances/Server.cs @@ -1,13 +1,13 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using NeonTea.Quakeball.Net.Packets; +using NeonTea.Quakeball.Networking.Packets; using NeonTea.Quakeball.Player; using NeonTea.Quakeball.Interface; using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Packets; -namespace NeonTea.Quakeball.Net.Instances { +namespace NeonTea.Quakeball.Networking.Instances { public class Server : NetInstance { private NetChaperone Net; diff --git a/Assets/Scripts/Net/Instances/Server.cs.meta b/Assets/Scripts/Networking/Instances/Server.cs.meta similarity index 100% rename from Assets/Scripts/Net/Instances/Server.cs.meta rename to Assets/Scripts/Networking/Instances/Server.cs.meta diff --git a/Assets/Scripts/Net/Net.cs b/Assets/Scripts/Networking/Net.cs similarity index 90% rename from Assets/Scripts/Net/Net.cs rename to Assets/Scripts/Networking/Net.cs index c302d86..185d184 100644 --- a/Assets/Scripts/Net/Net.cs +++ b/Assets/Scripts/Networking/Net.cs @@ -1,9 +1,9 @@ using UnityEngine; -using NeonTea.Quakeball.Net.Instances; +using NeonTea.Quakeball.Networking.Instances; using NeonTea.Quakeball.TeaNet.Peers; using System.Collections.Generic; -namespace NeonTea.Quakeball.Net { +namespace NeonTea.Quakeball.Networking { public class Net { public static Net Singleton = new Net(); diff --git a/Assets/Scripts/Net/Net.cs.meta b/Assets/Scripts/Networking/Net.cs.meta similarity index 100% rename from Assets/Scripts/Net/Net.cs.meta rename to Assets/Scripts/Networking/Net.cs.meta diff --git a/Assets/Scripts/Net/NetChaperone.cs b/Assets/Scripts/Networking/NetChaperone.cs similarity index 97% rename from Assets/Scripts/Net/NetChaperone.cs rename to Assets/Scripts/Networking/NetChaperone.cs index 079a915..8ca61de 100644 --- a/Assets/Scripts/Net/NetChaperone.cs +++ b/Assets/Scripts/Networking/NetChaperone.cs @@ -2,10 +2,10 @@ using System; using UnityEngine; using NeonTea.Quakeball.Interface; -using NeonTea.Quakeball.Net; +using NeonTea.Quakeball.Networking; using NeonTea.Quakeball.TeaNet.Peers; -namespace NeonTea.Quakeball.Net { +namespace NeonTea.Quakeball.Networking { public class NetChaperone : MonoBehaviour, PeerMessageListener { public GameObject SpawnedRemotePlayer; diff --git a/Assets/Scripts/Net/NetChaperone.cs.meta b/Assets/Scripts/Networking/NetChaperone.cs.meta similarity index 100% rename from Assets/Scripts/Net/NetChaperone.cs.meta rename to Assets/Scripts/Networking/NetChaperone.cs.meta diff --git a/Assets/Scripts/Net/NetPlayer.cs b/Assets/Scripts/Networking/NetPlayer.cs similarity index 76% rename from Assets/Scripts/Net/NetPlayer.cs rename to Assets/Scripts/Networking/NetPlayer.cs index 9b42ccd..d5a6a9a 100644 --- a/Assets/Scripts/Net/NetPlayer.cs +++ b/Assets/Scripts/Networking/NetPlayer.cs @@ -1,6 +1,7 @@ using UnityEngine; +using NeonTea.Quakeball.Player; -namespace NeonTea.Quakeball.Net { +namespace NeonTea.Quakeball.Networking { public class NetPlayer { public ulong Id; public GameObject Controlled; diff --git a/Assets/Scripts/Net/NetPlayer.cs.meta b/Assets/Scripts/Networking/NetPlayer.cs.meta similarity index 100% rename from Assets/Scripts/Net/NetPlayer.cs.meta rename to Assets/Scripts/Networking/NetPlayer.cs.meta diff --git a/Assets/Scripts/Net/Packets.meta b/Assets/Scripts/Networking/Packets.meta similarity index 100% rename from Assets/Scripts/Net/Packets.meta rename to Assets/Scripts/Networking/Packets.meta diff --git a/Assets/Scripts/Net/Packets/HelloPckt.cs b/Assets/Scripts/Networking/Packets/HelloPckt.cs similarity index 86% rename from Assets/Scripts/Net/Packets/HelloPckt.cs rename to Assets/Scripts/Networking/Packets/HelloPckt.cs index a8e6373..d40642a 100644 --- a/Assets/Scripts/Net/Packets/HelloPckt.cs +++ b/Assets/Scripts/Networking/Packets/HelloPckt.cs @@ -1,7 +1,7 @@ using NeonTea.Quakeball.TeaNet.Packets; -namespace NeonTea.Quakeball.Net.Packets { +namespace NeonTea.Quakeball.Networking.Packets { public class HelloPckt : Packet { public string Text; diff --git a/Assets/Scripts/Net/Packets/HelloPckt.cs.meta b/Assets/Scripts/Networking/Packets/HelloPckt.cs.meta similarity index 100% rename from Assets/Scripts/Net/Packets/HelloPckt.cs.meta rename to Assets/Scripts/Networking/Packets/HelloPckt.cs.meta diff --git a/Assets/Scripts/Net/Packets/PlayerUpdatePckt.cs b/Assets/Scripts/Networking/Packets/PlayerUpdatePckt.cs similarity index 73% rename from Assets/Scripts/Net/Packets/PlayerUpdatePckt.cs rename to Assets/Scripts/Networking/Packets/PlayerUpdatePckt.cs index 7d527ed..32d9b62 100644 --- a/Assets/Scripts/Net/Packets/PlayerUpdatePckt.cs +++ b/Assets/Scripts/Networking/Packets/PlayerUpdatePckt.cs @@ -1,7 +1,26 @@ using UnityEngine; using NeonTea.Quakeball.TeaNet.Packets; -namespace NeonTea.Quakeball.Net.Packets { +using System.Collections.Generic; +using NeonTea.Quakeball.Networking; + +namespace NeonTea.Quakeball.Networking.Packets { + public class MultiplePlayerUpdatesPckt : Packet { + + public List Updates = new List(); + + public MultiplePlayerUpdatesPckt() { } + + public MultiplePlayerUpdatesPckt(List players) { + } + + public override void Read(ByteBuffer buffer) { + } + + public override void Write(ByteBuffer buffer) { + } + } + public class PlayerUpdatePckt : Packet { public ulong PlayerId; diff --git a/Assets/Scripts/Net/Packets/PlayerUpdatePckt.cs.meta b/Assets/Scripts/Networking/Packets/PlayerUpdatePckt.cs.meta similarity index 100% rename from Assets/Scripts/Net/Packets/PlayerUpdatePckt.cs.meta rename to Assets/Scripts/Networking/Packets/PlayerUpdatePckt.cs.meta diff --git a/Assets/Scripts/Net/Packets/SpawnPckt.cs b/Assets/Scripts/Networking/Packets/SpawnPckt.cs similarity index 95% rename from Assets/Scripts/Net/Packets/SpawnPckt.cs rename to Assets/Scripts/Networking/Packets/SpawnPckt.cs index c1ff43b..493d9da 100644 --- a/Assets/Scripts/Net/Packets/SpawnPckt.cs +++ b/Assets/Scripts/Networking/Packets/SpawnPckt.cs @@ -1,7 +1,7 @@ using UnityEngine; using NeonTea.Quakeball.TeaNet.Packets; -namespace NeonTea.Quakeball.Net.Packets { +namespace NeonTea.Quakeball.Networking.Packets { public class SpawnPckt : Packet { public ulong PlayerId; diff --git a/Assets/Scripts/Net/Packets/SpawnPckt.cs.meta b/Assets/Scripts/Networking/Packets/SpawnPckt.cs.meta similarity index 100% rename from Assets/Scripts/Net/Packets/SpawnPckt.cs.meta rename to Assets/Scripts/Networking/Packets/SpawnPckt.cs.meta diff --git a/Assets/Scripts/Player/LocalPlayer.cs b/Assets/Scripts/Player/LocalPlayer.cs index 509b023..b3f84f5 100644 --- a/Assets/Scripts/Player/LocalPlayer.cs +++ b/Assets/Scripts/Player/LocalPlayer.cs @@ -1,7 +1,7 @@ using UnityEngine; using UnityEngine.InputSystem; -using NeonTea.Quakeball.Net; -using NeonTea.Quakeball.Net.Packets; +using NeonTea.Quakeball.Networking; +using NeonTea.Quakeball.Networking.Packets; namespace NeonTea.Quakeball.Player { /// A controller class for a local player. Handles input and updates the relevant components. @@ -82,8 +82,8 @@ namespace NeonTea.Quakeball.Player { PreviousPlayerUpdate = Time.time; WantsToJump = false; - if (Net.Net.Singleton.Instance != null) { - Net.Net.Singleton.Instance.UpdateLocalPlayer(Player.CreatePacket()); + if (Networking.Net.Singleton.Instance != null) { + Networking.Net.Singleton.Instance.UpdateLocalPlayer(Player.CreatePacket()); } } } diff --git a/Assets/Scripts/Player/Player.cs b/Assets/Scripts/Player/Player.cs index f432b1b..48d0bef 100644 --- a/Assets/Scripts/Player/Player.cs +++ b/Assets/Scripts/Player/Player.cs @@ -1,5 +1,5 @@ using UnityEngine; -using NeonTea.Quakeball.Net.Packets; +using NeonTea.Quakeball.Networking.Packets; namespace NeonTea.Quakeball.Player { /// The central glue class for players (both local and remote). diff --git a/Assets/Scripts/Player/RemotePlayer.cs b/Assets/Scripts/Player/RemotePlayer.cs index 1ebcb07..745ce7b 100644 --- a/Assets/Scripts/Player/RemotePlayer.cs +++ b/Assets/Scripts/Player/RemotePlayer.cs @@ -1,5 +1,5 @@ using UnityEngine; -using NeonTea.Quakeball.Net.Packets; +using NeonTea.Quakeball.Networking.Packets; using NeonTea.Quakeball.Interface; namespace NeonTea.Quakeball.Player {