Beispiel #1
0
    public void SetEntity(DCLBuilderInWorldEntity entity, ParcelScene currentScene)
    {
        if (currentEntity != null)
        {
            entity.onStatusUpdate -= UpdateEntityName;
        }

        currentEntity = entity;
        currentEntity.onStatusUpdate += UpdateEntityName;

        parcelScene = currentScene;

        if (entity.HasSmartItemComponent())
        {
            entity.rootEntity.TryGetBaseComponent(CLASS_ID_COMPONENT.SMART_ITEM, out BaseComponent baseComponent);
            smartItemListView.SetSmartItemParameters((SmartItemComponent)baseComponent);
        }
        else
        {
            smartItemListView.gameObject.SetActive(false);
        }

        entitytTumbailImg.enabled = false;

        SceneObject entitySceneObject = entity.GetSceneObjectAssociated();

        GetThumbnail(entitySceneObject);

        UpdateLimitsInformation(entitySceneObject);
        UpdateEntityName(currentEntity);
        UpdateInfo(currentEntity);
    }
    private void GetThumbnail(DCLBuilderInWorldEntity entity)
    {
        var url = entity.GetSceneObjectAssociated()?.GetComposedThumbnailUrl();

        if (string.IsNullOrEmpty(url))
        {
            return;
        }

        string newLoadedThumbnailURL     = url;
        var    newLoadedThumbnailPromise = new AssetPromise_Texture(url);


        newLoadedThumbnailPromise.OnSuccessEvent += SetThumbnail;
        newLoadedThumbnailPromise.OnFailEvent    += x => { Debug.Log($"Error downloading: {url}"); };

        AssetPromiseKeeper_Texture.i.Keep(newLoadedThumbnailPromise);
    }