public void SetEntity(DCLBuilderInWorldEntity entity, ParcelScene currentScene) { EntityDeselected(); entityInformationView.SetCurrentEntity(entity); if (entityInformationView.currentEntity != null) { entity.onStatusUpdate -= UpdateEntityName; entityInformationView.currentEntity.onStatusUpdate += UpdateEntityName; } parcelScene = currentScene; if (entity.HasSmartItemComponent()) { if (entity.rootEntity.TryGetBaseComponent(CLASS_ID_COMPONENT.SMART_ITEM, out IEntityComponent baseComponent)) { entityInformationView.smartItemList.SetSmartItemParameters(entity.GetSmartItemParameters(), ((SmartItemComponent)baseComponent).GetValues()); } } else { entityInformationView.SetSmartItemListViewActive(false); } entityInformationView.SetEntityThumbnailEnable(false); CatalogItem entitySceneObject = entity.GetCatalogItemAssociated(); GetThumbnail(entitySceneObject); UpdateLimitsInformation(entitySceneObject); UpdateEntityName(entityInformationView.currentEntity); UpdateInfo(entityInformationView.currentEntity); }
DCLBuilderInWorldEntity SetupEntityToEdit(IDCLEntity entity, bool hasBeenCreated = false) { if (!convertedEntities.ContainsKey(GetConvertedUniqueKeyForEntity(entity))) { DCLBuilderInWorldEntity entityToEdit = Utils.GetOrCreateComponent <DCLBuilderInWorldEntity>(entity.gameObject); entityToEdit.Init(entity, editMaterial); convertedEntities.Add(entityToEdit.entityUniqueId, entityToEdit); entity.OnRemoved += RemoveConvertedEntity; entityToEdit.IsNew = hasBeenCreated; string entityName = entityToEdit.GetDescriptiveName(); var catalogItem = entityToEdit.GetCatalogItemAssociated(); if ((string.IsNullOrEmpty(entityName) || entityNameList.Contains(entityName)) && catalogItem != null) { entityName = GetNewNameForEntity(catalogItem); SetEntityName(entityToEdit, entityName); } else if (!string.IsNullOrEmpty(entityName) && !entityNameList.Contains(entityName)) { entityNameList.Add(entityName); } return(entityToEdit); } else { return(convertedEntities[GetConvertedUniqueKeyForEntity(entity)]); } }
public void NftComponent() { CatalogItem catalogItem = DataStore.i.builderInWorld.catalogItemDict.GetValues()[0]; DCLBuilderInWorldEntity biwEntity = Utils.GetOrCreateComponent <DCLBuilderInWorldEntity>(scene.entities[ENTITY_ID].gameObject); biwEntity.Init(scene.entities[ENTITY_ID], null); NFTShape nftShape = (NFTShape)scene.SharedComponentCreate(catalogItem.id, Convert.ToInt32(CLASS_ID.NFT_SHAPE)); nftShape.model = new NFTShape.Model(); nftShape.model.color = new Color(0.6404918f, 0.611472f, 0.8584906f); nftShape.model.src = catalogItem.model; nftShape.model.assetId = catalogItem.id; scene.SharedComponentAttach(biwEntity.rootEntity.entityId, nftShape.id); Assert.IsTrue(biwEntity.IsEntityNFT()); CatalogItem associatedCatalogItem = biwEntity.GetCatalogItemAssociated(); Assert.IsTrue(associatedCatalogItem.IsNFT()); Assert.AreEqual(associatedCatalogItem, catalogItem); }
public void SetContent(DCLBuilderInWorldEntity decentrelandEntity) { if (currentEntity != null) { currentEntity.OnStatusUpdate -= SetInfo; currentEntity.OnDelete -= DeleteAdapter; DCL.Environment.i.world.sceneBoundsChecker.OnEntityBoundsCheckerStatusChanged -= ChangeEntityBoundsCheckerStatus; } currentEntity = decentrelandEntity; currentEntity.OnStatusUpdate += SetInfo; currentEntity.OnDelete += DeleteAdapter; DCL.Environment.i.world.sceneBoundsChecker.OnEntityBoundsCheckerStatusChanged += ChangeEntityBoundsCheckerStatus; AllowNameEdition(false); SetInfo(decentrelandEntity); entityThumbnailImg.enabled = false; CatalogItem entitySceneObject = decentrelandEntity.GetCatalogItemAssociated(); GetThumbnail(entitySceneObject); }
private void GetThumbnail(DCLBuilderInWorldEntity entity) { var url = entity.GetCatalogItemAssociated()?.thumbnailURL; if (string.IsNullOrEmpty(url)) { return; } string newLoadedThumbnailURL = url; var newLoadedThumbnailPromise = new AssetPromise_Texture(url); string promiseId = newLoadedThumbnailPromise.GetId().ToString(); if (!entityPromiseKeeperDict.ContainsKey(promiseId)) { entityPromiseKeeperDict.Add(promiseId, entity); } newLoadedThumbnailPromise.OnSuccessEvent += SetThumbnail; newLoadedThumbnailPromise.OnFailEvent += x => { Debug.Log($"Error downloading: {url}"); }; AssetPromiseKeeper_Texture.i.Keep(newLoadedThumbnailPromise); }
public void SetEntity(DCLBuilderInWorldEntity entity, ParcelScene currentScene) { EntityDeselected(); if (currentEntity != null) { entity.onStatusUpdate -= UpdateEntityName; } currentEntity = entity; currentEntity.onStatusUpdate += UpdateEntityName; parcelScene = currentScene; if (entity.HasSmartItemComponent()) { if (entity.rootEntity.TryGetBaseComponent(CLASS_ID_COMPONENT.SMART_ITEM, out BaseComponent baseComponent)) { smartItemListView.SetSmartItemParameters(entity.GetSmartItemParameters(), ((SmartItemComponent)baseComponent).model.values); } } else { smartItemListView.gameObject.SetActive(false); } entitytTumbailImg.enabled = false; CatalogItem entitySceneObject = entity.GetCatalogItemAssociated(); GetThumbnail(entitySceneObject); UpdateLimitsInformation(entitySceneObject); UpdateEntityName(currentEntity); UpdateInfo(currentEntity); }