From 1b594fcb66a3c5f4b2703aa60e0eec602ddc68ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sat, 1 Jan 2022 10:53:36 +0100 Subject: [PATCH] fix: use NosSmooth.Packets in SimpleChat sample --- Samples/SimpleChat/SayResponder.cs | 32 +++++++++++--------------- Samples/SimpleChat/SimpleChat.cs | 36 +++++++++++++----------------- 2 files changed, 29 insertions(+), 39 deletions(-) diff --git a/Samples/SimpleChat/SayResponder.cs b/Samples/SimpleChat/SayResponder.cs index 478a254..e19c67c 100644 --- a/Samples/SimpleChat/SayResponder.cs +++ b/Samples/SimpleChat/SayResponder.cs @@ -4,12 +4,11 @@ // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using NosCore.Packets.Enumerations; -using NosCore.Packets.ServerPackets.Chats; -using NosCore.Packets.ServerPackets.UI; -using NosCore.Shared.Enumerations; using NosSmooth.Core.Client; using NosSmooth.Core.Packets; +using NosSmooth.Packets.Enums; +using NosSmooth.Packets.Enums.Chat; +using NosSmooth.Packets.Packets.Server.Chat; using Remora.Results; namespace SimpleChat; @@ -33,25 +32,20 @@ public class SayResponder : IPacketResponder, IPacketResponder public Task Respond(PacketEventArgs packet, CancellationToken ct = default) { - return _client.ReceivePacketAsync( - new SayPacket() - { - Message = "Hello world from NosSmooth!", VisualType = VisualType.Player, Type = SayColorType.Red, VisualId = 1, - }, - ct); + return _client.ReceivePacketAsync + ( + new SayPacket(EntityType.Map, 1, SayColor.Red, "Hello world from NosSmooth!"), + ct + ); } /// public Task Respond(PacketEventArgs packet, CancellationToken ct = default) { - return _client.ReceivePacketAsync( - new SayPacket() - { - Message = "Hello world from NosSmooth!", - VisualType = VisualType.Player, - Type = SayColorType.Red, - VisualId = 1, - }, - ct); + return _client.ReceivePacketAsync + ( + new SayPacket(EntityType.Map, 1, SayColor.Red, "Hello world from NosSmooth!"), + ct + ); } } \ No newline at end of file diff --git a/Samples/SimpleChat/SimpleChat.cs b/Samples/SimpleChat/SimpleChat.cs index 91bf011..b368f0d 100644 --- a/Samples/SimpleChat/SimpleChat.cs +++ b/Samples/SimpleChat/SimpleChat.cs @@ -6,12 +6,11 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using NosCore.Packets.Enumerations; -using NosCore.Packets.ServerPackets.Chats; -using NosCore.Shared.Enumerations; using NosSmooth.Core.Client; -using NosSmooth.Core.Packets; using NosSmooth.LocalClient.Extensions; +using NosSmooth.Packets.Enums; +using NosSmooth.Packets.Enums.Chat; +using NosSmooth.Packets.Packets.Server.Chat; namespace SimpleChat; @@ -30,29 +29,26 @@ public class SimpleChat .AddLocalClient() // .AddPacketResponder() - .AddLogging(b => - { - b.ClearProviders(); - b.AddConsole(); - b.SetMinimumLevel(LogLevel.Debug); - }) + .AddLogging + ( + b => + { + b.ClearProviders(); + b.AddConsole(); + b.SetMinimumLevel(LogLevel.Debug); + } + ) .BuildServiceProvider(); - var dummy1 = provider.GetRequiredService().ServerSerializer; - var dummy2 = provider.GetRequiredService().ClientSerializer; - var logger = provider.GetRequiredService>(); logger.LogInformation("Hello world from SimpleChat!"); var client = provider.GetRequiredService(); - await client.ReceivePacketAsync(new SayPacket() - { - Message = "Hello world from NosSmooth!", - VisualType = VisualType.Player, - Type = SayColorType.Red, - VisualId = 1, - }); + await client.ReceivePacketAsync + ( + new SayPacket(EntityType.Map, 1, SayColor.Red, "Hello world from NosSmooth!") + ); await client.RunAsync(); } -- 2.48.1