Пример #1
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     current  = (CurrentUser)GetNode("/root/CurrentUser");
     itemList = (Godot.ItemList)GetNode("Panel/TabContainer/Item");
     onUtilisateurs();
     onItems();
 }
Пример #2
0
    private void onModifier()
    {
        Godot.TabContainer tabContainer = (Godot.TabContainer)GetNode("Panel/TabContainer");

        Godot.ItemList list     = (Godot.ItemList)tabContainer.GetChild(tabContainer.CurrentTab);
        int            selected = 0;

        try
        {
            selected = list.GetSelectedItems()[0] + 1;
            foreach (Utilisateur u in utilisateurs)
            {
                if (u != null)
                {
                    GD.Print(u.getNom());
                }
            }
            foreach (Item i in items)
            {
                if (i != null)
                {
                    GD.Print(i.getNom());
                }
            }
        }
        catch (Exception)
        {
        }

        this.mode = (Mode)tabContainer.CurrentTab;
        switch (mode)
        {
        case Mode.Utilisateur:
            ModifierUtilisateur newUser = (ModifierUtilisateur)GetNode("ModifierUtilisateur");
            GD.Print(newUser);
            if (utilisateurs[selected] != null)
            {
                newUser.user  = utilisateurs[selected];
                newUser.admin = this;
                newUser.PopupCenteredRatio();
            }
            break;

        case Mode.Item:
            ModifierItem newItem = (ModifierItem)GetNode("ModifierItem");
            if (items[selected] != null)
            {
                newItem.item  = items[selected];
                newItem.admin = this;
                newItem.PopupCenteredRatio();
            }
            break;
        }
    }
Пример #3
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);
    }
Пример #4
0
    public void InitControls()
    {
        savesList = new ItemList();
        AddChild(savesList);
        savesList.AllowRmbSelect = true;
        savesList.Connect("item_selected", this, nameof(SelectSave));
        savesList.Connect("item_activated", this, nameof(LoadSave));

        foreach (string save in SettingsDb.GetAllSaves("adventure"))
        {
            savesList.AddItem(save);
        }

        backButton = Menu.Button("back", Back);
        AddChild(backButton);

        loadButton = Menu.Button("load", Load);
        AddChild(loadButton);
    }