示例#1
0
 protected override void Visit_PROC_TYPE(PROC_TYPE node)
 {
     /* MOVE CODE HERE */
 }
    void DrawBasicInfo(float x, float y, float w, float h)
    {
        Rect rt = new Rect(x, y, w, h);

        GUI_Box(rt, "");

        float xx = x + 5;
        float yy = y + 5;
        float ww = 300;
        float hh = 20;
        float wwSize = 10, hhSize = 5;
        float labelSize = 120;

        rt.Set(xx, yy, ww, hh);
        if (_SelectObject != null)
        {
            GUI_ObjectField(rt, "Select Object : ", _SelectObject, _SelectObject.GetType(), labelSize);
        }
        else
        {
            GUI_LabelField(rt, "Not Found Object !!");
        }

        if ((_SelectObject != null) && (_SelectObject is GameObject))
        {
#if NGUI_USED
            UIAtlas atlas = (_SelectObject as GameObject).GetComponent <UIAtlas>();
            if (atlas != null)
            {
                if (_is_sprite_lock == 1)
                {
                    if (Selection.activeObject != null)
                    {
                        _SelectName = Selection.activeObject.name;
                    }
                }

                rt.Set(xx, yy + hh + hhSize, ww, hh);
                _SelectName = GUI_TextField(rt, "Sprite Name : ", _SelectName, labelSize);

                if (_is_select_lock == 1)
                {
                    Rect rt2 = new Rect(xx + rt.width + wwSize, rt.y, 100, hh);
                    _is_sprite_lock = GUI_BoolField(rt2, "is Sprite Lock", _is_sprite_lock);
                }
                else
                {
                    _is_sprite_lock = 0;
                }
            }
            else
            {
                _is_sprite_lock = 0;
                _SelectName     = "";
            }
#else
            _is_sprite_lock = 0;
            _SelectName     = "";
#endif
        }
        else
        {
            _is_sprite_lock = 0;
            _SelectName     = "";
        }
        xx += (rt.width + wwSize);

        rt.Set(xx, yy, 100, hh);
        _is_select_lock = GUI_BoolField(rt, "is Select Lock", _is_select_lock);
        xx += (rt.width + wwSize);

        rt.Set(xx, yy, ww, hh);
        if (_FindObject != null)
        {
            GUI_ObjectField(rt, "Find Object : ", _FindObject, _FindObject.GetType(), labelSize);
        }
        else
        {
            GUI_LabelField(rt, "Not Found Object !!");
        }
        xx += (rt.width + wwSize);

        xx = x + w - 450;
        ww = 150;

        rt.Set(xx, yy + hh, ww, hh);
        if (GUI.Button(rt, "Find"))
        {
            GUI.FocusControl("Find");

            if (_PathList.Count == 0)
            {
                _Type = PROC_TYPE.LOAD_START;
            }
            else
            {
                _Type = PROC_TYPE.SEARCH_START;
            }
            _Kind       = PROC_KIND.BASIC;
            _FindObject = _SelectObject;
            _Objs.Clear();
        }
        xx += ww;

        rt.Set(xx, yy + hh, ww, hh);
        if (GUI.Button(rt, "Find(not prefab)"))
        {
            GUI.FocusControl("Find(not prefab)");

            if (_PathList.Count == 0)
            {
                _Type = PROC_TYPE.LOAD_START;
            }
            else
            {
                _Type = PROC_TYPE.SEARCH_START;
            }
            _Kind       = PROC_KIND.NOT_GAMEOBJECT;
            _FindObject = _SelectObject;
            _Objs.Clear();
        }
        xx += ww;

        rt.Set(xx, yy + hh, ww, hh);
        if (GUI.Button(rt, "Select All"))
        {
            GUI.FocusControl("Select All");

            if (_Objs.Count > 0)
            {
                Selection.objects = _Objs.ToArray();
            }
        }
    }
示例#3
0
 protected virtual void Visit_PROC_TYPE(PROC_TYPE node)
 {
 }
    void OnGUI()
    {
        if (_is_select_lock == 0)
        {
            _SelectObject = Selection.activeObject;
        }

        float x = 0, y = 0, w = Screen.width, h = Screen.height - 23;

        DrawWindow(x, y, w, h);

        switch (_Type)
        {
        case PROC_TYPE.LOAD_START:
            _Type = PROC_TYPE.LOAD_READY;
            break;

        case PROC_TYPE.LOAD_READY:
            EditorUtility.DisplayProgressBar("Find Using Object", "파일 리스트 정리", 0.0f);

            _Type = PROC_TYPE.LOAD_FILE_LIST;
            break;

        case PROC_TYPE.LOAD_FILE_LIST:
            _PathList.Clear();
            GetFiles(_PathList, "Assets/", "*.*");

            EditorUtility.DisplayProgressBar("Find Using Object", "데이터 로딩 시작", 0.1f);

            _Type     = PROC_TYPE.LOAD_DATA_LIST;
            _Progress = 0;

            _Oris.Clear();
            break;

        case PROC_TYPE.LOAD_DATA_LIST:
            int count = Mathf.Max(1, _PathList.Count / 9);
            int next  = Mathf.Min(_PathList.Count, _Progress + count);

            //GameObject ori;
            for ( ; _Progress < next; _Progress++)
            {
                DirectoryInfo dir = new DirectoryInfo(_PathList[_Progress]);
                switch (dir.Extension.ToLower())
                {
                case ".prefab":
                {
                    GameObject ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(GameObject)) as GameObject;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".shader":
                {
                    Shader ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(Shader)) as Shader;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".cs":
                {
                    MonoScript ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(MonoScript)) as MonoScript;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".mat":
                {
                    Material ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(Material)) as Material;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".controller":
                {
                    RuntimeAnimatorController ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(RuntimeAnimatorController)) as RuntimeAnimatorController;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".anim":
                {
                    AnimationClip ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(AnimationClip)) as AnimationClip;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".psd":
                case ".png":
                case ".jpg":
                case ".tga":
                {
                    Texture2D ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(Texture2D)) as Texture2D;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".fbx":
                    break;

                case ".wav":
                case ".mp3":
                case ".ogg":
                {
                    AudioClip ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(AudioClip)) as AudioClip;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".xml":
                case ".txt":
                {
                    TextAsset ori = AssetDatabase.LoadAssetAtPath(_PathList[_Progress], typeof(TextAsset)) as TextAsset;
                    if (ori != null)
                    {
                        _Oris.Add(ori);
                    }
                    else
                    {
                        Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    }
                }
                break;

                case ".unity":
                case ".pdf":
                case ".guiskin":
                case ".dll":
                case ".dylib":
                    break;

                default:
                    Debug.Log(dir.Extension.ToString() + ":" + dir.Name);
                    break;
                }
            }

            if (_Progress < _PathList.Count)
            {
                float per = 0.1f + 0.9f * (float)_Progress / _PathList.Count;
                EditorUtility.DisplayProgressBar("Find Using Object", "데이터 로딩중 - " + ((int)(per * 100)).ToString() + "%", per);
            }
            else
            {
                EditorUtility.DisplayProgressBar("Find Using Object", "데이터 로딩중 - 100%", 1.0f);

                _Type = PROC_TYPE.LOAD_COMPLETE;
            }
            break;

        case PROC_TYPE.LOAD_COMPLETE:
            EditorUtility.ClearProgressBar();

            _Type = PROC_TYPE.SEARCH_START;
            break;

        case PROC_TYPE.SEARCH_START:
            _Type = PROC_TYPE.SEARCH_READY;
            break;

        case PROC_TYPE.SEARCH_READY:
            _Type = PROC_TYPE.SEARCH_LIST;

            _Objs.Clear();
            break;

        case PROC_TYPE.SEARCH_LIST:
            EditorUtility.DisplayProgressBar("Find Using Object", "파일 검색중", 1.0f);

            FindResources(_FindObject, ref _Objs);

            _Type = PROC_TYPE.SEARCH_COMPLETE;
            break;

        case PROC_TYPE.SEARCH_COMPLETE:
            EditorUtility.ClearProgressBar();

            _Type = PROC_TYPE.NONE;
            break;
        }
    }