Пример #1
0
    public List <InventorySlot> container = new List <InventorySlot>();//Массив предметов


    public void InventoryAction(InventoryActions _action, ItemData _item, int _count)
    {
        switch (_action)
        {
        case InventoryActions.add:
            AddItem(_item, _count);
            break;

        case InventoryActions.remove:
            RemoveItem(_item, _count);
            break;
        }
    }
        public ManagerMainMenu(StoreAppContext context, IManagerRepoActions managerRepoActions, ILocationRepoActions locationRepoActions, IInventoryRepoActions inventoryRepoActions, IOrderRepoActions orderRepoActions, IBaseballBatRepoActions batRepoActions, Location location)
        {
            this.context              = context;
            this.managerRepoActions   = managerRepoActions;
            this.inventoryRepoActions = inventoryRepoActions;
            this.orderRepoActions     = orderRepoActions;
            this.batRepoActions       = batRepoActions;

            this.managerActions   = new ManagerActions(context, managerRepoActions);
            this.inventoryActions = new InventoryActions(context, inventoryRepoActions);
            this.orderActions     = new OrderActions(context, orderRepoActions);
            this.batActions       = new BaseballBatActions(context, batRepoActions);

            this.location = location;
        }
Пример #3
0
        public CustomerMainMenu(StoreAppContext context, ICustomerRepoActions customerRepoActions, ILocationRepoActions locationRepoActions, IOrderRepoActions orderRepoActions, IInventoryRepoActions inventoryRepoActions, IBaseballBatRepoActions batRepoActions, Customer signedInCustomer, Location location)
        {
            this.context = context;

            this.customerActions  = new CustomerActions(context, customerRepoActions);
            this.locationActions  = new LocationActions(context, locationRepoActions);
            this.inventoryActions = new InventoryActions(context, inventoryRepoActions);
            this.orderActions     = new OrderActions(context, orderRepoActions);
            this.batActions       = new BaseballBatActions(context, batRepoActions);

            this.customerRepoActions  = customerRepoActions;
            this.locationRepoActions  = locationRepoActions;
            this.orderRepoActions     = orderRepoActions;
            this.inventoryRepoActions = inventoryRepoActions;
            this.batRepoActions       = batRepoActions;

            this.currLocation     = location;
            this.signedInCustomer = signedInCustomer;
        }
Пример #4
0
    private void Update()
    {
        localMousePosition = rectTransform.InverseTransformPoint(Input.mousePosition);

        if (rectTransform.rect.Contains(localMousePosition))
        {
            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.Q))
            {
                InventoryActions.Drop(ui, Item.MaxAmount);
            }
            else if (Input.GetKeyDown(KeyCode.Q))
            {
                InventoryActions.Drop(ui, 1);
            }
            if (Input.GetMouseButtonDown(1))
            {
                InventoryActions.Split(ui, inventoriesController);
            }
        }
    }
Пример #5
0
    private void Update()
    {
        for (var i = 0; i < uIController.inventoryUIs.Count; i++)
        {
            var inventory       = i < activeInventories.Count ? activeInventories[i] : null;
            var ui              = uIController.inventoryUIs[i];
            var uiRectTransform = ui.GetComponent <RectTransform>();
            localMousePosition = uiRectTransform.InverseTransformPoint(Input.mousePosition);

            InventoryActions.Hover(ui);

            if (uiRectTransform.rect.Contains(localMousePosition))
            {
                //click logic
                if (Input.GetMouseButtonDown(0))
                {
                    slotList.Clear();
                }
                if (Input.GetMouseButton(0))
                {
                    InventoryActions.SelectSlot(ui, this);
                }
                if (Input.GetMouseButtonUp(0))
                {
                    InventoryActions.InventoryClick(ui, this);
                }

                //hover info logic
                if (Input.GetKey(KeyCode.LeftControl) && ui.hoverSlot && ui.hoverSlot.item != null)
                {
                    if (!itemInfoTransform)
                    {
                        CreateDisplay();
                    }
                    else
                    {
                        InventoryActions.DisplayInfo(ui, itemInfoTransform, nameText, amountText);
                    }
                }
                else
                {
                    if (itemInfoTransform)
                    {
                        Destroy(itemInfoTransform.gameObject);
                    }
                }

                //sort
                if (Input.GetKeyDown(KeyCode.R))
                {
                    inventory.SortItems();
                }
            }

            if (activeTransform != null)
            {
                activeTransform.position = Input.mousePosition;
            }

            ui.InventorySpecificControls();
        }

        if (activeItem != null && activeItem.itemType != ItemType.Empty && !MouseOverUI())
        {
            if (Input.GetMouseButtonDown(0))
            {
                InventoryActions.DropActive(playerController, this, activeItem.amount);
            }
            if (Input.GetMouseButtonDown(1))
            {
                InventoryActions.DropActive(playerController, this, 1);
            }
        }
    }