using LinePutScript;
using LinePutScript.Converter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet_Simulator.Windows.Interface;
///
/// 多人模式传输的消息
///
public struct MPMessage
{
///
/// 消息类型
///
public enum MSGType
{
///
/// 一般是出错或者空消息
///
Empty,
///
/// 聊天消息 (string)
///
Message,
///
/// 显示动画 (graphinfo)
///
DispayGraph,
///
/// 摸身体
///
TouchHead,
///
/// 摸头
///
TouchBody,
///
/// 喂食
///
Feed,
}
///
/// 消息类型
///
[Line] public MSGType Type { get; set; }
///
/// 消息内容
///
[Line] public string Content { get; set; }
///
/// 被操作者 (显示动画用)
///
[Line] public ulong To { get; set; }
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)));
}