protected override void AttachShape(DecentralandEntity entity) { if (string.IsNullOrEmpty(model.src)) { #if UNITY_EDITOR Debug.LogError($"NFT SHAPE with url '{model.src}' couldn't be loaded."); #endif return; } entity.meshesInfo.meshRootGameObject = NFTShapeFactory.InstantiateLoaderController(model.style); entity.meshesInfo.currentShape = this; entity.meshRootGameObject.name = componentName + " mesh"; entity.meshRootGameObject.transform.SetParent(entity.gameObject.transform); entity.meshRootGameObject.transform.ResetLocalTRS(); entity.OnShapeUpdated += UpdateBackgroundColor; LoadWrapper_NFT loadableShape = GetOrAddLoaderForEntity <LoadWrapper_NFT>(entity); loadableShape.entity = entity; loadableShape.initialVisibility = model.visible; loadableShape.withCollisions = model.withCollisions; loadableShape.backgroundColor = model.color; loadableShape.Load(model.src, OnLoadCompleted, OnLoadFailed); }
protected void SetUp() { isHQAsset = false; camera = new GameObject("Camera") { tag = "MainCamera" }.AddComponent <Camera>(); asset = Substitute.For <INFTAsset>(); asset.When(a => a.RestorePreviewAsset()) .Do(i => { isHQAsset = false; asset.isHQ.Returns(false); }); asset.WhenForAnyArgs(a => a.FetchAndSetHQAsset(null, null, null)) .Do(i => { isHQAsset = true; asset.isHQ.Returns(true); }); nftGO = new GameObject(); var nftController = NFTShapeFactory.InstantiateLoaderController(0).GetComponent <NFTShapeLoaderController>(); nftController.transform.SetParent(nftGO.transform); nftController.transform.ResetLocalTRS(); nftGO.transform.position = new Vector3(10, 0, 10); nftShapeConfig = nftController.config; var config = new NFTShapeHQImageConfig() { asset = asset, controller = nftController, nftConfig = nftShapeConfig }; imageHandler = NFTShapeHQImageHandler.Create(config); }