Example #1
0
    public static void ExportBundlesEx()
    {
        ExportScenesManager.AutoSwitchTarget();
        var dirs = Directory.GetDirectories(ExportScenesManager.GetFolderPath(ExportScenesManager.ExportPath));
        //if (files.Length != 0)
        //{
        var currentVersion = new VersionCodeInfo("0.0.0.1");

        foreach (var item in dirs)
        {
            var fileVersion = new VersionCodeInfo(new DirectoryInfo(item).Name);
            if (fileVersion.Compare(currentVersion) > 0)
            {
                currentVersion = fileVersion;
            }
        }
        //var m_currentVersion = currentVersion.GetLowerVersion();
        var m_newVersion       = currentVersion.ToString();
        var m_newVersionFolder = Path.Combine(ExportScenesManager.GetFolderPath(ExportScenesManager.ExportPath), m_newVersion).Replace("\\", "/");

        var targetPath = m_newVersionFolder + BuildProjectExWizard.ExportFilesPath;

        var selection = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
        var paths     = (from s in selection
                         let path = AssetDatabase.GetAssetPath(s)
                                    where File.Exists(path)
                                    select path).ToArray();

        foreach (string item in paths)
        {
            Debug.Log("ex " + item);
            ExportBundle(new string[] { item }, targetPath);
        }
    }
Example #2
0
    public static void ExportAllBundles()
    {
        ExportScenesManager.AutoSwitchTarget();
        string path     = "Assets/Resources/GUI";
        var    rootPath = ExportScenesManager.GetFolderPath(ExportScenesManager.SubMogoResources);

        fileList.Clear();
        GetSubDir(path);
        var files = fileList.Select(x => x.Replace('\\', '/')).Where(x => x.EndsWith(".prefab")).ToArray();

        ExportScenesManager.LogDebug(files.PackArray('\n'));
        BuildBundleWithRoot(files, rootPath, true);
    }
Example #3
0
    public static void ExportBundles()
    {
        ExportScenesManager.AutoSwitchTarget();
        //ExportScenesManager.CurrentBuildTarget = BuildTarget.StandaloneWindows64;
        var rootPath  = ExportScenesManager.GetFolderPath(ExportScenesManager.SubMogoResources);
        var selection = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
        var paths     = (from s in selection
                         let path = AssetDatabase.GetAssetPath(s)
                                    where File.Exists(path)
                                    select path).ToArray();

        foreach (var item in paths)
        {
            ExportBundle(new string[] { item }, rootPath);
        }
        //var shederPath = ExportScenesManager.GetFolderPath("Shader_PC");
        //ExportScenesManager.DirectoryCopy(shederPath, rootPath, true, true);
        //var path = AssetDatabase.GetAssetPath(Selection.activeObject);
        //if (File.Exists(path))
        //    ExportBundleIfNeeded(path, rootPath);
        //else if (Directory.Exists(path))
        //    ExportDirectoryIfNeeded(path);
    }
Example #4
0
    public void OnGUI()
    {
        if (GUILayout.Button("Find Missing Scripts in selected GameObjects"))
        {
            OnDoTask = (com, i, g) =>
            {
                if (com == null)
                {
                    var fullName = GetFullName(g);
                    counter.missingCount++;
                    //Debug.Log(fullName + " has an empty script attached in position: " + i, g);
                    Debug.Log(fullName + " has an empty script attached in position: " + i, g);
                }
            };
            OnTaskFinished = () => { Debug.Log(string.Format("Searched {0} GameObjects, {1} components, found {2} missing", counter.goCount, counter.componentsCount, counter.missingCount)); };
            FindInSelected();
        }
        if (GUILayout.Button("Find Scripts in selected GameObjects"))
        {
            sb       = new System.Text.StringBuilder();
            OnDoTask = (com, i, g) =>
            {
                var typeName = com.GetType().Name;
                if (com is MonoBehaviour && !ExportScenesManager.IngoreFiles.Contains(typeName))
                {
                    var fullName = GetFullName(g);
                    counter.missingCount++;
                    sb.AppendLine(String.Concat(fullName, ": ", typeName));
                }
            };
            OnTaskFinished = () =>
            {
                var path = ExportScenesManager.GetFolderPath("") + "//ScriptUsingInfo.txt";
                Mogo.Util.XMLParser.SaveText(path.Replace("\\", "/"), sb.ToString());
                Debug.Log("Find finished, total script using is " + counter.missingCount + ", please check 'ScriptUsingInfo.txt' in project folder.");
            };
            FindInSelected();
        }
        if (GUILayout.Button("Find Null UISprite Scripts"))
        {
            sb       = new System.Text.StringBuilder();
            OnDoTask = (com, i, g) =>
            {
                var typeName = com.GetType().Name;
                var spri     = com as UISprite;
                if (spri != null)
                {
                    var fullName = GetFullName(g);
                    if (spri.atlas == null)
                    {
                        sb.AppendLine(String.Concat("atlas null: ", fullName, ": ", typeName));
                    }
                    else
                    {
                        if (spri.atlas.GetSprite(spri.spriteName) == null)
                        {
                            counter.missingCount++;
                            sb.AppendLine(String.Concat(fullName, ": ", typeName));
                        }
                    }
                }
            };
            OnTaskFinished = () =>
            {
                var path = ExportScenesManager.GetFolderPath("") + "//NullUISprite.txt";
                Mogo.Util.XMLParser.SaveText(path.Replace("\\", "/"), sb.ToString());
                Debug.Log("Find finished, total Null UISprite is " + counter.missingCount + ", please check 'NullUISprite.txt' in project folder.");
            };
            FindInSelected();
        }

        GUILayout.Label(info);
    }