void OnGUI()
 {
     this.title = windowName;
     GUILayout.BeginVertical();
     GUILayout.Label("Make Atlas bundle");
     for (int i = 0; i < atlasCount; ++i)
     {
         XfgjComponentSelector.Draw <UIAtlas>("Select", atlasArr[i], i, OnSelectAtlas);
     }
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Add", GUILayout.MinWidth(50)))
     {
         atlasCount++;
         if (atlasCount > atlasArr.Length)
         {
             UIAtlas[] tmpArr = atlasArr;
             atlasArr = new UIAtlas[tmpArr.Length + ARRAY_DELTA];
             for (int i = 0; i < tmpArr.Length; ++i)
             {
                 atlasArr[i] = tmpArr[i];
             }
         }
     }
     if (GUILayout.Button("Build", GUILayout.MinWidth(50)))
     {
         CreateBundle();
     }
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }
Exemple #2
0
 void OnGUI()
 {
     this.title = windowName;
     GUILayout.BeginVertical();
     GUILayout.Label("Make Scene bundle");
     for (int i = 0; i < sceneCount; ++i)
     {
         XfgjComponentSelector.Draw <SceneAsset>("Select", sceneArr[i], i, OnSelectScene);
     }
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Add", GUILayout.MinWidth(50)))
     {
         sceneCount++;
         if (sceneCount > sceneArr.Length)
         {
             SceneAsset[] tmpArr = sceneArr;
             sceneArr = new SceneAsset[tmpArr.Length + ARRAY_DELTA];
             for (int i = 0; i < tmpArr.Length; ++i)
             {
                 sceneArr[i] = tmpArr[i];
             }
         }
     }
     if (GUILayout.Button("Build", GUILayout.MinWidth(50)))
     {
         CreateBundle();
     }
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }
Exemple #3
0
    /// <summary>
    /// Show the selection wizard.
    /// </summary>

    static public void Show <T> (OnSelectionCallback cb, int?index) where T : Object
    {
        System.Type           type = typeof(T);
        XfgjComponentSelector comp = ScriptableWizard.DisplayWizard <XfgjComponentSelector>("Select a " + GetName(type));

        comp.mType     = type;
        comp.mCallback = cb;
        comp.index     = index;

        if (type == typeof(UIAtlas) || type == typeof(UIFont))
        {
            BetterList <T> list  = new BetterList <T>();
            string[]       paths = AssetDatabase.GetAllAssetPaths();

            for (int i = 0; i < paths.Length; ++i)
            {
                string path = paths[i];
                if (path.EndsWith(".prefab", System.StringComparison.OrdinalIgnoreCase))
                {
                    GameObject obj = AssetDatabase.LoadMainAssetAtPath(path) as GameObject;

                    if (obj != null && PrefabUtility.GetPrefabType(obj) == PrefabType.Prefab)
                    {
                        T t = obj.GetComponent(typeof(T)) as T;
                        if (t != null)
                        {
                            list.Add(t);
                        }
                    }
                }
            }
            comp.mObjects = list.ToArray();
        }
        else if (type == typeof(SceneAsset))
        {
            BetterList <Object> list  = new BetterList <Object>();
            string[]            paths = AssetDatabase.GetAllAssetPaths();

            for (int i = 0; i < paths.Length; ++i)
            {
                string path = paths[i];
                if (path.EndsWith(XfgjEditor.SCENE_EXT, System.StringComparison.OrdinalIgnoreCase) &&
                    path.Contains(XfgjEditor.SCENE_FOLDER))
                {
                    SceneAsset sceneAsset = SceneAsset.CreateInstance <SceneAsset>();
                    sceneAsset.assetPath = path;
                    list.Add(sceneAsset);
                }
            }
            comp.mObjects = list.ToArray();
        }
        else
        {
            comp.mObjects = Resources.FindObjectsOfTypeAll(typeof(T));
        }
    }