Пример #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);
    }
Пример #2
0
    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);
    }
Пример #3
0
    public void BuilderInWorldEntityComponents()
    {
        string entityId = "1";

        TestHelpers.CreateSceneEntity(scene, entityId);

        DCLBuilderInWorldEntity biwEntity = Utils.GetOrCreateComponent <DCLBuilderInWorldEntity>(scene.entities[entityId].gameObject);

        biwEntity.Init(scene.entities[entityId], null);

        Assert.IsTrue(biwEntity.entityUniqueId == scene.sceneData.id + scene.entities[entityId].entityId, "Entity id is not created correctly, this can lead to weird behaviour");

        SmartItemComponent.Model model = new SmartItemComponent.Model();
        string jsonModel = JsonUtility.ToJson(model);

        scene.EntityComponentCreateOrUpdateFromUnity(entityId, CLASS_ID_COMPONENT.SMART_ITEM, jsonModel);

        Assert.IsTrue(biwEntity.HasSmartItemComponent());

        DCLName name = (DCLName)scene.SharedComponentCreate(Guid.NewGuid().ToString(), Convert.ToInt32(CLASS_ID.NAME));

        scene.SharedComponentAttach(biwEntity.rootEntity.entityId, name.id);

        DCLName dclName = biwEntity.rootEntity.TryGetComponent <DCLName>();

        Assert.IsNotNull(dclName);

        string newName = "TestingName";

        dclName.ForceSetNewName(newName);
        Assert.AreEqual(newName, biwEntity.GetDescriptiveName());


        DCLLockedOnEdit entityLocked = (DCLLockedOnEdit)scene.SharedComponentCreate(Guid.NewGuid().ToString(), Convert.ToInt32(CLASS_ID.LOCKED_ON_EDIT));

        scene.SharedComponentAttach(biwEntity.rootEntity.entityId, entityLocked.id);

        DCLLockedOnEdit dclLockedOnEdit = biwEntity.rootEntity.TryGetComponent <DCLLockedOnEdit>();

        Assert.IsNotNull(dclLockedOnEdit);

        bool isLocked = true;

        dclLockedOnEdit.SetIsLocked(isLocked);
        Assert.AreEqual(biwEntity.IsLocked, isLocked);
    }