Ejemplo n.º 1
0
        public InventoryTests()
        {
            _sword = new ItemData(ItemId.Sword)
            {
                TypeId = ItemType.CloseRangeWeapon
            };
            _torch = new ItemData(ItemId.Torch)
            {
                TypeId = ItemType.Misc
            };

            _tom         = new Inventory(new InventoryId(PartyCharacterId.Tom));
            _rainer      = new Inventory(new InventoryId(PartyCharacterId.Rainer));
            _inventories = new Dictionary <InventoryId, Inventory>
            {
                [_tom.Id]    = _tom,
                [_rainer.Id] = _rainer
            };

            _exchange = new EventExchange(new LogExchange());
            _im       = new InventoryManager(x => _inventories[x]);
            var wm = new WindowManager {
                Window = new MockWindow(1920, 1080)
            };
            var cm = new MockCursorManager {
                Position = new Vector2(1, 1)
            };

            _exchange
            .Register <IInventoryManager>(_im)
            .Attach(wm)
            .Attach(cm)
            .Attach(this);
        }
Ejemplo n.º 2
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);
        }