コード例 #1
0
 public void SetTarget(UnityEngine.Object target)
 {
     if (!WindowFindAssetReferences.CheckTarget(target, true))
     {
         return;
     }
     this.m_target = target;
 }
コード例 #2
0
ファイル: FindProMenu.cs プロジェクト: faint449/GGJ2017DEMO
        private static bool QuickFindAssetReferencesValidate()
        {
            Object obj = Selection.activeObject;

            if (obj == null)
            {
                return(false);
            }

            bool isValid = WindowFindAssetReferences.CheckTarget(obj, false);

            return(isValid);
        }
コード例 #3
0
ファイル: FindProMenu.cs プロジェクト: faint449/GGJ2017DEMO
        private static void QuickFindAssetReferences()
        {
            WindowFindAssetReferences window = EditorWindow.GetWindow <WindowFindAssetReferences>(false, "Find Asset References", true);

            window.SetTarget(Selection.activeObject);
        }
コード例 #4
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();
                }
            }
        }