public void onGUI()
            {
                var box = EditorGUILayout.BeginVertical(GUI.skin.box);

                EditorGUILayout.LabelField("When the following consumable is purchased:");
                Rect rect = new Rect(box.xMax - 20, box.yMin - 2, 20, 20);

                if (GUI.Button(rect, "x"))
                {
                    parent.mappingsToRemove.Add(this);
                }

                var ids = InventoryEditor.consumableIds();

                selectedItemIndex = EditorGUILayout.Popup(selectedItemIndex, ids);
                if (0 <= selectedItemIndex && selectedItemIndex < ids.Length)
                {
                    id = ids [selectedItemIndex];
                }

                EditorGUILayout.LabelField(string.Format("Give this much {0}:", parent.id));
                amount = EditorGUILayout.IntField(amount);
                parent.currency.mappings[id] = amount;
                EditorGUILayout.EndVertical();
            }
Exemplo n.º 2
0
    public static void Init()
    {
        InventoryEditor window = EditorWindow.GetWindow <InventoryEditor>();

        window.minSize           = new Vector2(400, 300);
        window.titleContent.text = "Item Database";
        window.Show();
    }
Exemplo n.º 3
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        InventoryEditor window = ScriptableObject.CreateInstance <InventoryEditor>();

        window.title = "Inventory";
        window.Show();
    }
Exemplo n.º 4
0
 public CharacterEditor(string name, CharacterSheet sheet) : base(sheet)
 {
     _name       = name;
     _sheet      = sheet ?? throw new ArgumentNullException(nameof(sheet));
     _magic      = AttachChild(new CharacterMagicEditor(_sheet.Magic));
     _inventory  = AttachChild(new InventoryEditor(_sheet.Inventory));
     _attributes = AttachChild(new CharacterAttributesEditor(_sheet.Attributes));
     _skills     = AttachChild(new CharacterSkillsEditor(_sheet.Skills));
     _combat     = AttachChild(new CombatAttributeEditor(_sheet.Combat));
 }
            public CurrencyMapping(string id, int amount, EditableCurrency parent)
            {
                this.id     = id;
                this.amount = amount;
                this.parent = parent;
                var items = InventoryEditor.consumableIds();

                for (int t = 0; t < items.Count(); t++)
                {
                    if (items[t] == this.id)
                    {
                        selectedItemIndex = t;
                        break;
                    }
                }
            }
Exemplo n.º 6
0
        private void RePopulateTreeView()
        {
            _guiController.ProjectTree.RemoveAllChildNodes(this, TOP_LEVEL_COMMAND_ID);
            _guiController.ProjectTree.StartFromNode(this, TOP_LEVEL_COMMAND_ID);
            foreach (InventoryItem item in _agsEditor.CurrentGame.InventoryItems)
            {
                _guiController.ProjectTree.AddTreeLeaf(this, "Inv" + item.ID, item.ID.ToString() + ": " + item.Name, "InventoryIcon");
            }

            if (_documents.ContainsValue(_guiController.ActivePane))
            {
                InventoryEditor editor = (InventoryEditor)_guiController.ActivePane.Control;
                _guiController.ProjectTree.SelectNode(this, "Inv" + editor.ItemToEdit.ID);
            }
            else if (_agsEditor.CurrentGame.InventoryItems.Count > 0)
            {
                _guiController.ProjectTree.SelectNode(this, "Inv1");
            }
        }