Change font mat to mobile version, remove RemotePlayer packet queueing

This commit is contained in:
Jens Pitkänen 2020-08-07 22:56:23 +03:00
parent 92165cebc2
commit ade4eeb8f5
6 changed files with 808 additions and 696 deletions

File diff suppressed because one or more lines are too long

View File

@ -90,7 +90,7 @@ namespace NeonTea.Quakeball.Networking.Instances {
if (pckt.PlayerId == LocalPlayer.Id) {
return; // Ignore, again.
}
Players[pckt.PlayerId].Controlled.GetComponent<RemotePlayer>().QueuePacket(pckt);
Players[pckt.PlayerId].Controlled.GetComponent<RemotePlayer>().ProcessPacket(pckt);
}
}
}

View File

@ -78,7 +78,7 @@ namespace NeonTea.Quakeball.Networking.Instances {
PlayerUpdatePckt updatePckt = (PlayerUpdatePckt)packet;
if (Players[conn.uid].Controlled != null) {
updatePckt.PlayerId = conn.uid;
Players[conn.uid].Controlled.GetComponent<RemotePlayer>().QueuePacket(updatePckt);
Players[conn.uid].Controlled.GetComponent<RemotePlayer>().ProcessPacket(updatePckt);
}
}
}

View File

@ -8,7 +8,7 @@ MonoImporter:
- CrouchingMoveStyle: {fileID: 11400000, guid: 2d9739d3745581a41ae0ed6a569766d5, type: 2}
- Head: {instanceID: 0}
- MoveStyle: {instanceID: 0}
executionOrder: 5
executionOrder: 100
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@ -7,31 +7,13 @@ namespace NeonTea.Quakeball.Players {
[RequireComponent(typeof(Player))]
public class RemotePlayer : MonoBehaviour {
private Player Player;
private PlayerUpdatePckt QueuedPckt = null;
private float LastUpdateTime = -1;
public void QueuePacket(PlayerUpdatePckt packet) {
if (QueuedPckt != null) {
string Warning = "Can't keep up! Got another packet while one was still in queue, fast-forwarding (and probably desyncing)!";
Debug.LogWarning(Warning);
Terminal.Singleton.Println($"<color={Terminal.ERROR_COLOR}>{Warning}</color>");
// Re-sync?
Player.ProcessPacket(ref QueuedPckt);
LastUpdateTime = Time.time;
}
QueuedPckt = packet;
public void ProcessPacket(PlayerUpdatePckt packet) {
Player.ProcessPacket(ref packet);
}
private void Awake() {
Player = GetComponent<Player>();
}
private void Update() {
if (Time.time - LastUpdateTime >= 1f / Player.UpdateFrequency && QueuedPckt != null) {
Player.ProcessPacket(ref QueuedPckt);
LastUpdateTime = Time.time;
}
}
}
}

View File

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
executionOrder: 50
icon: {instanceID: 0}
userData:
assetBundleName: