1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-24 21:48:35 +01:00

Compare commits

...

2 commits

6 changed files with 19 additions and 6 deletions

View file

@ -67,6 +67,9 @@ Improvements
- **Use TitleContainer for opening streams where possible** - **Use TitleContainer for opening streams where possible**
- Set GraphicsResource Name when loading assets using RawContentManager - Set GraphicsResource Name when loading assets using RawContentManager
Removals
- Marked features related to Lidgren.Network as obsolete
## 5.1.0 ## 5.1.0
### MLEM ### MLEM
Additions Additions

View file

@ -14,7 +14,7 @@
- **MLEM** is the base package, which provides extension methods and additional features for MonoGame - **MLEM** is the base package, which provides extension methods and additional features for MonoGame
- **MLEM.Ui** features a mouse, keyboard, gamepad and touch ready Ui system that features automatic anchoring, sizing and several ready-to-use element types - **MLEM.Ui** features a mouse, keyboard, gamepad and touch ready Ui system that features automatic anchoring, sizing and several ready-to-use element types
- **MLEM.Extended** ties in with MonoGame.Extended and other MonoGame libraries - **MLEM.Extended** ties in with MonoGame.Extended and other MonoGame libraries
- **MLEM.Data** provides simple data and network handling - **MLEM.Data** provides simple data handling
- **MLEM.Startup** combines MLEM with some other useful libraries into a quick Game startup class - **MLEM.Startup** combines MLEM with some other useful libraries into a quick Game startup class
- **MLEM.Templates** contains cross-platform project templates - **MLEM.Templates** contains cross-platform project templates

View file

@ -7,9 +7,9 @@
<PropertyGroup> <PropertyGroup>
<Authors>Ellpeck</Authors> <Authors>Ellpeck</Authors>
<Description>Simple data and network handling for MLEM Library for Extending MonoGame</Description> <Description>Simple data handling for MLEM Library for Extending MonoGame</Description>
<PackageReleaseNotes>See the full changelog at https://mlem.ellpeck.de/CHANGELOG</PackageReleaseNotes> <PackageReleaseNotes>See the full changelog at https://mlem.ellpeck.de/CHANGELOG</PackageReleaseNotes>
<PackageTags>monogame ellpeck mlem utility extensions data network serialize</PackageTags> <PackageTags>monogame ellpeck mlem utility extensions data serialize</PackageTags>
<PackageProjectUrl>https://mlem.ellpeck.de/</PackageProjectUrl> <PackageProjectUrl>https://mlem.ellpeck.de/</PackageProjectUrl>
<RepositoryUrl>https://github.com/Ellpeck/MLEM</RepositoryUrl> <RepositoryUrl>https://github.com/Ellpeck/MLEM</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
@ -22,13 +22,14 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<ProjectReference Include="..\MLEM\MLEM.csproj" /> <ProjectReference Include="..\MLEM\MLEM.csproj" />
<!--TODO remove lidgren support eventually (methods marked as obsolete since 5.2.0)-->
<PackageReference Include="Lidgren.Network" Version="1.0.2"> <PackageReference Include="Lidgren.Network" Version="1.0.2">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641"> <PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2"> <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>

View file

@ -10,6 +10,7 @@ namespace MLEM.Data {
/// It can be used both for serialization of outgoing packets, and deserialization of incoming packets. /// It can be used both for serialization of outgoing packets, and deserialization of incoming packets.
/// Before serializing and deserializing an object, each of the object's fields has to have a handler. New handlers can be added using <see cref="AddHandler{T}(System.Action{Lidgren.Network.NetBuffer,T},System.Func{Lidgren.Network.NetBuffer,T})"/> or <see cref="AddHandler{T}(Newtonsoft.Json.JsonSerializer)"/>. /// Before serializing and deserializing an object, each of the object's fields has to have a handler. New handlers can be added using <see cref="AddHandler{T}(System.Action{Lidgren.Network.NetBuffer,T},System.Func{Lidgren.Network.NetBuffer,T})"/> or <see cref="AddHandler{T}(Newtonsoft.Json.JsonSerializer)"/>.
/// </summary> /// </summary>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public class NetBufferSerializer { public class NetBufferSerializer {
private readonly Dictionary<Type, Action<NetBuffer, object>> writeFunctions = new Dictionary<Type, Action<NetBuffer, object>>(); private readonly Dictionary<Type, Action<NetBuffer, object>> writeFunctions = new Dictionary<Type, Action<NetBuffer, object>>();

View file

@ -19,6 +19,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to write to</param> /// <param name="buffer">The buffer to write to</param>
/// <param name="vector">The vector to write</param> /// <param name="vector">The vector to write</param>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static void Write(this NetBuffer buffer, Vector2 vector) { public static void Write(this NetBuffer buffer, Vector2 vector) {
buffer.Write(vector.X); buffer.Write(vector.X);
buffer.Write(vector.Y); buffer.Write(vector.Y);
@ -29,6 +30,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to read from</param> /// <param name="buffer">The buffer to read from</param>
/// <returns>The read vector</returns> /// <returns>The read vector</returns>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static Vector2 ReadVector2(this NetBuffer buffer) { public static Vector2 ReadVector2(this NetBuffer buffer) {
return new Vector2(buffer.ReadFloat(), buffer.ReadFloat()); return new Vector2(buffer.ReadFloat(), buffer.ReadFloat());
} }
@ -38,6 +40,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to write to</param> /// <param name="buffer">The buffer to write to</param>
/// <param name="guid">The guid to write</param> /// <param name="guid">The guid to write</param>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static void Write(this NetBuffer buffer, Guid guid) { public static void Write(this NetBuffer buffer, Guid guid) {
buffer.Write(guid.ToByteArray()); buffer.Write(guid.ToByteArray());
} }
@ -47,6 +50,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to read from</param> /// <param name="buffer">The buffer to read from</param>
/// <returns>The read guid</returns> /// <returns>The read guid</returns>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static Guid ReadGuid(this NetBuffer buffer) { public static Guid ReadGuid(this NetBuffer buffer) {
return new Guid(buffer.ReadBytes(16)); return new Guid(buffer.ReadBytes(16));
} }
@ -56,6 +60,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to write to</param> /// <param name="buffer">The buffer to write to</param>
/// <param name="direction">The direction to write</param> /// <param name="direction">The direction to write</param>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static void Write(this NetBuffer buffer, Direction2 direction) { public static void Write(this NetBuffer buffer, Direction2 direction) {
buffer.Write((short) direction); buffer.Write((short) direction);
} }
@ -65,6 +70,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to read from</param> /// <param name="buffer">The buffer to read from</param>
/// <returns>The read direction</returns> /// <returns>The read direction</returns>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static Direction2 ReadDirection(this NetBuffer buffer) { public static Direction2 ReadDirection(this NetBuffer buffer) {
return (Direction2) buffer.ReadInt16(); return (Direction2) buffer.ReadInt16();
} }
@ -76,6 +82,7 @@ namespace MLEM.Data {
/// <param name="obj">The object to write</param> /// <param name="obj">The object to write</param>
/// <param name="serializer">The JSON serializer to use</param> /// <param name="serializer">The JSON serializer to use</param>
/// <typeparam name="T">The type of object written</typeparam> /// <typeparam name="T">The type of object written</typeparam>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static void WriteObject<T>(this NetBuffer buffer, T obj, JsonSerializer serializer) { public static void WriteObject<T>(this NetBuffer buffer, T obj, JsonSerializer serializer) {
if (EqualityComparer<T>.Default.Equals(obj, default)) { if (EqualityComparer<T>.Default.Equals(obj, default)) {
buffer.Write(0); buffer.Write(0);
@ -97,6 +104,7 @@ namespace MLEM.Data {
/// <param name="serializer">The JSON serializer to use</param> /// <param name="serializer">The JSON serializer to use</param>
/// <typeparam name="T">The type of object read</typeparam> /// <typeparam name="T">The type of object read</typeparam>
/// <returns>The read object</returns> /// <returns>The read object</returns>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static T ReadObject<T>(this NetBuffer buffer, JsonSerializer serializer) { public static T ReadObject<T>(this NetBuffer buffer, JsonSerializer serializer) {
var length = buffer.ReadInt32(); var length = buffer.ReadInt32();
if (length <= 0) if (length <= 0)

View file

@ -14,7 +14,7 @@
- **MLEM** is the base package, which provides extension methods and additional features for MonoGame - **MLEM** is the base package, which provides extension methods and additional features for MonoGame
- **MLEM.Ui** features a mouse, keyboard, gamepad and touch ready Ui system that features automatic anchoring, sizing and several ready-to-use element types - **MLEM.Ui** features a mouse, keyboard, gamepad and touch ready Ui system that features automatic anchoring, sizing and several ready-to-use element types
- **MLEM.Extended** ties in with MonoGame.Extended and other MonoGame libraries - **MLEM.Extended** ties in with MonoGame.Extended and other MonoGame libraries
- **MLEM.Data** provides simple data and network handling - **MLEM.Data** provides simple data handling
- **MLEM.Startup** combines MLEM with some other useful libraries into a quick Game startup class - **MLEM.Startup** combines MLEM with some other useful libraries into a quick Game startup class
- **MLEM.Templates** contains cross-platform project templates - **MLEM.Templates** contains cross-platform project templates