Beispiel #1
0
        public override void OnInspectorGUI()
        {
            if (skin)
            {
                GUI.skin = skin;
            }
            var assetPath = AssetDatabase.GetAssetPath(target);

            GUILayout.BeginVertical("vItemEnums List", "window");
            GUILayout.Space(30);
            if (assetPath.Contains("Resources"))
            {
                GUILayout.BeginVertical("box");
                base.OnInspectorGUI();
                GUILayout.EndHorizontal();
                EditorGUILayout.Space();
                if (GUILayout.Button("Open ItemEnums Editor"))
                {
                    ItemEnumsWindow.CreateWindow();
                }
                EditorGUILayout.Space();
                if (GUILayout.Button("Refresh ItemEnums"))
                {
                    ItemEnumsBuilder.RefreshItemEnums();
                }

                EditorGUILayout.HelpBox("-This list will be merged with other lists and create the enums.\n- The Enum Generator will ignore equal values.\n- If our change causes errors, check which enum value is missing and adds to the list and press the refresh button.", MessageType.Info);
            }
            else
            {
                EditorGUILayout.HelpBox("Please put this list in Resources folder", MessageType.Warning);
            }
            GUILayout.EndVertical();
        }
        void OnGUI()
        {
            if (skin)
            {
                GUI.skin = skin;
            }
            this.minSize = new Vector2(460, 600);
            GUILayout.BeginVertical("box");
            GUILayout.Box("vItemEnums");
            GUILayout.BeginHorizontal();
            #region Item Type current
            GUILayout.BeginVertical("box", GUILayout.Width(215));
            GUILayout.Box("Item Types", GUILayout.ExpandWidth(true));

            for (int i = 0; i < _itemTypeNames.Count; i++)
            {
                GUILayout.Label(_itemTypeNames[i], EditorStyles.miniBoldLabel);
            }

            GUILayout.EndVertical();
            #endregion
            #region Item Attribute current
            GUILayout.BeginVertical("box", GUILayout.Width(215));
            GUILayout.Box("Item Attributes", GUILayout.ExpandWidth(true));

            for (int i = 0; i < _itemAttributeNames.Count; i++)
            {
                GUILayout.Label(_itemAttributeNames[i], EditorStyles.miniBoldLabel);
            }

            GUILayout.EndVertical();
            #endregion

            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.BeginVertical("box");
            GUILayout.Box("Edit Enums", GUILayout.ExpandHeight(false));
            scrollView = GUILayout.BeginScrollView(scrollView, GUILayout.MinHeight(100), GUILayout.MaxHeight(600));
            for (int i = 0; i < datas.Length; i++)
            {
                DrawItemEnumListData(datas[i]);
            }
            GUILayout.EndScrollView();
            EditorGUILayout.HelpBox("If the field has is gray, the vItemEnums contains same value", MessageType.Info);
            if (GUILayout.Button(new GUIContent("Refresh ItemEnums", "Save and refesh changes to vItemEnums")))
            {
                ItemEnumsBuilder.RefreshItemEnums();
            }
            GUILayout.EndVertical();
        }