public void SetEntity(BIWEntity entity, ParcelScene currentScene)
    {
        currentEntity = entity;
        EntityDeselected();
        entityInformationView.SetCurrentEntity(entity);

        if (entityInformationView.currentEntity != null)
        {
            entity.OnStatusUpdate -= UpdateEntityName;
            entityInformationView.currentEntity.OnStatusUpdate += UpdateEntityName;
        }

        parcelScene = currentScene;

        if (entity.HasSmartItemComponent())
        {
            entityInformationView.SetSmartItemListViewActive(false);
            //TODO: Remove this comment when we implement smart items in builder in world
            //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);
    }
Esempio n. 2
0
    public void NftComponent()
    {
        CatalogItem catalogItem = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];


        BIWEntity biwEntity = new BIWEntity();

        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);
    }
    BIWEntity SetupEntityToEdit(IDCLEntity entity, bool hasBeenCreated = false)
    {
        if (!convertedEntities.ContainsKey(GetConvertedUniqueKeyForEntity(entity)))
        {
            BIWEntity entityToEdit = new BIWEntity();
            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)]);
        }
    }
Esempio n. 4
0
    public void SetContent(BIWEntity decentrelandEntity)
    {
        if (currentEntity != null)
        {
            currentEntity.OnStatusUpdate      -= SetInfo;
            currentEntity.OnDelete            -= DeleteAdapter;
            currentEntity.OnErrorStatusChange -= SetEntityError;
        }

        currentEntity = decentrelandEntity;
        currentEntity.OnStatusUpdate      += SetInfo;
        currentEntity.OnDelete            += DeleteAdapter;
        currentEntity.OnErrorStatusChange += SetEntityError;

        AllowNameEdition(false);
        SetInfo(decentrelandEntity);

        entityThumbnailImg.enabled = false;
        CatalogItem entitySceneObject = decentrelandEntity.GetCatalogItemAssociated();

        GetThumbnail(entitySceneObject);
    }
Esempio n. 5
0
    private void GetThumbnail(BIWEntity 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);
    }