예제 #1
0
    // Use this for initialization
    void Start()
    {
        playerUI.SetInventory(player.GetInventories()[0]);
        player.GetInventories()[0].AddItem(new Item("test", 1), 5);
        player.GetInventories()[0].AddItem(new Item("test1", 1), 12);
        player.GetInventories()[0].AddItem(new Item("test2", 1), 12);
        var shopItems = new List <ItemShop>()
        {
            new ItemShop(new Item("test", 1), 10), new ItemShop(new Item("test1", 1), 10), new ItemShop(new Item("test2", 1), 10)
        };

        shop = new Dummy_Shop(shopItems);
        shop_UI.SetShop(shop, player);
    }
예제 #2
0
        /// <summary>
        /// Builds cache of accessible inventories on this ship.
        /// </summary>
        /// <param name="Force">Forces to build cache even if UseConveyorSystem == false.</param>
        void BuildInventoryCache(bool Force = false)
        {
            if (!Tool.UseConveyorSystem && !Force)
            {
                return;
            }
            List <IMyTerminalBlock> InventoryOwners = new List <IMyTerminalBlock>();

            Term.GetBlocksOfType(InventoryOwners, x => x.HasPlayerAccess(Tool.OwnerId) && x.HasInventory);
            OnboardInventoryOwners.Clear();
            OnboardInventoryOwners.Add(Tool);
            foreach (var InventoryOwner in InventoryOwners)
            {
                if (InventoryOwner == Tool)
                {
                    continue;
                }
                foreach (var Inventory in InventoryOwner.GetInventories())
                {
                    if (Inventory == ToolCargo)
                    {
                        continue;
                    }
                    if (Inventory.IsConnectedTo(ToolCargo))
                    {
                        OnboardInventoryOwners.Add(InventoryOwner);
                    }
                }
            }
        }