Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            if (_target == null || inventoryManager == null)
            {
                OnEnable();
                return;
            }

            EditorGUILayout.LabelField("Stored Inventory items", EditorStyles.boldLabel);
            if (_target.items.Count > 0)
            {
                EditorGUILayout.BeginVertical("Button");
                for (int i = 0; i < _target.items.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Item name:", GUILayout.Width(80f));
                    if (inventoryManager.CanCarryMultiple(_target.items[i].linkedID))
                    {
                        EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel, GUILayout.Width(135f));
                        EditorGUILayout.LabelField("Count:", GUILayout.Width(50f));
                        _target.items[i].count = EditorGUILayout.IntField(_target.items[i].count, GUILayout.Width(44f));
                    }
                    else
                    {
                        EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel);
                        _target.items[i].count = 1;
                    }

                    if (GUILayout.Button(Resource.CogIcon, GUILayout.Width(20f), GUILayout.Height(15f)))
                    {
                        SideMenu(_target.items[i]);
                    }

                    EditorGUILayout.EndHorizontal();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }
                EditorGUILayout.EndVertical();
            }
            else
            {
                EditorGUILayout.HelpBox("This Container has no items", MessageType.Info);
            }

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Item to create:", GUILayout.MaxWidth(130f));
            itemNumber = EditorGUILayout.Popup(itemNumber, CreateItemList());
            if (GUILayout.Button("Add new item"))
            {
                ContainerItem newItem = new ContainerItem(CreateItemID(itemNumber), _target.GetIDArray());
                _target.items.Add(newItem);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 2
0
        override public string SetLabel()
        {
            switch (selectedCheckMethod)
            {
            case SelectedCheckMethod.NoneSelected:
                return("Nothing");

            case SelectedCheckMethod.SpecificItem:
                if (inventoryManager)
                {
                    return(inventoryManager.GetLabel(invID));
                }
                break;

            case SelectedCheckMethod.InSpecificCategory:
                if (inventoryManager)
                {
                    InvBin category = inventoryManager.GetCategory(binID);
                    if (category != null)
                    {
                        return(category.label);
                    }
                }
                break;
            }
            return(string.Empty);
        }
Exemplo n.º 3
0
        override public string SetLabel()
        {
            string labelAdd  = "";
            string labelItem = "";

            if (!inventoryManager)
            {
                inventoryManager = AdvGame.GetReferences().inventoryManager;
            }

            if (inventoryManager)
            {
                labelItem = " " + inventoryManager.GetLabel(invID);
            }

            if (invAction == InvAction.Remove)
            {
                labelAdd = " (Remove" + labelItem + ")";
            }
            else
            {
                labelAdd = " (Add" + labelItem + ")";
            }

            return(labelAdd);
        }
Exemplo n.º 4
0
        public void ShowGUI(InventoryManager inventoryManager)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Item name:", GUILayout.Width(80f));

            string itemName = inventoryManager.GetLabel(linkedID);

            if (string.IsNullOrEmpty(itemName))
            {
                itemName = "(Missing)";
            }
            else
            {
                itemName = "'" + itemName + "'";
            }

            InvItem linkedItem = inventoryManager.GetItem(linkedID);

            if (linkedItem != null && linkedItem.canCarryMultiple)
            {
                EditorGUILayout.LabelField(itemName, EditorStyles.boldLabel, GUILayout.Width(135f));

                EditorGUILayout.LabelField("Count:", GUILayout.Width(50f));
                count = EditorGUILayout.IntField(count, GUILayout.Width(44f));
                if (count <= 0)
                {
                    count = 1;
                }
            }
            else
            {
                EditorGUILayout.LabelField(itemName, EditorStyles.boldLabel);
                count = 1;
            }
        }
Exemplo n.º 5
0
        override public string SetLabel()
        {
            if (checkNothing)
            {
                return(" (Nothing)");
            }

            if (inventoryManager)
            {
                return(" (" + inventoryManager.GetLabel(invID) + ")");
            }
            return("");
        }
Exemplo n.º 6
0
        public override string SetLabel()
        {
            if (selectType == InventorySelectType.DeselectActive)
            {
                return("Deselect active");
            }

            if (inventoryManager)
            {
                return(inventoryManager.GetLabel(invID));
            }
            return(string.Empty);
        }
Exemplo n.º 7
0
        override public string SetLabel()
        {
            if (!inventoryManager)
            {
                inventoryManager = AdvGame.GetReferences().inventoryManager;
            }

            if (inventoryManager)
            {
                return(" (" + inventoryManager.GetLabel(invID) + ")");
            }

            return("");
        }
        override public string SetLabel()
        {
            if (!inventoryManager)
            {
                inventoryManager = AdvGame.GetReferences().inventoryManager;
            }

            if (invCheckType == InvCheckType.NumberOfItemsCarrying)
            {
                return(" (" + invCheckType.ToString() + ")");
            }
            if (inventoryManager)
            {
                return(" (" + inventoryManager.GetLabel(invID) + ")");
            }

            return("");
        }
Exemplo n.º 9
0
        public override string SetLabel()
        {
            if (!inventoryManager)
            {
                inventoryManager = AdvGame.GetReferences().inventoryManager;
            }

            if (invCheckType == InvCheckType.NumberOfItemsCarrying)
            {
                return(invCheckType.ToString());
            }
            if (inventoryManager)
            {
                return(inventoryManager.GetLabel(invID));
            }

            return(string.Empty);
        }
        override public string SetLabel()
        {
            if (selectType == InventorySelectType.DeselectActive)
            {
                return(" (Deselect active)");
            }

            string labelAdd  = "";
            string labelItem = "";

            if (inventoryManager)
            {
                labelItem = " " + inventoryManager.GetLabel(invID);
            }

            labelAdd = " (" + labelItem + ")";

            return(labelAdd);
        }
        override public string SetLabel()
        {
            string labelItem = string.Empty;

            if (!inventoryManager)
            {
                inventoryManager = AdvGame.GetReferences().inventoryManager;
            }

            if (inventoryManager)
            {
                labelItem = " " + inventoryManager.GetLabel(invID);
            }

            if (invAction == InvAction.Remove)
            {
                return("Remove" + labelItem);
            }
            else
            {
                return("Add" + labelItem);
            }
        }
Exemplo n.º 12
0
        public override void OnInspectorGUI()
        {
            if (_target == null || inventoryManager == null)
            {
                OnEnable();
                return;
            }

            ShowCategoriesUI(_target);
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Stored Inventory items", EditorStyles.boldLabel);
            if (_target.items.Count > 0)
            {
                EditorGUILayout.BeginVertical("Button");
                for (int i = 0; i < _target.items.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Item name:", GUILayout.Width(80f));
                    if (inventoryManager.CanCarryMultiple(_target.items[i].linkedID))
                    {
                        EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel, GUILayout.Width(135f));
                        EditorGUILayout.LabelField("Count:", GUILayout.Width(50f));
                        _target.items[i].count = EditorGUILayout.IntField(_target.items[i].count, GUILayout.Width(44f));
                    }
                    else
                    {
                        EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel);
                        _target.items[i].count = 1;
                    }

                    if (GUILayout.Button("", CustomStyles.IconCog))
                    {
                        SideMenu(_target.items[i]);
                    }

                    EditorGUILayout.EndHorizontal();

                    if (_target.limitToCategory && _target.categoryIDs != null && _target.categoryIDs.Count > 0)
                    {
                        InvItem listedItem = inventoryManager.GetItem(_target.items[i].linkedID);
                        if (listedItem != null && !_target.categoryIDs.Contains(listedItem.binID))
                        {
                            EditorGUILayout.HelpBox("This item is not in the categories checked above and will not be displayed.", MessageType.Warning);
                        }
                    }

                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }
                EditorGUILayout.EndVertical();
            }
            else
            {
                EditorGUILayout.HelpBox("This Container has no items", MessageType.Info);
            }

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("New item to store:", GUILayout.MaxWidth(130f));
            itemNumber = EditorGUILayout.Popup(itemNumber, CreateItemList());
            if (GUILayout.Button("Add new item"))
            {
                ContainerItem newItem = new ContainerItem(CreateItemID(itemNumber), _target.GetIDArray());
                _target.items.Add(newItem);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 13
0
        public override void OnInspectorGUI()
        {
            if (_target == null || inventoryManager == null)
            {
                OnEnable();
                return;
            }

            if (!sideIcon)
            {
                sideIcon = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof(Texture2D));
            }

            EditorGUILayout.LabelField("Stored Inventory items", EditorStyles.boldLabel);
            if (_target.items.Count > 0)
            {
                EditorGUILayout.BeginVertical("Button");
                for (int i = 0; i < _target.items.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Item name:", GUILayout.Width(80f));
                    if (inventoryManager.CanCarryMultiple(_target.items[i].linkedID))
                    {
                        EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel, GUILayout.Width(135f));
                        EditorGUILayout.LabelField("Count:", GUILayout.Width(50f));
                        _target.items[i].count = EditorGUILayout.IntField(_target.items[i].count, GUILayout.Width(44f));
                    }
                    else
                    {
                        EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel);
                        _target.items[i].count = 1;
                    }

                    if (GUILayout.Button(sideIcon, GUILayout.Width(20f), GUILayout.Height(15f)))
                    {
                        SideMenu(_target.items[i]);
                    }

                    EditorGUILayout.EndHorizontal();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }
                EditorGUILayout.EndVertical();
            }
            else
            {
                EditorGUILayout.HelpBox("This Container has no items", MessageType.Info);
            }

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Item to create:", GUILayout.MaxWidth(130f));
            itemNumber = EditorGUILayout.Popup(itemNumber, CreateItemList());
            if (GUILayout.Button("Add new item"))
            {
                ContainerItem newItem = new ContainerItem(CreateItemID(itemNumber), _target.GetIDArray());
                _target.items.Add(newItem);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_target);
            }
        }