32 lines
791 B
C#
32 lines
791 B
C#
using System.Collections.Generic;
|
|
using Fantasy;
|
|
using Fantasy.Entitas;
|
|
using Fantasy.Helper;
|
|
using Fantasy.Serialize;
|
|
using NB.Game;
|
|
|
|
namespace NB.Chat;
|
|
|
|
public static class MailFactory
|
|
{
|
|
private static readonly ISerialize _serializer = SerializerManager.BsonPack;
|
|
|
|
public static Mail Create(Scene scene, string content, List<AwardItem> items = null)
|
|
{
|
|
|
|
var mail = Entity.Create<Mail>(scene, true, true);
|
|
mail.Content = content;
|
|
mail.State = MailState.Unread;
|
|
mail.CreateTime = TimeHelper.Now;
|
|
|
|
if (items != null && items.Count > 0)
|
|
{
|
|
foreach (var item in items)
|
|
{
|
|
// mail.Items.Add(_serializer.Clone(item));
|
|
}
|
|
}
|
|
|
|
return mail;
|
|
}
|
|
} |