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;
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public InventoryChangedEvent(InventoryId id) => Id = id;
 public override string ToString()
 {
     return(base.ToString() + " - " + InventoryId.ToString());
 }
Esempio n. 7
0
 public InventorySwapEvent(InventoryId sourceId, ItemSlotId slotId)
     : base(sourceId, slotId)
 {
 }
Esempio n. 8
0
 public InventorySellEvent(InventoryId inventoryId, ItemSlotId slotId)
     : base(inventoryId, slotId)
 {
 }
Esempio n. 9
0
 public InventoryPickupEvent(ushort?amount, InventoryId sourceId, ItemSlotId slotId)
     : base(sourceId, slotId) => Amount = amount;
Esempio n. 10
0
 public async Task <Inventory> GetBy(InventoryId id)
 {
     return(await this.repository.Get(id));
 }
Esempio n. 11
0
 protected InventorySlotEvent(InventoryId id, ItemSlotId slotId)
 {
     Id     = id;
     SlotId = slotId;
 }
Esempio n. 12
0
 public InventoryDiscardEvent(float normX, float normY, InventoryId inventoryId, ItemSlotId slotId)
     : base(inventoryId, slotId)
 {
     NormX = normX;
     NormY = normY;
 }
Esempio n. 13
0
 public Inventory(InventoryId id)
 {
     Id    = id;
     Slots = new ItemSlot[(int)(id.Type switch
Esempio n. 14
0
 public InventorySlotId(AssetId id, ItemSlotId slot)
 {
     Id   = new InventoryId(id);
     Slot = slot;
 }
Esempio n. 15
0
 public InventorySlotId(InventoryType type, ushort id, ItemSlotId slot)
 {
     Id   = new InventoryId(type, id);
     Slot = slot;
 }
Esempio n. 16
0
 public InventorySlotId(InventoryId id, ItemSlotId slot)
 {
     Id   = id;
     Slot = slot;
 }