Exemple #1
0
        //public int ProductMaxAmount;
        //public List<string> Placeables;
        //public List<ProductCategory> ProductsToIgnore;
        //public List<ProductEntryInfo> Products;

        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorList.Show(serializedObject.FindProperty("Products"), EditorListOption.Buttons | EditorListOption.ListLabel);
            EditorList.Show(serializedObject.FindProperty("ProductsToIgnore"), EditorListOption.Buttons | EditorListOption.ListLabel);
            EditorList.Show(serializedObject.FindProperty("Placeables"), EditorListOption.Buttons | EditorListOption.ListLabel);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("ProductMaxAmount"), new GUIContent("Default Maximum"));

            serializedObject.ApplyModifiedProperties();
        }
        //public List<ProductInfo> Products;
        //public List<CraftingContainerInfo> Containers;
        //public List<RecipeInfo> Recipes;
        //public Sprite DefaultSmallIcon;

        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            // do we have to do this every time?
            _lookup = (ProductLookupScriptable)this.serializedObject.targetObject;

            ProductNames   = _lookup.GenerateProductNames();
            ContainerNames = _lookup.GenerateContainerNames();

            EditorList.Show(serializedObject.FindProperty("Products"), EditorListOption.Buttons | EditorListOption.ListLabel);
            EditorList.Show(serializedObject.FindProperty("Containers"), EditorListOption.Buttons | EditorListOption.ListLabel);
            EditorList.Show(serializedObject.FindProperty("Recipes"));

            //EditorGUI.PropertyField(nameRect, property.FindPropertyRelative("Name"), GUIContent.none);
            serializedObject.ApplyModifiedProperties();
        }
Exemple #3
0
        //public class RecipeInfo
        //{
        //    public string ResultProduct;
        //    public int ResultAmount;
        //    public List<IngredientInfo> Ingredients;
        //    public TimeLength TimeLength;
        //    public string ContainerName;
        //}
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);
            EditorGUI.indentLevel = 1;
            var startX = position.x;

            var names       = ProductLookupEditor.ProductNames;
            var productRect = new Rect(position.x, position.y, 110, position.height);

            _productNameBinder.SetStringValueFromList(property.FindPropertyRelative("ResultProduct"), names, productRect);
            position.x += 110;

            var labelRect = new Rect(position.x, position.y, 40, position.height);

            EditorGUI.LabelField(labelRect, "Qty");
            position.x += 35;

            var amountRect = new Rect(position.x, position.y, 40, position.height);

            EditorGUI.PropertyField(amountRect, property.FindPropertyRelative("ResultAmount"), GUIContent.none);
            position.x += 40;

            names = ProductLookupEditor.ContainerNames;
            var containerRect = new Rect(position.x, position.y, 140, position.height);

            _containerNameBinder.SetStringValueFromList(property.FindPropertyRelative("ContainerName"), names, containerRect);
            position.x += 140;

            EditorGUI.indentLevel = 1;
            position.y           += position.height + 2;
            position.x            = startX;

            var timeRect = new Rect(position.x, position.y, 200, position.height);

            EditorGUI.PropertyField(timeRect, property.FindPropertyRelative("TimeLength"), GUIContent.none);
            position.x += 140;


            EditorGUI.indentLevel = 11;
            EditorList.Show(property.FindPropertyRelative("Ingredients"), EditorListOption.ListLabel | EditorListOption.Buttons);

            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
            GUILayout.Space(10);
            EditorGUI.EndProperty();
        }
Exemple #4
0
 public override void OnInspectorGUI()
 {
     serializedObject.Update();
     EditorList.Show(serializedObject.FindProperty("Products"), EditorListOption.Buttons | EditorListOption.ListLabel);
     serializedObject.ApplyModifiedProperties();
 }