private void OnDropCargoItem(CargoHoldListItem item)
    {
        var player = PlayerShip.LocalPlayer;

        var sourceCargo = item.CargoHold;

        if (sourceCargo == equipmentScreen.PlayerCargo)
        {
            SpaceTraderConfig.Market.SellItemToStation(player, item.ItemIndex);

            //this slot should now be empty, doing this will "select" the empty slot
            item.OnClickCargoItem();
        }
    }
    private void OnDropCargoItem(CargoHoldListItem droppedItem)
    {
        var player = PlayerShip.LocalPlayer;
        var loadout = player.Ship.ModuleLoadout;
        var droppedModuleType = droppedItem.ItemType as ModuleItemType;

        if (droppedModuleType)
        {
            int targetSlot = module ? module.ModuleSlot : loadout.FindFirstFreeSlot();

            if (loadout.IsValidSlot(targetSlot))
            {
                if (!loadout.IsFreeSlot(targetSlot))
                {
                    //swap to cargo
                    var currentItem = loadout.GetSlot(targetSlot).ModuleType;

                    droppedItem.CargoHold[droppedItem.ItemIndex] = currentItem;
                    loadout.RemoveAt(targetSlot);
                }
                else
                {
                    droppedItem.CargoHold[droppedItem.ItemIndex] = null;
                }

                loadout.Equip(targetSlot, droppedModuleType);

                modules[targetSlot].OnClickModule();
            }
            else
            {
                PlayerNotifications.Error("No free slots");
            }
        }
        else
        {
            PlayerNotifications.Error("Can only equip Modules");
        }
    }
예제 #3
0
    public void OnSelectCargoItem(CargoHoldListItem selected)
    {
        cargoList.HighlightedIndex = CargoHold.BadIndex;

        SpaceTraderConfig.Instance.StartCoroutine(TakeItemRoutine(selected.ItemIndex));
    }
 private void OnDropCargoItem(CargoHoldListItem dragged)
 {
     dragItem.gameObject.SetActive(false);
     dragItem.Item = null;
 }
 private void OnDragCargoItem(CargoHoldListItem dragged)
 {
     dragItem.gameObject.SetActive(true);
     dragItem.Item = dragged;
 }
    public void OnSelectCargoItem(CargoHoldListItem selection)
    {
        shipModules.HighlightedIndex = -1;

        if (selection.CargoHold == playerCargoList.CargoHold)
        {
            targetCargoList.HighlightedIndex = -1;
        }
        else
        {
            playerCargoList.HighlightedIndex = -1;
        }
    }