Example #1
0
    public void InitControls()
    {
        activeFilter = Item.Categories.Weapons;

        closeButton = (Godot.Button)Menu.Button(text: "Close", onClick: Close);
        AddChild(closeButton);

        itemList = new ItemList();
        AddChild(itemList);
        itemList.AllowRmbSelect = true;
        itemList.Connect("item_selected", this, nameof(SelectItem));
        itemList.Connect("item_activated", this, nameof(UseItem));
        itemList.Connect("item_rmb_selected", this, nameof(DropItem));

        itemInfo          = (Godot.TextEdit)Menu.TextBox("");
        itemInfo.Readonly = true;
        itemInfo.Hide();
        AddChild(itemInfo);

        useButton = (Godot.Button)Menu.Button(text: "Use", onClick: UseItemAdapter);
        AddChild(useButton);
        useButton.Hide();

        dropButton = (Godot.Button)Menu.Button(text: "Drop", onClick: DropItemAdapter);
        AddChild(dropButton);
        dropButton.Hide();

        stashButton = (Godot.Button)Menu.Button(text: "Stash", onClick: StashItem);
        AddChild(stashButton);
        RefreshStashItemInfo();

        weaponsButton = (Godot.Button)Menu.Button(text: "Weapons", onClick: FilterWeapons);
        AddChild(weaponsButton);

        apparelButton = (Godot.Button)Menu.Button(text: "Apparel", onClick: FilterApparel);
        AddChild(apparelButton);

        aidButton = (Godot.Button)Menu.Button(text: "Aid", onClick: FilterAid);
        AddChild(aidButton);

        miscButton = (Godot.Button)Menu.Button(text: "Misc", onClick: FilterMisc);
        AddChild(miscButton);

        ammoButton = (Godot.Button)Menu.Button(text: "Ammo", onClick: FilterAmmo);
        AddChild(ammoButton);

        weightInfo          = (Godot.TextEdit)Menu.TextBox("WeightInfo");
        weightInfo.Readonly = true;
        AddChild(weightInfo);
    }
Example #2
0
    public void UpdateFilter(Item.Categories category)
    {
        activeFilter           = category;
        weaponsButton.Disabled = false;
        apparelButton.Disabled = false;
        aidButton.Disabled     = false;
        miscButton.Disabled    = false;
        ammoButton.Disabled    = false;

        switch (activeFilter)
        {
        case Item.Categories.Weapons:
            weaponsButton.Disabled = true;
            useButton.SetText("Equip");
            break;

        case Item.Categories.Apparel:
            apparelButton.Disabled = true;
            useButton.SetText("Equip");
            break;

        case Item.Categories.Aid:
            aidButton.Disabled = true;
            useButton.SetText("Use");
            break;

        case Item.Categories.Misc:
            miscButton.Disabled = true;
            useButton.SetText("Use");
            break;

        case Item.Categories.Ammo:
            ammoButton.Disabled = true;
            useButton.SetText("Select");
            break;
        }

        RefreshInventory();
    }