Пример #1
0
        private void CreateLightLineStyle()
        {
            Color     color      = this.m_themeColors.Get("LightLine").color;
            Texture2D background = TnGUIUtil.CreateTexture(2, 2, color);

            this.m_lightLineStyle = new GUIStyle(this.m_baseStyle);
            this.m_lightLineStyle.normal.background = background;
        }
Пример #2
0
        private void CreateFocusedLineStyle()
        {
            Color     color      = this.m_themeColors.Get("FocusedLine").color;
            Texture2D background = TnGUIUtil.CreateTexture(2, 2, color);

            this.m_focusedLineStyle = new GUIStyle(this.m_baseStyle);
            this.m_focusedLineStyle.normal.background = background;
            this.m_focusedLineStyle.normal.textColor  = Color.white;
        }
Пример #3
0
        private void DrawDetailsButton()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            bool  flag  = this.m_itemMgr.GetSelectedItemCount() > 0;
            Color color = flag ? TnColor.green : TnColor.gold;
            bool  flag2 = TnGUIUtil.Button(color, ButtonColorMode.Background, "Select and See Details In Hierarchy View", new GUILayoutOption[]
            {
                GUILayout.Width(350f)
            });

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            if (!flag2)
            {
                return;
            }
            if (!flag)
            {
                EditorUtility.DisplayDialog("Warning", "You should select one result at least.", "OK");
                return;
            }
            if (!EditorUtility.DisplayDialog("Warning", "This operation will create a duplicate of the object being looked up in the hierarchy. Continue?", "Yes", "No"))
            {
                return;
            }
            List <GameObject> list = this.CreatePrefabsOfSelectedItems();

            if (list.Count <= 0)
            {
                return;
            }
            Selection.objects = list.ToArray();
            if (this.m_onDetailsButtonClicked != null)
            {
                this.m_onDetailsButtonClicked(this, list);
            }
        }
        private void DrawSearchDialog()
        {
            GUILayout.Label("Find missing references and/or null references.", new GUILayoutOption[0]);
            TnEditorGUIUtil.DrawSeparator();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Find:", new GUILayoutOption[]
            {
                GUILayout.Width(WindowFindMissingReferences.LABEL_WIDTH)
            });
            this.m_includeMissing = GUILayout.Toggle(this.m_includeMissing, "Missing References", new GUILayoutOption[]
            {
                GUILayout.Width(150f)
            });
            this.m_includeNull = GUILayout.Toggle(this.m_includeNull, "Null References", new GUILayoutOption[]
            {
                GUILayout.Width(150f)
            });
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Look in:", new GUILayoutOption[]
            {
                GUILayout.Width(WindowFindMissingReferences.LABEL_WIDTH)
            });
            this.m_typeIndex = GUILayout.Toolbar(this.m_typeIndex, WindowFindMissingReferences.STR_TYPES, EditorStyles.radioButton, new GUILayoutOption[]
            {
                GUILayout.Width(210f)
            });
            GUILayout.EndHorizontal();
            if (this.m_typeIndex == 0)
            {
                this.m_folderList.Draw();
            }
            else if (this.m_typeIndex == 1)
            {
                this.m_gameObjectList.Draw();
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Filter:", new GUILayoutOption[]
            {
                GUILayout.Width(WindowFindMissingReferences.LABEL_WIDTH)
            });
            this.m_filterIndex = GUILayout.Toolbar(this.m_filterIndex, WindowFindMissingReferences.STR_FILTERS, EditorStyles.radioButton, new GUILayoutOption[]
            {
                GUILayout.Width(210f)
            });
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            bool flag = TnGUIUtil.Button(TnColor.lightskyblue, ButtonColorMode.Background, "Search", new GUILayoutOption[]
            {
                GUILayout.Width(WindowFindMissingReferences.BUTTON_WIDTH)
            });

            GUILayout.EndHorizontal();
            if (flag)
            {
                if (!this.m_includeMissing && !this.m_includeNull)
                {
                    EditorUtility.DisplayDialog("Warning", "You should select \"Missing References\" or \"Null References\"", "OK");
                    return;
                }
                if (this.m_typeIndex == 0)
                {
                    List <string> folders = this.m_folderList.GetFolders();
                    if (folders.Count == 0)
                    {
                        FindProFactory.PopUpDialog_NoFolderSelected();
                        return;
                    }
                    this.CreateJob1();
                    return;
                }
                else if (this.m_typeIndex == 1)
                {
                    List <GameObject> gameObjects = this.m_gameObjectList.GetGameObjects();
                    if (gameObjects.Count == 0)
                    {
                        FindProFactory.PopUpDialog_NoHierarchyRootGameObjects();
                        return;
                    }
                    this.CreateJob2();
                }
            }
        }
Пример #5
0
        private void DrawSearchDialog()
        {
            GUILayout.Label("Find where a particular asset or value is being used.", new GUILayoutOption[0]);
            TnEditorGUIUtil.DrawSeparator();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Target Type:", new GUILayoutOption[]
            {
                GUILayout.Width(WindowFindAssetReferences.LABEL_WIDTH)
            });
            this.m_targetType = (TargetType)EditorGUILayout.EnumPopup(this.m_targetType, new GUILayoutOption[]
            {
                GUILayout.Width(210f)
            });
            if (this.m_targetType == TargetType.Object)
            {
                GUILayout.Label("(Script, GameObject, Texture, etc)", new GUILayoutOption[0]);
            }
            else if (this.m_targetType == TargetType.Value)
            {
                GUILayout.Label("(Integer, String, Enum, etc)", new GUILayoutOption[0]);
            }
            GUILayout.EndHorizontal();
            if (this.m_targetType == TargetType.Object)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("Target:", new GUILayoutOption[]
                {
                    GUILayout.Width(WindowFindAssetReferences.LABEL_WIDTH)
                });
                this.m_target = EditorGUILayout.ObjectField(this.m_target, typeof(UnityEngine.Object), false, new GUILayoutOption[]
                {
                    GUILayout.Width(210f)
                });
                bool flag = GUILayout.Button("Select", new GUILayoutOption[]
                {
                    GUILayout.Width(WindowFindAssetReferences.BUTTON_WIDTH)
                });
                if (flag)
                {
                    UnityEngine.Object activeObject = Selection.activeObject;
                    this.SetTarget(activeObject);
                }
                GUILayout.EndHorizontal();
                this.m_extraLine = 1;
            }
            else if (this.m_targetType == TargetType.Value)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("Value Type:", new GUILayoutOption[]
                {
                    GUILayout.Width(WindowFindAssetReferences.LABEL_WIDTH)
                });
                this.m_valueType = (ValueType)EditorGUILayout.EnumPopup(this.m_valueType, new GUILayoutOption[]
                {
                    GUILayout.Width(210f)
                });
                if (this.m_valueType == ValueType.Float)
                {
                    GUILayout.Label("Tolerance:", new GUILayoutOption[]
                    {
                        GUILayout.Width(70f)
                    });
                    this.m_decimalTolerance = EditorGUILayout.FloatField(this.m_decimalTolerance, new GUILayoutOption[]
                    {
                        GUILayout.Width(90f)
                    });
                }
                else if (this.m_valueType == ValueType.String)
                {
                    this.m_isStrValueIgnoreCase = GUILayout.Toggle(this.m_isStrValueIgnoreCase, "Ignore Case", new GUILayoutOption[]
                    {
                        GUILayout.Width(WindowFindAssetReferences.BUTTON_WIDTH)
                    });
                }
                else if (this.m_valueType == ValueType.Enum)
                {
                    this.m_isEnumValueIgnoreCase = GUILayout.Toggle(this.m_isEnumValueIgnoreCase, "Ignore Case", new GUILayoutOption[]
                    {
                        GUILayout.Width(WindowFindAssetReferences.BUTTON_WIDTH)
                    });
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("Value:", new GUILayoutOption[]
                {
                    GUILayout.Width(WindowFindAssetReferences.LABEL_WIDTH)
                });
                if (this.m_valueType == ValueType.Integer)
                {
                    this.m_intValue = EditorGUILayout.IntField(this.m_intValue, new GUILayoutOption[]
                    {
                        GUILayout.Width(210f)
                    });
                }
                else if (this.m_valueType == ValueType.Float)
                {
                    this.m_floatValue = EditorGUILayout.FloatField(this.m_floatValue, new GUILayoutOption[]
                    {
                        GUILayout.Width(210f)
                    });
                }
                else if (this.m_valueType == ValueType.String)
                {
                    this.m_strValue = GUILayout.TextField(this.m_strValue, new GUILayoutOption[]
                    {
                        GUILayout.Width(210f)
                    });
                }
                else if (this.m_valueType == ValueType.Enum)
                {
                    this.m_enumValue = GUILayout.TextField(this.m_enumValue, new GUILayoutOption[]
                    {
                        GUILayout.Width(210f)
                    });
                }
                GUILayout.EndHorizontal();
                this.m_extraLine = 2;
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Look in:", new GUILayoutOption[]
            {
                GUILayout.Width(WindowFindAssetReferences.LABEL_WIDTH)
            });
            this.m_typeIndex = GUILayout.Toolbar(this.m_typeIndex, WindowFindAssetReferences.STR_TYPES, EditorStyles.radioButton, new GUILayoutOption[]
            {
                GUILayout.Width(210f)
            });
            if (this.m_typeIndex == 0)
            {
                GUILayout.Label("Search Type:", new GUILayoutOption[]
                {
                    GUILayout.Width(WindowFindAssetReferences.LABEL_WIDTH)
                });
                this.m_searchType = (SearchType)EditorGUILayout.EnumPopup(this.m_searchType, new GUILayoutOption[]
                {
                    GUILayout.Width(210f)
                });
            }
            GUILayout.EndHorizontal();
            if (this.m_typeIndex == 0)
            {
                this.m_folderList.Draw();
            }
            else if (this.m_typeIndex == 1)
            {
                this.m_gameObjectList.Draw();
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            bool flag2 = TnGUIUtil.Button(TnColor.lightskyblue, ButtonColorMode.Background, "Search", new GUILayoutOption[]
            {
                GUILayout.Width(WindowFindAssetReferences.BUTTON_WIDTH)
            });

            GUILayout.EndHorizontal();
            if (flag2)
            {
                if (this.m_targetType == TargetType.Object)
                {
                    if (!WindowFindAssetReferences.CheckTarget(this.m_target, true))
                    {
                        return;
                    }
                    this.m_isTargetPrefab = TnEditorPrefabUtil.IsPrefab(this.m_target);
                    this.m_targetComponentIID.Clear();
                    GameObject gameObject = this.m_target as GameObject;
                    if (gameObject != null)
                    {
                        Component[] components = gameObject.GetComponents(typeof(Component));
                        Component[] array      = components;
                        for (int i = 0; i < array.Length; i++)
                        {
                            Component component  = array[i];
                            int       instanceID = component.GetInstanceID();
                            this.m_targetComponentIID.Add(instanceID);
                        }
                    }
                }
                else if (this.m_targetType == TargetType.Value)
                {
                    if (!this.CheckValue(true))
                    {
                        return;
                    }
                    if (this.m_valueType == ValueType.String)
                    {
                        this.m_strValueInternal = this.m_strValue;
                        if (this.m_isStrValueIgnoreCase)
                        {
                            this.m_strValueInternal = this.m_strValue.ToLower();
                        }
                    }
                    else if (this.m_valueType == ValueType.Enum)
                    {
                        this.m_enumValueInternal = this.m_enumValue;
                        if (this.m_isEnumValueIgnoreCase)
                        {
                            this.m_enumValueInternal = this.m_enumValue.ToLower();
                        }
                    }
                }
                if (this.m_typeIndex == 0)
                {
                    List <string> folders = this.m_folderList.GetFolders();
                    if (folders.Count == 0)
                    {
                        FindProFactory.PopUpDialog_NoFolderSelected();
                        return;
                    }
                    this.CreateJob1();
                    return;
                }
                else if (this.m_typeIndex == 1)
                {
                    List <GameObject> gameObjects = this.m_gameObjectList.GetGameObjects();
                    if (gameObjects.Count == 0)
                    {
                        FindProFactory.PopUpDialog_NoHierarchyRootGameObjects();
                        return;
                    }
                    this.CreateJob2();
                }
            }
        }