Rename Net namespace to Networking and add MultiplePlayerUpdatePckt

This commit is contained in:
Sofia 2020-08-07 21:20:13 +03:00
parent b34edcab2d
commit d9ac54bd3d
27 changed files with 45 additions and 25 deletions

View File

@ -2,10 +2,10 @@
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Peers;
using NeonTea.Quakeball.Net.Packets; using NeonTea.Quakeball.Networking.Packets;
using System; using System;
namespace NeonTea.Quakeball.Net { namespace NeonTea.Quakeball.Networking {
public class CanvasInput : MonoBehaviour, PeerMessageListener { public class CanvasInput : MonoBehaviour, PeerMessageListener {
public Button Host; public Button Host;
public Button Join; public Button Join;

View File

@ -3,10 +3,10 @@ using System;
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Peers;
using NeonTea.Quakeball.TeaNet.Packets; using NeonTea.Quakeball.TeaNet.Packets;
using NeonTea.Quakeball.Net.Packets; using NeonTea.Quakeball.Networking.Packets;
using NeonTea.Quakeball.Net.Instances; using NeonTea.Quakeball.Networking.Instances;
namespace NeonTea.Quakeball.Net { namespace NeonTea.Quakeball.Networking {
public class GameProtocol : Protocol { public class GameProtocol : Protocol {
public override byte Identifier => 0x7A; public override byte Identifier => 0x7A;

View File

@ -2,12 +2,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.Player; using NeonTea.Quakeball.Player;
using NeonTea.Quakeball.Net.Packets; using NeonTea.Quakeball.Networking.Packets;
using NeonTea.Quakeball.Interface; using NeonTea.Quakeball.Interface;
using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Peers;
using NeonTea.Quakeball.TeaNet.Packets; using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Net.Instances { namespace NeonTea.Quakeball.Networking.Instances {
public class Client : NetInstance { public class Client : NetInstance {
private NetChaperone Net; private NetChaperone Net;

View File

@ -1,11 +1,11 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.Net.Packets; using NeonTea.Quakeball.Networking.Packets;
using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Peers;
using NeonTea.Quakeball.TeaNet.Packets; using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Net.Instances { namespace NeonTea.Quakeball.Networking.Instances {
public abstract class NetInstance { public abstract class NetInstance {
protected static byte[] Fingerprint = new byte[] { 0xFF, 0xF7 }; protected static byte[] Fingerprint = new byte[] { 0xFF, 0xF7 };

View File

@ -1,13 +1,13 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.Net.Packets; using NeonTea.Quakeball.Networking.Packets;
using NeonTea.Quakeball.Player; using NeonTea.Quakeball.Player;
using NeonTea.Quakeball.Interface; using NeonTea.Quakeball.Interface;
using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Peers;
using NeonTea.Quakeball.TeaNet.Packets; using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Net.Instances { namespace NeonTea.Quakeball.Networking.Instances {
public class Server : NetInstance { public class Server : NetInstance {
private NetChaperone Net; private NetChaperone Net;

View File

@ -1,9 +1,9 @@
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.Net.Instances; using NeonTea.Quakeball.Networking.Instances;
using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Peers;
using System.Collections.Generic; using System.Collections.Generic;
namespace NeonTea.Quakeball.Net { namespace NeonTea.Quakeball.Networking {
public class Net { public class Net {
public static Net Singleton = new Net(); public static Net Singleton = new Net();

View File

@ -2,10 +2,10 @@
using System; using System;
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.Interface; using NeonTea.Quakeball.Interface;
using NeonTea.Quakeball.Net; using NeonTea.Quakeball.Networking;
using NeonTea.Quakeball.TeaNet.Peers; using NeonTea.Quakeball.TeaNet.Peers;
namespace NeonTea.Quakeball.Net { namespace NeonTea.Quakeball.Networking {
public class NetChaperone : MonoBehaviour, PeerMessageListener { public class NetChaperone : MonoBehaviour, PeerMessageListener {
public GameObject SpawnedRemotePlayer; public GameObject SpawnedRemotePlayer;

View File

@ -1,6 +1,7 @@
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.Player;
namespace NeonTea.Quakeball.Net { namespace NeonTea.Quakeball.Networking {
public class NetPlayer { public class NetPlayer {
public ulong Id; public ulong Id;
public GameObject Controlled; public GameObject Controlled;

View File

@ -1,7 +1,7 @@
using NeonTea.Quakeball.TeaNet.Packets; using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Net.Packets { namespace NeonTea.Quakeball.Networking.Packets {
public class HelloPckt : Packet { public class HelloPckt : Packet {
public string Text; public string Text;

View File

@ -1,7 +1,26 @@
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.TeaNet.Packets; 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<PlayerUpdatePckt> Updates = new List<PlayerUpdatePckt>();
public MultiplePlayerUpdatesPckt() { }
public MultiplePlayerUpdatesPckt(List<NetPlayer> players) {
}
public override void Read(ByteBuffer buffer) {
}
public override void Write(ByteBuffer buffer) {
}
}
public class PlayerUpdatePckt : Packet { public class PlayerUpdatePckt : Packet {
public ulong PlayerId; public ulong PlayerId;

View File

@ -1,7 +1,7 @@
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.TeaNet.Packets; using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Net.Packets { namespace NeonTea.Quakeball.Networking.Packets {
public class SpawnPckt : Packet { public class SpawnPckt : Packet {
public ulong PlayerId; public ulong PlayerId;

View File

@ -1,7 +1,7 @@
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
using NeonTea.Quakeball.Net; using NeonTea.Quakeball.Networking;
using NeonTea.Quakeball.Net.Packets; using NeonTea.Quakeball.Networking.Packets;
namespace NeonTea.Quakeball.Player { namespace NeonTea.Quakeball.Player {
/// <summary>A controller class for a local player. Handles input and updates the relevant components.</summary> /// <summary>A controller class for a local player. Handles input and updates the relevant components.</summary>
@ -82,8 +82,8 @@ namespace NeonTea.Quakeball.Player {
PreviousPlayerUpdate = Time.time; PreviousPlayerUpdate = Time.time;
WantsToJump = false; WantsToJump = false;
if (Net.Net.Singleton.Instance != null) { if (Networking.Net.Singleton.Instance != null) {
Net.Net.Singleton.Instance.UpdateLocalPlayer(Player.CreatePacket()); Networking.Net.Singleton.Instance.UpdateLocalPlayer(Player.CreatePacket());
} }
} }
} }

View File

@ -1,5 +1,5 @@
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.Net.Packets; using NeonTea.Quakeball.Networking.Packets;
namespace NeonTea.Quakeball.Player { namespace NeonTea.Quakeball.Player {
/// <summary>The central glue class for players (both local and remote).</summary> /// <summary>The central glue class for players (both local and remote).</summary>

View File

@ -1,5 +1,5 @@
using UnityEngine; using UnityEngine;
using NeonTea.Quakeball.Net.Packets; using NeonTea.Quakeball.Networking.Packets;
using NeonTea.Quakeball.Interface; using NeonTea.Quakeball.Interface;
namespace NeonTea.Quakeball.Player { namespace NeonTea.Quakeball.Player {