Ejemplo n.º 1
0
 private void _SetInventoryController(IInventoryController obj)
 {
     _InventoryController = obj;
     _InventoryController.BagItemsEvent   += _RefreshBag;
     _InventoryController.EquipItemsEvent += _RefreshEquip;
     _InventoryController.Refresh();
 }
Ejemplo n.º 2
0
 private void _SetInventoryController(IInventoryController obj)
 {
     _ReleaseController();
     _InventoryController = obj;
     _InventoryController.EquipItemsEvent += _Reflush;
     _InventoryController.Refresh();
 }
Ejemplo n.º 3
0
 public void Inject(SignalBus bus, IInventoryController inventoryControl, ILootController lootControl)
 {
     Model             = new WorldModel(bus);
     instance          = this;
     _inventoryControl = inventoryControl;
     _lootControl      = lootControl;
 }
Ejemplo n.º 4
0
 private void _SetInventoryController(IInventoryController obj)
 {
     _ReleaseController();
     _InventoryController = obj;
     _InventoryController.BagItemsEvent += _InventoryNotifier_AllItemEvent;
     _InventoryController.Refresh();
 }
Ejemplo n.º 5
0
 private void _SetInventoryController(IInventoryController obj)
 {
     _ReleaseController();
     _InventoryController = obj;
     _InventoryController.EquipItemsEvent += _Reflush;
     _InventoryController.Refresh();
 }
 public void Inject(SignalBus bus, ILoadController loadControl, IInventoryController inventoryView)
 {
     bus.Fire(new PlayerSpawned() { player = this });
     Debug.Log($"player {gameObject.name} injected");
     _loadControl = loadControl;
     _inventoryControl = inventoryView;
 }
        public ShedController(
            [NotNull] IRepository <int, IUpgradeHandler> upgradeHandlersRepository,
            [NotNull] IRepository <int, IUpgradeHandler> defaultHandlers,
            [NotNull] IRepository <int, IItem> itemsRepository,
            [NotNull] IInventoryController inventoryController,
            [NotNull] IUpgradable upgradable)
        {
            _upgradeHandlersRepository =
                upgradeHandlersRepository ??
                throw new ArgumentNullException(nameof(upgradeHandlersRepository));

            _defaultHandlers =
                defaultHandlers ??
                throw new ArgumentNullException(nameof(defaultHandlers));

            _itemsRepository =
                itemsRepository ??
                throw new ArgumentNullException(nameof(itemsRepository));

            _inventoryController =
                inventoryController ??
                throw new ArgumentNullException(nameof(inventoryController));

            _upgradable =
                upgradable ??
                throw new ArgumentNullException(nameof(upgradable));

            _inventoryController.HideInventory();
        }
Ejemplo n.º 8
0
 public AlbumsController(
     IAlbumsController apiAlbumsController,
     IInventoryController apiInventoryController
     )
 {
     this.apiAlbumsController    = apiAlbumsController;
     this.apiInventoryController = apiInventoryController;
 }
        public LocationEditViewModel(IInventoryController controller, ILocationEditView view)
        {
            _controller = controller;
            View = view;
            View.Model = this;

            InitializeCommands();
        }
Ejemplo n.º 10
0
 public InventoryView(IInventoryController controller, Inventory inventory)
 {
     this.controller = controller;
     Inventory       = inventory;
     MouseEnter     += InventoryView_MouseEnter;
     MouseLeave     += InventoryView_MouseLeave;
     InitSlots();
 }
Ejemplo n.º 11
0
 public ShedController(Transform placeForUi, ProfilePlayer profilePlayer)
 {
     _upgradeHandlersRepository = CreateItemsConfigs();
     _inventoryController       = CreateItemController(placeForUi);
     _upgradable    = profilePlayer.CurrentCar;
     _profilePlayer = profilePlayer;
     Enter();
 }
Ejemplo n.º 12
0
 public void Inject(ILoadController loadControl, SignalBus signalBus, IInventoryController inventoryControl)
 {
     _loadControl      = loadControl;
     _inventoryControl = inventoryControl;
     signalBus.Subscribe <ItemLoadedSignal>(ItemLoaded);
     _signalBus = signalBus;
     CollectItems();
 }
 public SupplierEditViewModel(IUnityContainer container, 
     IInventoryController controller, ISupplierEditView view)
 {
     _container = container;
     _controller = controller;
     View = view;
     View.Model = this;
     InitializeCommands();
 }
        public CategoryEditViewModel(IInventoryController controller,  ICategoryEditView view)
        {
            _controller = controller;

            InitializeCommands();

            View = view;
            View.Model = this;
        }
Ejemplo n.º 15
0
        public ItemEditViewModel(IUnityContainer unityContainer, IItemEditView itemEditView, IInventoryController controller)
        {
            _unityContainer = unityContainer;
            _controller = controller;
            View = itemEditView;
            View.Model = this;

            InitializeCommands();
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Initializes the controller with the necessary information to convert an
 /// item's state into a functional game object.
 /// </summary>
 /// <param name="item">
 /// The portable item to wrap this controller around in order to transform
 /// it into a valid game object.
 /// </param>
 /// <param name="inventory">
 /// The optional inventory controller this item belongs to. It's perfectly
 /// valid for an item to not belong to an inventory.
 /// </param>
 public void Initialize(PortableItem item, IInventoryController inventory = null)
 {
     if (item == null)
     {
         throw new System.ArgumentNullException("item cannot be null");
     }
     this.item        = item;
     this.inventory   = inventory;
     this.Orientation = PortableObjectOrientation.Inventory;
 }
Ejemplo n.º 17
0
        public ShedController(
            [NotNull] IRepository <int, IUpgradeHandler> upgradeHandlersRepository,
            [NotNull] IInventoryController inventoryController,
            [NotNull] IUpgradable upgradable)
        {
            _upgradeHandlersRepository = upgradeHandlersRepository ?? throw new ArgumentNullException(nameof(upgradeHandlersRepository));

            _inventoryController = inventoryController ?? throw new ArgumentNullException(nameof(inventoryController));

            _upgradable = upgradable ?? throw new ArgumentNullException(nameof(upgradable));
        }
        public InventoryMenuViewModel(IUnityContainer container, IInventoryMenuView view, IInventoryController controller)
        {
            _container = container;
            _controller = controller;


            InitializeCommands();

            
            View = view;
            View.Model = this;

            
        }
    public void SetUp(InventoryItemSlot _myDat, IInventoryController _myCont, bool _updateColor)
    {
        myDat       = _myDat;
        myCont      = _myCont;
        updateColor = _updateColor;

        UpdateAmount();

        myCont.inventoryContentsChangedEvent += UpdateAmount;

        if (updateColor)
        {
            switch (myDat.mySlotType)
            {
            case InventoryItemSlot.SlotType.output:
                bg.color = outputColor;

                break;

            case InventoryItemSlot.SlotType.input:
                bg.color = inputColor;

                break;

            case InventoryItemSlot.SlotType.storage:
                bg.color = storageColor;

                break;

            case InventoryItemSlot.SlotType.house:
                bg.color = houseColor;

                break;

            case InventoryItemSlot.SlotType.worker:
                bg.color = workerColor;

                break;
            }
        }
    }
 private void _SetController(IInventoryController obj)
 {
     _Controller = obj;
 }
Ejemplo n.º 21
0
    public override void OnNewFrameDraw2d(Game game_, float deltaTime)
    {
        game = game_;
        if (dataItems == null)
        {
            dataItems = new GameDataItemsClient();
            dataItems.game = game_;
            controller = ClientInventoryController.Create(game_);
            inventoryUtil = game.d_InventoryUtil;
        }
        if (game.guistate == GuiState.MapLoading)
        {
            return;
        }
        DrawMaterialSelector();
        if (game.guistate != GuiState.Inventory)
        {
            return;
        }
        if (ScrollingUpTimeMilliseconds != 0 && (game.platform.TimeMillisecondsFromStart() - ScrollingUpTimeMilliseconds) > 250)
        {
            ScrollingUpTimeMilliseconds = game.platform.TimeMillisecondsFromStart();
            ScrollUp();
        }
        if (ScrollingDownTimeMilliseconds != 0 && (game.platform.TimeMillisecondsFromStart() - ScrollingDownTimeMilliseconds) > 250)
        {
            ScrollingDownTimeMilliseconds = game.platform.TimeMillisecondsFromStart();
            ScrollDown();
        }

        PointRef scaledMouse = PointRef.Create(game.mouseCurrentX, game.mouseCurrentY);

        game.Draw2dBitmapFile("inventory.png", InventoryStartX(), InventoryStartY(), 1024, 1024);

        //the3d.Draw2dTexture(terrain, 50, 50, 50, 50, 0);
        //the3d.Draw2dBitmapFile("inventory_weapon_shovel.png", 100, 100, 60 * 2, 60 * 4);
        //the3d.Draw2dBitmapFile("inventory_gauntlet_gloves.png", 200, 200, 60 * 2, 60 * 2);
        //main inventory
        for (int i = 0; i < game.d_Inventory.ItemsCount; i++)
        {
            Packet_PositionItem k = game.d_Inventory.Items[i];
            if (k == null)
            {
                continue;
            }
            int screeny = k.Y - ScrollLine;
            if (screeny >= 0 && screeny < CellCountInPageY)
            {
                DrawItem(CellsStartX() + k.X * CellDrawSize, CellsStartY() + screeny * CellDrawSize, k.Value_, 0, 0);
            }
        }

        //draw area selection
        if (game.d_Inventory.DragDropItem != null)
        {
            PointRef selectedInPage = SelectedCell(scaledMouse);
            if (selectedInPage != null)
            {
                int x = (selectedInPage.X) * CellDrawSize + CellsStartX();
                int y = (selectedInPage.Y) * CellDrawSize + CellsStartY();
                int sizex = dataItems.ItemSizeX(game.d_Inventory.DragDropItem);
                int sizey = dataItems.ItemSizeY(game.d_Inventory.DragDropItem);
                if (selectedInPage.X + sizex <= CellCountInPageX
                    && selectedInPage.Y + sizey <= CellCountInPageY)
                {
                    int c;
                    IntRef itemsAtAreaCount = new IntRef();
                    PointRef[] itemsAtArea = inventoryUtil.ItemsAtArea(selectedInPage.X, selectedInPage.Y + ScrollLine, sizex, sizey, itemsAtAreaCount);
                    if (itemsAtArea == null || itemsAtAreaCount.value > 1)
                    {
                        c = Game.ColorFromArgb(100, 255, 0, 0); // red
                    }
                    else //0 or 1
                    {
                        c = Game.ColorFromArgb(100, 0, 255, 0); // green
                    }
                    game.Draw2dTexture(game.WhiteTexture(), x, y,
                        CellDrawSize * sizex, CellDrawSize * sizey,
                        null, 0, c, false);
                }
            }
            IntRef selectedWear = SelectedWearPlace(scaledMouse);
            if (selectedWear != null)
            {
                PointRef p = PointRef.Create(wearPlaceStart[selectedWear.value].X + InventoryStartX(), wearPlaceStart[selectedWear.value].Y + InventoryStartY());
                PointRef size = wearPlaceCells[selectedWear.value];

                int c;
                Packet_Item itemsAtArea = inventoryUtil.ItemAtWearPlace(selectedWear.value, game.ActiveMaterial);
                if (!dataItems.CanWear(selectedWear.value, game.d_Inventory.DragDropItem))
                {
                    c = Game.ColorFromArgb(100, 255, 0, 0); // red
                }
                else //0 or 1
                {
                    c = Game.ColorFromArgb(100, 0, 255, 0); // green
                }
                game.Draw2dTexture(game.WhiteTexture(), p.X, p.Y,
                    CellDrawSize * size.X, CellDrawSize * size.Y,
                    null, 0, c, false);
            }
        }

        //material selector
        DrawMaterialSelector();

        //wear
        //DrawItem(Offset(wearPlaceStart[(int)WearPlace.LeftHand], InventoryStart), inventory.LeftHand[ActiveMaterial.ActiveMaterial], null);
        DrawItem(wearPlaceStart[WearPlace_.RightHand].X + InventoryStartX(), wearPlaceStart[WearPlace_.RightHand].Y + InventoryStartY(), game.d_Inventory.RightHand[game.ActiveMaterial], 0, 0);
        DrawItem(wearPlaceStart[WearPlace_.MainArmor].X + InventoryStartX(), wearPlaceStart[WearPlace_.MainArmor].Y + InventoryStartY(), game.d_Inventory.MainArmor, 0, 0);
        DrawItem(wearPlaceStart[WearPlace_.Boots].X + InventoryStartX(), wearPlaceStart[WearPlace_.Boots].Y + InventoryStartY(), game.d_Inventory.Boots, 0, 0);
        DrawItem(wearPlaceStart[WearPlace_.Helmet].X + InventoryStartX(), wearPlaceStart[WearPlace_.Helmet].Y + InventoryStartY(), game.d_Inventory.Helmet, 0, 0);
        DrawItem(wearPlaceStart[WearPlace_.Gauntlet].X + InventoryStartX(), wearPlaceStart[WearPlace_.Gauntlet].Y + InventoryStartY(), game.d_Inventory.Gauntlet, 0, 0);

        //info
        if (SelectedCell(scaledMouse) != null)
        {
            PointRef selected = SelectedCell(scaledMouse);
            selected.Y += ScrollLine;
            PointRef itemAtCell = inventoryUtil.ItemAtCell(selected);
            if (itemAtCell != null)
            {
                Packet_Item item = GetItem(game.d_Inventory, itemAtCell.X, itemAtCell.Y);
                if (item != null)
                {
                    int x = (selected.X) * CellDrawSize + CellsStartX();
                    int y = (selected.Y) * CellDrawSize + CellsStartY();
                    DrawItemInfo(scaledMouse.X, scaledMouse.Y, item);
                }
            }
        }
        if (SelectedWearPlace(scaledMouse) != null)
        {
            int selected = SelectedWearPlace(scaledMouse).value;
            Packet_Item itemAtWearPlace = inventoryUtil.ItemAtWearPlace(selected, game.ActiveMaterial);
            if (itemAtWearPlace != null)
            {
                DrawItemInfo(scaledMouse.X, scaledMouse.Y, itemAtWearPlace);
            }
        }
        if (SelectedMaterialSelectorSlot(scaledMouse) != null)
        {
            int selected = SelectedMaterialSelectorSlot(scaledMouse).value;
            Packet_Item item = game.d_Inventory.RightHand[selected];
            if (item != null)
            {
                DrawItemInfo(scaledMouse.X, scaledMouse.Y, item);
            }
        }

        if (game.d_Inventory.DragDropItem != null)
        {
            DrawItem(scaledMouse.X, scaledMouse.Y, game.d_Inventory.DragDropItem, 0, 0);
        }
    }
Ejemplo n.º 22
0
 private void _SetController(IInventoryController obj)
 {
     _Controller = obj;
 }
Ejemplo n.º 23
0
        public static void Equip(this IInventoryController gpi, string id)
        {
            var guid = new Guid(id);

            gpi.Equip(guid);
        }
Ejemplo n.º 24
0
 private void _InventoryControllerSupply(IInventoryController source)
 {
     source.BagItemsEvent += _ShowItem;
 }
Ejemplo n.º 25
0
 private void _ClearInventoryController(IInventoryController obj)
 {
     _InventoryController.BagItemsEvent   -= _RefreshBag;
     _InventoryController.EquipItemsEvent -= _RefreshEquip;
     _InventoryController = null;
 }
Ejemplo n.º 26
0
 public HomeController(IInventoryController apiInventoryController)
 {
     this.apiInventoryController = apiInventoryController;
 }
 private void _ClearInventoryController(IInventoryController obj)
 {
     _InventoryController.BagItemsEvent -= _RefreshBag;
     _InventoryController.EquipItemsEvent -= _RefreshEquip;
     _InventoryController = null;
 }
 private void _SetInventoryController(IInventoryController obj)
 {
     _InventoryController = obj;
     _InventoryController.BagItemsEvent += _RefreshBag;
     _InventoryController.EquipItemsEvent += _RefreshEquip;
     _InventoryController.Refresh();
 }
Ejemplo n.º 29
0
    public override void OnNewFrameDraw2d(Game game_, float deltaTime)
    {
        game = game_;
        if (dataItems == null)
        {
            dataItems      = new GameDataItemsClient();
            dataItems.game = game_;
            controller     = ClientInventoryController.Create(game_);
            inventoryUtil  = game.d_InventoryUtil;
        }
        if (game.guistate == GuiState.MapLoading)
        {
            return;
        }
        DrawMaterialSelector();
        if (game.guistate != GuiState.Inventory)
        {
            return;
        }
        if (ScrollingUpTimeMilliseconds != 0 && (game.platform.TimeMillisecondsFromStart() - ScrollingUpTimeMilliseconds) > 250)
        {
            ScrollingUpTimeMilliseconds = game.platform.TimeMillisecondsFromStart();
            ScrollUp();
        }
        if (ScrollingDownTimeMilliseconds != 0 && (game.platform.TimeMillisecondsFromStart() - ScrollingDownTimeMilliseconds) > 250)
        {
            ScrollingDownTimeMilliseconds = game.platform.TimeMillisecondsFromStart();
            ScrollDown();
        }

        PointRef scaledMouse = PointRef.Create(game.mouseCurrentX, game.mouseCurrentY);

        game.Draw2dBitmapFile("inventory.png", InventoryStartX(), InventoryStartY(), 1024, 1024);

        //the3d.Draw2dTexture(terrain, 50, 50, 50, 50, 0);
        //the3d.Draw2dBitmapFile("inventory_weapon_shovel.png", 100, 100, 60 * 2, 60 * 4);
        //the3d.Draw2dBitmapFile("inventory_gauntlet_gloves.png", 200, 200, 60 * 2, 60 * 2);
        //main inventory
        for (int i = 0; i < game.d_Inventory.ItemsCount; i++)
        {
            Packet_PositionItem k = game.d_Inventory.Items[i];
            if (k == null)
            {
                continue;
            }
            int screeny = k.Y - ScrollLine;
            if (screeny >= 0 && screeny < CellCountInPageY)
            {
                DrawItem(CellsStartX() + k.X * CellDrawSize, CellsStartY() + screeny * CellDrawSize, k.Value_, 0, 0);
            }
        }

        //draw area selection
        if (game.d_Inventory.DragDropItem != null)
        {
            PointRef selectedInPage = SelectedCell(scaledMouse);
            if (selectedInPage != null)
            {
                int x     = (selectedInPage.X) * CellDrawSize + CellsStartX();
                int y     = (selectedInPage.Y) * CellDrawSize + CellsStartY();
                int sizex = dataItems.ItemSizeX(game.d_Inventory.DragDropItem);
                int sizey = dataItems.ItemSizeY(game.d_Inventory.DragDropItem);
                if (selectedInPage.X + sizex <= CellCountInPageX &&
                    selectedInPage.Y + sizey <= CellCountInPageY)
                {
                    int        c;
                    IntRef     itemsAtAreaCount = new IntRef();
                    PointRef[] itemsAtArea      = inventoryUtil.ItemsAtArea(selectedInPage.X, selectedInPage.Y + ScrollLine, sizex, sizey, itemsAtAreaCount);
                    if (itemsAtArea == null || itemsAtAreaCount.value > 1)
                    {
                        c = Game.ColorFromArgb(100, 255, 0, 0); // red
                    }
                    else //0 or 1
                    {
                        c = Game.ColorFromArgb(100, 0, 255, 0); // green
                    }
                    game.Draw2dTexture(game.WhiteTexture(), x, y,
                                       CellDrawSize * sizex, CellDrawSize * sizey,
                                       null, 0, c, false);
                }
            }
            IntRef selectedWear = SelectedWearPlace(scaledMouse);
            if (selectedWear != null)
            {
                PointRef p    = PointRef.Create(wearPlaceStart[selectedWear.value].X + InventoryStartX(), wearPlaceStart[selectedWear.value].Y + InventoryStartY());
                PointRef size = wearPlaceCells[selectedWear.value];

                int         c;
                Packet_Item itemsAtArea = inventoryUtil.ItemAtWearPlace(selectedWear.value, game.ActiveMaterial);
                if (!dataItems.CanWear(selectedWear.value, game.d_Inventory.DragDropItem))
                {
                    c = Game.ColorFromArgb(100, 255, 0, 0); // red
                }
                else //0 or 1
                {
                    c = Game.ColorFromArgb(100, 0, 255, 0); // green
                }
                game.Draw2dTexture(game.WhiteTexture(), p.X, p.Y,
                                   CellDrawSize * size.X, CellDrawSize * size.Y,
                                   null, 0, c, false);
            }
        }

        //material selector
        DrawMaterialSelector();

        //wear
        //DrawItem(Offset(wearPlaceStart[(int)WearPlace.LeftHand], InventoryStart), inventory.LeftHand[ActiveMaterial.ActiveMaterial], null);
        DrawItem(wearPlaceStart[WearPlace_.RightHand].X + InventoryStartX(), wearPlaceStart[WearPlace_.RightHand].Y + InventoryStartY(), game.d_Inventory.RightHand[game.ActiveMaterial], 0, 0);
        DrawItem(wearPlaceStart[WearPlace_.MainArmor].X + InventoryStartX(), wearPlaceStart[WearPlace_.MainArmor].Y + InventoryStartY(), game.d_Inventory.MainArmor, 0, 0);
        DrawItem(wearPlaceStart[WearPlace_.Boots].X + InventoryStartX(), wearPlaceStart[WearPlace_.Boots].Y + InventoryStartY(), game.d_Inventory.Boots, 0, 0);
        DrawItem(wearPlaceStart[WearPlace_.Helmet].X + InventoryStartX(), wearPlaceStart[WearPlace_.Helmet].Y + InventoryStartY(), game.d_Inventory.Helmet, 0, 0);
        DrawItem(wearPlaceStart[WearPlace_.Gauntlet].X + InventoryStartX(), wearPlaceStart[WearPlace_.Gauntlet].Y + InventoryStartY(), game.d_Inventory.Gauntlet, 0, 0);

        //info
        if (SelectedCell(scaledMouse) != null)
        {
            PointRef selected = SelectedCell(scaledMouse);
            selected.Y += ScrollLine;
            PointRef itemAtCell = inventoryUtil.ItemAtCell(selected);
            if (itemAtCell != null)
            {
                Packet_Item item = GetItem(game.d_Inventory, itemAtCell.X, itemAtCell.Y);
                if (item != null)
                {
                    int x = (selected.X) * CellDrawSize + CellsStartX();
                    int y = (selected.Y) * CellDrawSize + CellsStartY();
                    DrawItemInfo(scaledMouse.X, scaledMouse.Y, item);
                }
            }
        }
        if (SelectedWearPlace(scaledMouse) != null)
        {
            int         selected        = SelectedWearPlace(scaledMouse).value;
            Packet_Item itemAtWearPlace = inventoryUtil.ItemAtWearPlace(selected, game.ActiveMaterial);
            if (itemAtWearPlace != null)
            {
                DrawItemInfo(scaledMouse.X, scaledMouse.Y, itemAtWearPlace);
            }
        }
        if (SelectedMaterialSelectorSlot(scaledMouse) != null)
        {
            int         selected = SelectedMaterialSelectorSlot(scaledMouse).value;
            Packet_Item item     = game.d_Inventory.RightHand[selected];
            if (item != null)
            {
                DrawItemInfo(scaledMouse.X, scaledMouse.Y, item);
            }
        }

        if (game.d_Inventory.DragDropItem != null)
        {
            DrawItem(scaledMouse.X, scaledMouse.Y, game.d_Inventory.DragDropItem, 0, 0);
        }
    }
Ejemplo n.º 30
0
 public EquipView(IInventoryController controller, Player player)
 {
     Player          = player;
     this.controller = controller;
     SetupGUI();
 }
Ejemplo n.º 31
0
 private void _SetInventoryController(IInventoryController obj)
 {
     _ReleaseController();
     _InventoryController = obj;
     _InventoryController.BagItemsEvent += _InventoryNotifier_AllItemEvent;
     _InventoryController.Refresh();
 }