Esempio n. 1
0
 protected IEnumerator TearDown()
 {
     AssetCatalogBridge.ClearCatalog();
     BIWCatalogManager.ClearCatalog();
     BIWCatalogManager.Dispose();
     if (gameObjectToUse != null)
     {
         GameObject.Destroy(gameObjectToUse);
     }
     yield return(null);
 }
    public static void CreateTestCatalogLocalSingleObject()
    {
        AssetCatalogBridge.ClearCatalog();
        string jsonPath = Utils.GetTestAssetsPathRaw() + "/BuilderInWorldCatalog/sceneObjectCatalog.json";

        if (File.Exists(jsonPath))
        {
            string jsonValue = File.ReadAllText(jsonPath);
            AssetCatalogBridge.i.AddFullSceneObjectCatalog(jsonValue);
        }
    }
Esempio n. 3
0
    public void CustomContentProvider()
    {
        string entityId = "1";

        TestHelpers.CreateSceneEntity(scene, entityId);

        string mockupAssetId = "cdd5a4ea94388dd21babdecd26dd560f739dce2fbb8c99cc10a45bb8306b6076";
        string mockupKey     = "key";
        string mockupValue   = "Value";

        SceneAssetPack sceneAssetPack = new SceneAssetPack();

        sceneAssetPack.assets = new System.Collections.Generic.List <SceneObject>();
        sceneAssetPack.id     = "mockupId";

        SceneObject sceneObject = new SceneObject();

        sceneObject.id       = mockupAssetId;
        sceneObject.contents = new System.Collections.Generic.Dictionary <string, string>();
        sceneObject.contents.Add(mockupKey, mockupValue);

        sceneAssetPack.assets.Add(sceneObject);

        AssetCatalogBridge.AddSceneAssetPackToCatalog(sceneAssetPack);

        TestHelpers.CreateAndSetShape(scene, entityId, DCL.Models.CLASS_ID.GLTF_SHAPE, JsonConvert.SerializeObject(
                                          new
        {
            assetId = mockupAssetId,
            src     = Utils.GetTestsAssetsPath() + "/GLB/Lantern/Lantern.glb"
        }));


        LoadWrapper gltfShape = GLTFShape.GetLoaderForEntity(scene.entities[entityId]);

        if (!(gltfShape is LoadWrapper_GLTF))
        {
            Assert.Fail();
        }


        LoadWrapper_GLTF gltfWrapper           = (LoadWrapper_GLTF)gltfShape;
        ContentProvider  customContentProvider = AssetCatalogBridge.GetContentProviderForAssetIdInSceneObjectCatalog(mockupAssetId);

        Assert.AreEqual(customContentProvider.baseUrl, gltfWrapper.customContentProvider.baseUrl);
        Assert.AreEqual(mockupKey, gltfWrapper.customContentProvider.contents[0].file);
        Assert.AreEqual(mockupValue, gltfWrapper.customContentProvider.contents[0].hash);
    }
    public static void CreateTestCatalogLocal()
    {
        AssetCatalogBridge.ClearCatalog();

        string jsonPath = Utils.GetTestsAssetsPath() + "/SceneObjects/catalog.json";


        if (File.Exists(jsonPath))
        {
            Debug.Log("File found!");
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(jsonPath, FileMode.Open);

            string jsonValue = formatter.Deserialize(stream) as string;
            AssetCatalogBridge.i.AddFullSceneObjectCatalog(jsonValue);
            stream.Close();
        }
    }
Esempio n. 5
0
    public SceneObject GetSceneObjectAssociated()
    {
        if (associatedSceneObject != null)
        {
            return(associatedSceneObject);
        }

        if (rootEntity.TryGetSharedComponent(CLASS_ID.GLTF_SHAPE, out BaseDisposable gltfShapeComponent))
        {
            string assetId = ((GLTFShape)gltfShapeComponent).model.assetId;
            associatedSceneObject = AssetCatalogBridge.GetSceneObjectById(assetId);
            return(associatedSceneObject);
        }

        if (rootEntity.TryGetSharedComponent(CLASS_ID.NFT_SHAPE, out BaseDisposable nftShapeComponent))
        {
            string assetId = ((NFTShape)nftShapeComponent).model.assetId;
            associatedSceneObject = BuilderInWorldNFTController.i.GetNFTSceneObjectFromId(assetId);
            return(associatedSceneObject);
        }

        return(null);
    }
Esempio n. 6
0
 protected override IEnumerator TearDown()
 {
     AssetCatalogBridge.ClearCatalog();
     yield return(base.TearDown());
 }