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); }
public void BuilderInWorldEntityComponents() { string entityId = "1"; TestHelpers.CreateSceneEntity(scene, entityId); BIWEntity biwEntity = new BIWEntity(); 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(); scene.EntityComponentCreateOrUpdateWithModel(entityId, CLASS_ID_COMPONENT.SMART_ITEM, model); 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.SetNewName(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); }