예제 #1
0
    public override void Update()
    {
        AuroraUTP template = (AuroraUTP)placeable.template;

        // Load the items
        List <AuroraUIElement> items = new List <AuroraUIElement>();

        foreach (AuroraUTP.AItem item in template.ItemList)
        {
            // Create an item instance for each item in the inventory
            // (this will be transferred into the player's inventory when they pick the item up)
            UnityEngine.Debug.Log("Loading item " + item.InventoryRes);
            Item uiItem = new Item(this.width, this.height * 2 / 9, AuroraEngine.Resources.LoadItem(item.InventoryRes));
            uiItem.button.Clicked += (_, __) => PlayerTakeItem(item);
            uiItem.button.Clicked += (_, __) => placeable.OnInvDisturbed();

            items.Add(uiItem);
        }

        // Create the scrollable list
        scroll = new ScrollableList(width, height * 2 / 3, items);

        // Create the buttons
        getItems          = new Button(width, height / 12, "Get Items");
        getItems.Clicked += GetAllItems;

        switchToGiveItems          = new Button(width, height / 12, "Switch to Give Items");
        switchToGiveItems.Clicked += SwitchToGiveItems;

        close          = new Button(width, height / 12, "Close");
        close.Clicked += Close;
    }