using Milimoe.FunGame.Core.Api.Factory; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Core.Api.Utility { public class Factory { private readonly static CharacterFactory CharacterFactory = new(); private readonly static InventoryFactory InventoryFactory = new(); private readonly static ItemFactory ItemFactory = new(); private readonly static RoomFactory RoomFactory = new(); private readonly static SkillFactory SkillFactory = new(); private readonly static UserFactory UserFactory = new(); /// /// 获取角色实例 /// /// public static Character GetCharacter() { return CharacterFactory.Create(); } /// /// 获取库存实例 /// /// public static Inventory GetInventory() { return InventoryFactory.Create(); } /// /// 获取物品实例,默认返回Passiveitem 被动物品 需要强制转换 /// /// Item类型 主动 或 被动 /// public static Item GetItem(ItemType type = ItemType.Passive) { return ItemFactory.Create(type); } /// /// 获取主动物品实例 /// /// public static ActiveItem GetActiveItem() { return (ActiveItem)ItemFactory.Create(ItemType.Active); } /// /// 获取被动物品实例 /// /// public static PassiveItem GetPassiveItem() { return (PassiveItem)ItemFactory.Create(ItemType.Passive); } /// /// 获取房间实例 /// /// 房间内部序列号 /// 房间号 /// 创建时间 /// 房主 /// 房间类型 /// 房间状态 /// 房间密码 /// public static Room GetRoom(long Id = 0, string Roomid = "-1", DateTime? CreateTime = null, User? RoomMaster = null, RoomType RoomType = RoomType.None, RoomState RoomState = RoomState.Created, string Password = "") { return RoomFactory.Create(Id, Roomid, CreateTime, RoomMaster, RoomType, RoomState, Password); } /// /// 获取大厅(-1号房) /// /// internal static Room GetHall() { return RoomFactory.Create(); } /// /// 获取技能实例,默认返回PassiveSkill 被动技能 需要强制转换 /// /// Skill类型 主动 或 被动 /// public static Skill GetSkill(SkillType type = SkillType.Passive) { return SkillFactory.Create(type); } /// /// 获取主动技能实例 /// /// public static ActiveSkill GetActiveSkill() { return (ActiveSkill)SkillFactory.Create(SkillType.Active); } /// /// 获取被动技能实例 /// /// public static PassiveSkill GetPassiveSkill() { return (PassiveSkill)SkillFactory.Create(SkillType.Passive); } /// /// 获取用户实例 /// /// public static User GetUser() { return UserFactory.Create(); } } }