Esempio n. 1
0
    /// <summary>
    /// Draw the custom wizard.
    /// </summary>

    void OnGUI()
    {
        NGUIEditorTools.SetLabelWidth(80f);
        string newItemName = EditorGUILayout.TextField("Search for:", mItemName);

        NGUIEditorTools.DrawSeparator();

        if (GUI.changed || newItemName != mItemName)
        {
            mItemName = newItemName;

            if (string.IsNullOrEmpty(mItemName))
            {
                mResults.Clear();
            }
            else
            {
                FindAllByName(mItemName);
            }
        }

        if (mResults.Count == 0)
        {
            if (!string.IsNullOrEmpty(mItemName))
            {
                GUILayout.Label("No matches found");
            }
        }
        else
        {
            Print3("Item ID", "Item Name", "Path", false);
            NGUIEditorTools.DrawSeparator();
            {
                var __list1      = mResults;
                var __listCount1 = __list1.Count;
                for (int __i1 = 0; __i1 < __listCount1; ++__i1)
                {
                    var fr = (FindResult)__list1[__i1];
                    {
                        if (Print3(InvDatabase.FindItemID(fr.item).ToString(),
                                   fr.item.name, NGUITools.GetHierarchy(fr.db.gameObject), true))
                        {
                            InvDatabaseInspector.SelectIndex(fr.db, fr.item);
                            Selection.activeGameObject = fr.db.gameObject;
                            EditorUtility.SetDirty(Selection.activeGameObject);
                        }
                    }
                }
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Draw the custom wizard.
    /// </summary>

    void OnGUI()
    {
        EditorGUIUtility.LookLikeControls(80f);
        string newItemName = EditorGUILayout.TextField("Search for:", mItemName);

        NGUIEditorTools.DrawSeparator();

        if (GUI.changed || newItemName != mItemName)
        {
            mItemName = newItemName;

            if (string.IsNullOrEmpty(mItemName))
            {
                mResults.Clear();
            }
            else
            {
                FindAllByName(mItemName);
            }
        }

        if (mResults.Count == 0)
        {
            if (!string.IsNullOrEmpty(mItemName))
            {
                GUILayout.Label("No matches found");
            }
        }
        else
        {
            Print3("Item ID", "Item Name", "Path", false);
            NGUIEditorTools.DrawSeparator();

            foreach (FindResult fr in mResults)
            {
                if (Print3(InvDatabase.FindItemID(fr.item).ToString(),
                           fr.item.name, NGUITools.GetHierarchy(fr.db.gameObject), true))
                {
                    InvDatabaseInspector.SelectIndex(fr.db, fr.item);
                    Selection.activeGameObject = fr.db.gameObject;
                    EditorUtility.SetDirty(Selection.activeGameObject);
                }
            }
        }
    }