From 7fd2f74740a04057f30de4955d05435e8b178c53 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Mon, 18 Mar 2024 21:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E6=9C=BA=E5=8A=9F=E8=83=BD=E5=AE=9E?= =?UTF-8?q?=E8=A3=85:=20=E8=81=8A=E5=A4=A9&=E5=8A=A8=E7=94=BB=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/ToolBar.xaml | 2 +- .../VPet-Simulator.Core.csproj | 2 +- VPet-Simulator.Windows.Interface/MPMessage.cs | 53 +++++++- VPet-Simulator.Windows.Interface/TalkBox.xaml | 2 +- .../VPet-Simulator.Windows.Interface.csproj | 2 +- .../MutiPlayer/MPFriends.xaml | 24 ++++ .../MutiPlayer/MPFriends.xaml.cs | 123 +++++++++++++++++- .../MutiPlayer/winMutiPlayer.xaml.cs | 64 ++++++--- .../VPet-Simulator.Windows.csproj | 2 +- VPet.Solution/VPet.Solution.csproj | 2 +- 10 files changed, 244 insertions(+), 32 deletions(-) diff --git a/VPet-Simulator.Core/Display/ToolBar.xaml b/VPet-Simulator.Core/Display/ToolBar.xaml index 059dddd..7b40c8b 100644 --- a/VPet-Simulator.Core/Display/ToolBar.xaml +++ b/VPet-Simulator.Core/Display/ToolBar.xaml @@ -109,7 +109,7 @@ diff --git a/VPet-Simulator.Core/VPet-Simulator.Core.csproj b/VPet-Simulator.Core/VPet-Simulator.Core.csproj index 8c5d80e..2589545 100644 --- a/VPet-Simulator.Core/VPet-Simulator.Core.csproj +++ b/VPet-Simulator.Core/VPet-Simulator.Core.csproj @@ -26,7 +26,7 @@ - + diff --git a/VPet-Simulator.Windows.Interface/MPMessage.cs b/VPet-Simulator.Windows.Interface/MPMessage.cs index ac4658e..6818db0 100644 --- a/VPet-Simulator.Windows.Interface/MPMessage.cs +++ b/VPet-Simulator.Windows.Interface/MPMessage.cs @@ -5,6 +5,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Interop; +using VPet_Simulator.Core; namespace VPet_Simulator.Windows.Interface; @@ -23,9 +25,9 @@ public struct MPMessage /// Empty, /// - /// 聊天消息 (string) + /// 聊天消息 (chat) /// - Message, + Chat, /// /// 显示动画 (graphinfo) /// @@ -51,7 +53,7 @@ public struct MPMessage /// /// 消息内容 /// - [Line] public string Content { get; set; } + [Line] private string Content { get; set; } /// /// 被操作者 (显示动画用) /// @@ -59,4 +61,49 @@ public struct MPMessage public static byte[] ConverTo(MPMessage data) => Encoding.UTF8.GetBytes(LPSConvert.SerializeObject(data).ToString()); public static MPMessage ConverTo(byte[] data) => LPSConvert.DeserializeObject(new LPS(Encoding.UTF8.GetString(data))); + + public void SetContent(object content) + { + Content = LPSConvert.GetObjectString(content, convertNoneLineAttribute: true); + } + public T GetContent() + { + return (T)LPSConvert.GetStringObject(Content, typeof(T), convertNoneLineAttribute: true); + } + /// + /// 聊天结构 + /// + public struct Chat + { + /// + /// 聊天内容 + /// + public string Content { get; set; } + /// + /// 消息类型 + /// + public enum Type + { + /// + /// 私有 + /// + Private, + /// + /// 半公开 + /// + Internal, + /// + /// 公开 + /// + Public + } + /// + /// 聊天类型 + /// + public Type ChatType { get; set; } + /// + /// 发送者名字 + /// + public string SendName { get; set; } + } } diff --git a/VPet-Simulator.Windows.Interface/TalkBox.xaml b/VPet-Simulator.Windows.Interface/TalkBox.xaml index 26bc2bb..0a97e02 100644 --- a/VPet-Simulator.Windows.Interface/TalkBox.xaml +++ b/VPet-Simulator.Windows.Interface/TalkBox.xaml @@ -6,7 +6,7 @@ xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF" mc:Ignorable="d" xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Height="500" Width="500" VerticalAlignment="Top"> + VerticalAlignment="Top" Margin="5" CornerRadius="5" Padding="5,5,5,3"> diff --git a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj index c8a798d..c64364b 100644 --- a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj +++ b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj @@ -19,6 +19,6 @@ - + \ No newline at end of file diff --git a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml index 83191ef..699ec20 100644 --- a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml +++ b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml @@ -10,6 +10,30 @@ + + + + + + + + + + + +