예제 #1
0
    public void _1_10_SetupExporter()
    {
        GraphStackController.CleanCache();

        var projectFolderPath = Directory.GetParent(Application.dataPath).ToString();
        var exportFilePath    = Path.Combine(projectFolderPath, "TestExportPlace/For_1_10_SetupExport");

        // delete all if exist
        if (Directory.Exists(exportFilePath))
        {
            Directory.Delete(exportFilePath, true);
        }

        Directory.CreateDirectory(exportFilePath);

        var importedPath = "Assets/AssetGraphTest/ExporterTestResource/SpanTempPath/SpanPath/a.png";
        var assetId      = AssetDatabase.AssetPathToGUID(importedPath);
        var assetType    = AssetGraphInternalFunctions.GetAssetType(importedPath);

        var exportTargets = new Dictionary <string, List <InternalAssetData> > {
            { "0",
              new List <InternalAssetData> {
                  InternalAssetData.InternalAssetDataGeneratedByImporterOrPrefabricator(importedPath, assetId, assetType, true),
              } }
        };

        var integratedGUIExporter = new IntegratedGUIExporter(exportFilePath);
        Action <string, string, Dictionary <string, List <InternalAssetData> >, List <string> > Out = (string nodeId, string connectionId, Dictionary <string, List <InternalAssetData> > output, List <string> cached) => {
        };

        integratedGUIExporter.Setup("ID_1_10_SetupExport", "CONNECTION_1_10_SetupExport", string.Empty, exportTargets, new List <string>(), Out);
        Debug.Log("passed _1_10_SetupExporter");
    }
예제 #2
0
    public void _1_7_RunBundlizer()
    {
        GraphStackController.CleanCache();
        EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.iOS);

        var importedPath = "Assets/AssetGraphTest/PrefabricatorTestResource/SpanPath/a.png";

        var source = new Dictionary <string, List <InternalAssetData> > {
            { "0",
              new List <InternalAssetData> {
                  InternalAssetData.InternalAssetDataByImporter(
                      "traceId_1_7_RunBundlizer",
                      Path.Combine(Application.dataPath, importedPath),
                      Application.dataPath,
                      Path.GetFileName(importedPath),
                      string.Empty,
                      importedPath,
                      AssetDatabase.AssetPathToGUID(importedPath),
                      AssetGraphInternalFunctions.GetAssetType(importedPath)
                      )
              } }
        };

        var results = new Dictionary <string, List <InternalAssetData> >();

        var bundleNameTemplate = "a_*.bundle";

        var integratedGUIBundlizer = new IntegratedGUIBundlizer(bundleNameTemplate);
        Action <string, string, Dictionary <string, List <InternalAssetData> >, List <string> > Out = (string nodeId, string connectionId, Dictionary <string, List <InternalAssetData> > output, List <string> cached) => {
            results[connectionId] = output["0"];
        };

        integratedGUIBundlizer.Run("ID_1_7_RunBundlizer", "CONNECTION_1_7_RunBundlizer", string.Empty, source, new List <string>(), Out);

        var currentOutputs = results["CONNECTION_1_7_RunBundlizer"];

        if (currentOutputs.Count == 1)
        {
            // should be a_0.bundle
            if (currentOutputs[0].pathUnderConnectionId != "iOS/a_0.bundle.ios")
            {
                Debug.LogError("failed to bundlize, name not match:" + currentOutputs[0].pathUnderConnectionId);
                return;
            }

            // passed, erase bundle name setting.
            var bundledAssetSourcePath = "Assets/AssetGraphTest/PrefabricatorTestResource/SpanPath/a.png";
            if (!File.Exists(bundledAssetSourcePath))
            {
                Debug.LogError("failed to delete bundle setting. bundledAssetSourcePath:" + bundledAssetSourcePath);
                return;
            }

            var assetImporter = AssetImporter.GetAtPath(bundledAssetSourcePath);
            assetImporter.assetBundleName = string.Empty;
            return;
        }

        Debug.LogError("failed to bundlize");
    }
예제 #3
0
    // there is no GUI Prefabricator.

    public void _1_6_SetupBundlizer()
    {
        GraphStackController.CleanCache();

        var importedPath = "Assets/AssetGraphTest/PrefabricatorTestResource/SpanPath/a.png";

        var source = new Dictionary <string, List <InternalAssetData> > {
            { "0",
              new List <InternalAssetData> {
                  InternalAssetData.InternalAssetDataByImporter(
                      "traceId_1_6_SetupBundlizer",
                      Path.Combine(Application.dataPath, importedPath),
                      Application.dataPath,
                      Path.GetFileName(importedPath),
                      string.Empty,
                      importedPath,
                      AssetDatabase.AssetPathToGUID(importedPath),
                      AssetGraphInternalFunctions.GetAssetType(importedPath)
                      )
              } }
        };

        var results = new Dictionary <string, List <InternalAssetData> >();

        var bundleNameTemplate = "a_*.bundle";

        var integratedGUIBundlizer = new IntegratedGUIBundlizer(bundleNameTemplate);
        Action <string, string, Dictionary <string, List <InternalAssetData> >, List <string> > Out = (string nodeId, string connectionId, Dictionary <string, List <InternalAssetData> > output, List <string> cached) => {
            results[connectionId] = output["0"];
        };

        integratedGUIBundlizer.Setup("ID_1_6_SetupBundlizer", "CONNECTION_1_6_SetupBundlizer", string.Empty, source, new List <string>(), Out);
        Debug.Log("passed _1_6_SetupBundlizer");
    }
예제 #4
0
    public void _0_5_RunPrefabricator()
    {
        GraphStackController.CleanCache();

        var importedPath = "Assets/AssetGraphTest/PrefabricatorTestResource/SpanPath/a.png";

        var source = new Dictionary <string, List <InternalAssetData> > {
            { "0",
              new List <InternalAssetData> {
                  InternalAssetData.InternalAssetDataByImporter(
                      "traceId_0_5_RunPrefabricator",
                      Path.Combine(Application.dataPath, importedPath),
                      Application.dataPath,
                      Path.GetFileName(importedPath),
                      string.Empty,
                      importedPath,
                      AssetDatabase.AssetPathToGUID(importedPath),
                      AssetGraphInternalFunctions.GetAssetType(importedPath)
                      )
              } }
        };

        var results = new Dictionary <string, List <InternalAssetData> >();

        var sPrefabricator = new SamplePrefabricator_0();
        Action <string, string, Dictionary <string, List <InternalAssetData> >, List <string> > Out = (string nodeId, string connectionId, Dictionary <string, List <InternalAssetData> > output, List <string> cached) => {
            results[connectionId] = output["0"];
        };

        sPrefabricator.Run("ID_0_5_RunPrefabricator", "CONNECTION_0_5_RunPrefabricator", string.Empty, source, new List <string>(), Out);

        var currentOutputs = results["CONNECTION_0_5_RunPrefabricator"].Where(assetData => !GraphStackController.IsMetaFile(assetData.importedPath)).ToList();

        if (currentOutputs.Count == 3)
        {
            // material.mat
            // prefab.prefab
            // a.png

            if (!currentOutputs[0].fileNameAndExtension.Contains("material.mat"))
            {
                Debug.LogError("not contained 'material.mat'");
            }
            if (!currentOutputs[1].fileNameAndExtension.Contains("prefab.prefab"))
            {
                Debug.LogError("not contained 'prefab.prefab'");
            }
            if (!currentOutputs[2].fileNameAndExtension.Contains("a.png"))
            {
                Debug.LogError("not contained 'a.png'");
            }

            Debug.Log("passed _0_5_RunPrefabricator");
            return;
        }

        Debug.LogError("failed to prefabricate:" + currentOutputs.Count);
    }
예제 #5
0
    public void _0_7_RunBundlizer()
    {
        GraphStackController.CleanCache();

        var importedPath = "Assets/AssetGraphTest/PrefabricatorTestResource/SpanPath/a.png";

        var source = new Dictionary <string, List <InternalAssetData> > {
            { "0",
              new List <InternalAssetData> {
                  InternalAssetData.InternalAssetDataByImporter(
                      "traceId_0_7_RunBundlizer",
                      Path.Combine(Application.dataPath, importedPath),
                      Application.dataPath,
                      Path.GetFileName(importedPath),
                      string.Empty,
                      importedPath,
                      AssetDatabase.AssetPathToGUID(importedPath),
                      AssetGraphInternalFunctions.GetAssetType(importedPath)
                      )
              } }
        };

        var results = new Dictionary <string, List <InternalAssetData> >();

        var sBundlizer = new SampleBundlizer_0();
        Action <string, string, Dictionary <string, List <InternalAssetData> >, List <string> > Out = (string nodeId, string connectionId, Dictionary <string, List <InternalAssetData> > output, List <string> cached) => {
            results[connectionId] = output["0"];
        };

        sBundlizer.Run("ID_0_7_RunBundlizer", "CONNECTION_0_7_RunBundlizer", string.Empty, source, new List <string>(), Out);

        var currentOutputs = results["CONNECTION_0_7_RunBundlizer"];

        if (currentOutputs.Count == 1)
        {
            // should be bundle.assetbundle
            if (currentOutputs[0].pathUnderConnectionId != "bundle.assetbundle")
            {
                Debug.LogError("failed to bundlize, name not match:" + currentOutputs[0].pathUnderConnectionId);
                return;
            }

            Debug.Log("passed _0_7_RunBundlizer");
            return;
        }

        Debug.LogError("failed to bundlize");
    }