Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(this.m_Script);
            EditorGUI.EndDisabledGroup();
            serializedObject.Update();
            EditorGUILayout.PropertyField(this.m_WindowName);
            serializedObject.ApplyModifiedProperties();

            if (EditorTools.RightArrowButton(new GUIContent("Bones"), GUILayout.Height(24f)))
            {
                if (InventorySystemEditor.Database == null)
                {
                    InventorySystemEditor.SelectDatabase(delegate { UtilityInstanceWindow.CloseWindow(); ShowBoneMap(); });
                }
                else
                {
                    ShowBoneMap();
                }
            }

            if (EditorTools.RightArrowButton(new GUIContent("Items"), GUILayout.Height(24f)))
            {
                VisibleItemsEditor.ShowWindow("Items", serializedObject.FindProperty("m_VisibleItems"));
            }

            if (EditorWindow.mouseOverWindow != null)
            {
                EditorWindow.mouseOverWindow.Repaint();
            }
        }
Ejemplo n.º 2
0
        public new static void ShowWindow(string title, SerializedProperty elements)
        {
            VisibleItemsEditor[] objArray = Resources.FindObjectsOfTypeAll <VisibleItemsEditor>();
            VisibleItemsEditor   window   = (objArray.Length <= 0 ? ScriptableObject.CreateInstance <VisibleItemsEditor>() : objArray[0]);

            window.hideFlags             = HideFlags.HideAndDontSave;
            window.minSize               = new Vector2(260f, 200f);
            window.titleContent          = new GUIContent(title);
            window.m_ElementPropertyPath = elements.propertyPath;
            window.m_Target              = elements.serializedObject.targetObject;
            window.m_Targets             = new UnityEngine.Object[elements.arraySize];
            for (int i = 0; i < elements.arraySize; i++)
            {
                window.m_Targets[i] = elements.GetArrayElementAtIndex(i).objectReferenceValue;

                window.m_Targets[i].hideFlags = EditorPrefs.GetBool("InventorySystem.showAllComponents") ? HideFlags.None:HideFlags.HideInInspector;
            }
            window.m_HasPrefab = PrefabUtility.GetNearestPrefabInstanceRoot(window.m_Target) != null;
            window.m_Editors   = new List <Editor>();
            window.elementType = Utility.GetType(elements.arrayElementType.Replace("PPtr<$", "").Replace(">", ""));
            for (int i = 0; i < window.m_Targets.Length; i++)
            {
                Editor editor = Editor.CreateEditor(window.m_Targets[i]);
                window.m_Editors.Add(editor);
            }
            window.FixMissingAssets();
            window.ShowUtility();
        }
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(this.m_Script);
            EditorGUI.EndDisabledGroup();
            serializedObject.Update();
            EditorGUILayout.PropertyField(this.m_WindowName);
            serializedObject.ApplyModifiedProperties();

            if (EditorTools.RightArrowButton(new GUIContent("Bones"), GUILayout.Height(24f)))
            {
                ShowBoneMap();
            }

            if (EditorTools.RightArrowButton(new GUIContent("Items"), GUILayout.Height(24f)))
            {
                VisibleItemsEditor.ShowWindow("Items", serializedObject.FindProperty("m_VisibleItems"));
            }

            if (EditorWindow.mouseOverWindow != null)
            {
                EditorWindow.mouseOverWindow.Repaint();
            }
        }