diff options
| author | Sarah Bradley <git@sarahduck.ca> | 2023-12-16 21:15:14 -0800 |
|---|---|---|
| committer | Sarah Bradley <git@sarahduck.ca> | 2023-12-16 21:15:14 -0800 |
| commit | 217c93639fc6dee3222e0a3724dd5ed67b34f412 (patch) | |
| tree | 8a1373b2bf41e329b78d888aabea59745546aab8 /Net.cs | |
| parent | dbba03fe210a80f7d89d3ad021ec901a9196a537 (diff) | |
Network Oneko position!
Diffstat (limited to 'Net.cs')
| -rw-r--r-- | Net.cs | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1,4 +1,5 @@ using System.Buffers.Binary; +using System.Numerics; using LiteNetLib.Utils; namespace OnekoOnline.Net; @@ -32,12 +33,25 @@ public static class NetExtensions writer.Reset(size+PacketInfo.SizeOf); writer.Put(info); } + + public static void Put(this NetDataWriter writer, Vector2 vec2) + { + writer.Put(vec2.X); + writer.Put(vec2.Y); + } + + public static Vector2 GetVector2(this NetDataReader reader) + { + float X = reader.GetFloat(); + float Y = reader.GetFloat(); + return new Vector2(X, Y); + } } public enum PacketType : byte { MousePosition, - OnekoState, + OnekoTargetPosition, OnekoSpritesheet, Username, UserId, @@ -84,6 +98,7 @@ public struct PacketInfo class User(int id) { public readonly int Id = id; + public bool Initialized = false; //Oneko Stuff public byte[]? SpriteSheet; |
