コード例 #1
0
 private static void Build(string platform)
 {
     using (BuildToolKernel builder = new BuildToolKernel(platform))
     {
         builder.BuildAll();
     }
 }
コード例 #2
0
    private static void Build()
    {
#if ENABLE_BUILD_LOG
        Debug.Log("Building...");
#endif

        EditorPrefs.DeleteKey(DelayedBuildKey);

#if !ENABLE_BUILD_LOG
        NoesisSettings.ClearLog();
#endif

        BuildToolKernel.BuildBegin();

        foreach (string platform in NoesisSettings.ActivePlatforms)
        {
            Build(platform);
        }

        UpdateNoesisGUIPaths();

#if ENABLE_BUILD_LOG
        Debug.Log("Building [done]");
#endif
    }
コード例 #3
0
    private static void OnAssetDeleted(string asset)
    {
        if (asset.StartsWith("Assets/StreamingAssets"))
        {
            return;
        }

#if ENABLE_BUILD_LOG
        Debug.Log(" - " + asset);
#endif
        BuildToolKernel.RemoveAsset(asset);
    }
コード例 #4
0
    private static int GetNumAssets()
    {
        int numAssets = BuildToolKernel.ReadAssets().Count;

        if (numAssets == 0)
        {
            // approximate with number of xamls files
            numAssets = Directory.GetFiles(
                UnityEngine.Application.dataPath, "*.xaml", SearchOption.AllDirectories).Length;
        }

        return(numAssets);
    }
コード例 #5
0
    private static void OnAssetMoved(string from, string to, ref bool doBuild)
    {
#if ENABLE_BUILD_LOG
        Debug.Log(from + " -> " + to);
#endif
        string extension = System.IO.Path.GetExtension(from).ToLower();
        if (IsFont(extension))
        {
            BuildToolKernel.RenameAsset(from, to);
        }

        OnAssetDeleted(from);
        OnAssetAdded(to, ref doBuild);
    }
コード例 #6
0
    public static void RebuildActivePlatforms(string progressTitle)
    {
        try
        {
            string[] activePlatforms  = ActivePlatforms;
            string   platform         = "";
            float    platformProgress = 0.0f;
            float    platformDelta    = 1.0f / (GetNumAssets() * (activePlatforms.Length + 1));
            float    progress         = 0.0f;
            float    deltaProgress    = 1.0f / (activePlatforms.Length + 1);

            EditorUtility.DisplayProgressBar(progressTitle, "Cleaning...", 0.0f);
            BuildToolKernel.BuildBegin();
            BuildToolKernel.Clean();

            Action <String> action = s =>
            {
                EditorUtility.DisplayProgressBar(progressTitle,
                                                 "[" + platform + "] " + s + "...", progress + platformProgress);
                platformProgress = Math.Min(platformProgress + platformDelta, deltaProgress);
            };
            BuildToolKernel.BuildEvent += action;

            foreach (string activePlatform in activePlatforms)
            {
                platformProgress = 0.0f;
                progress        += deltaProgress;
                platform         = activePlatform;
                Build(platform);
            }

            BuildToolKernel.BuildEvent -= action;
            EditorUtility.DisplayProgressBar(progressTitle, "Done.", 1.0f);
        }
        finally
        {
            EditorUtility.ClearProgressBar();
        }
    }
コード例 #7
0
    private static void OnAssetAdded(string asset, ref bool doBuild)
    {
        if (asset.StartsWith("Assets/StreamingAssets"))
        {
            return;
        }

#if ENABLE_BUILD_LOG
        Debug.Log(" + " + asset);
#endif
        string extension = System.IO.Path.GetExtension(asset).ToLower();

        if (extension == ".xaml")
        {
            BuildToolKernel.AddAsset(asset);
            doBuild = true;
        }
        else if (extension == ".cs")
        {
            TouchCodeBehind(asset, ref doBuild);
        }
        else
        {
            // Normally the build process is only fired if any tracked resource is modified. But when there are errors
            // pending to be fixed, the tracker of resources may be incomplete and we have to build inconditionally
            if (BuildToolKernel.PendingErrors())
            {
                if (IsFont(extension) || IsImage(extension))
                {
                    doBuild = true;
                }
            }
            else if (BuildToolKernel.AssetExists(asset))
            {
                doBuild = true;
            }
        }
    }