public override MyObjectBuilder_ComponentBase Serialize() { var ob = base.Serialize() as MyObjectBuilder_InventoryBase; ob.InventoryId = InventoryId.ToString(); return(ob); }
public CreateInventory( InventoryId id, int qty, InventoryItem item, IEnumerable <InventoryConstraint> constraints) { this.Id = id; this.Qty = qty; this.Item = item; this.Constraints = constraints; }
public ServiceTests() { id = new InventoryId(); var createdCmd = new CreateInventory(id, 10, new InventoryItem(), new[] { new InventoryConstraint(InventoryConstraintType.MaxQty, "20", TypeCode.Int32), }); inventory = Inventory.Create(createdCmd); mockRepository = Substitute.For <IInventoryRepository>(); mockRepository.GenerateInventoryId().Returns(id); }
public InventoryTests() { AssetMapping.GlobalIsThreadLocal = true; AssetMapping.Global.Clear() .RegisterAssetType(typeof(Base.PartyMember), AssetType.Party) .RegisterAssetType(typeof(Base.CoreSprite), AssetType.CoreGraphics) .RegisterAssetType(typeof(Base.Item), AssetType.Item) ; _tomInv = new InventoryId((CharacterId)Base.PartyMember.Tom); _sword = new ItemData(Base.Item.Sword) { TypeId = ItemType.CloseRangeWeapon }; _torch = new ItemData(Base.Item.Torch) { TypeId = ItemType.Misc, Flags = ItemFlags.Stackable }; _tom = new Inventory(_tomInv); _rainer = new Inventory(new InventoryId((CharacterId)Base.PartyMember.Rainer)); var inventories = new Dictionary <InventoryId, Inventory> { [_tom.Id] = _tom, [_rainer.Id] = _rainer }; var exchange = new EventExchange(new LogExchange()); _im = new InventoryManager(x => inventories[x]); var wm = new WindowManager { Resolution = (1920, 1080) }; var cm = new MockCursorManager { Position = new Vector2(1, 1) }; exchange .Register(new GameConfig()) .Register <IInventoryManager>(_im) .Attach(wm) .Attach(cm) .Attach(this); }
public InventoryChangedEvent(InventoryId id) => Id = id;
public override string ToString() { return(base.ToString() + " - " + InventoryId.ToString()); }
public InventorySwapEvent(InventoryId sourceId, ItemSlotId slotId) : base(sourceId, slotId) { }
public InventorySellEvent(InventoryId inventoryId, ItemSlotId slotId) : base(inventoryId, slotId) { }
public InventoryPickupEvent(ushort?amount, InventoryId sourceId, ItemSlotId slotId) : base(sourceId, slotId) => Amount = amount;
public async Task <Inventory> GetBy(InventoryId id) { return(await this.repository.Get(id)); }
protected InventorySlotEvent(InventoryId id, ItemSlotId slotId) { Id = id; SlotId = slotId; }
public InventoryDiscardEvent(float normX, float normY, InventoryId inventoryId, ItemSlotId slotId) : base(inventoryId, slotId) { NormX = normX; NormY = normY; }
public Inventory(InventoryId id) { Id = id; Slots = new ItemSlot[(int)(id.Type switch
public InventorySlotId(AssetId id, ItemSlotId slot) { Id = new InventoryId(id); Slot = slot; }
public InventorySlotId(InventoryType type, ushort id, ItemSlotId slot) { Id = new InventoryId(type, id); Slot = slot; }
public InventorySlotId(InventoryId id, ItemSlotId slot) { Id = id; Slot = slot; }