public DCLBuilderInWorldEntity CreateCatalogItem(CatalogItem catalogItem, bool autoSelect = true, bool isFloor = false) { if (catalogItem.IsNFT() && BuilderInWorldNFTController.i.IsNFTInUse(catalogItem.id)) { return(null); } IsInsideTheLimits(catalogItem); //Note (Adrian): This is a workaround until the mapping is handle by kernel AddSceneMappings(catalogItem); Vector3 startPosition = biwModeController.GetModeCreationEntryPoint(); Vector3 editionPosition = biwModeController.GetCurrentEditionPosition(); DCLBuilderInWorldEntity entity = builderInWorldEntityHandler.CreateEmptyEntity(sceneToEdit, startPosition, editionPosition, false); entity.isFloor = isFloor; entity.SetRotation(Vector3.zero); if (!isFloor) { CreateLoadingObject(entity); } AddShape(catalogItem, entity); AddEntityNameComponent(catalogItem, entity); AddLockedComponent(entity); if (catalogItem.IsSmartItem()) { AddSmartItemComponent(entity); } if (catalogItem.IsVoxel()) { entity.isVoxel = true; } if (autoSelect) { builderInWorldEntityHandler.DeselectEntities(); builderInWorldEntityHandler.Select(entity.rootEntity); } entity.gameObject.transform.eulerAngles = Vector3.zero; biwModeController.CreatedEntity(entity); lastCatalogItemCreated = catalogItem; entity.OnShapeFinishLoading += OnShapeLoadFinish; builderInWorldEntityHandler.EntityListChanged(); builderInWorldEntityHandler.NotifyEntityIsCreated(entity.rootEntity); OnInputDone?.Invoke(); OnSceneObjectPlaced?.Invoke(); return(entity); }
public void SetContent(CatalogItem catalogItem) { this.catalogItem = catalogItem; if (favImg != null) { if (catalogItem.IsFavorite()) { favImg.color = onFavoriteColor; } else { favImg.color = offFavoriteColor; } } smartItemGO.SetActive(catalogItem.IsSmartItem()); GetThumbnail(); lockedGO.gameObject.SetActive(false); if (catalogItem.IsNFT() && BuilderInWorldNFTController.i.IsNFTInUse(catalogItem.id)) { lockedGO.gameObject.SetActive(true); } }
public BIWEntity CreateCatalogItem(CatalogItem catalogItem, Vector3 startPosition, bool autoSelect = true, bool isFloor = false, Action <IDCLEntity> onFloorLoadedAction = null) { if (catalogItem.IsNFT() && BIWNFTController.i.IsNFTInUse(catalogItem.id)) { return(null); } IsInsideTheLimits(catalogItem); //Note (Adrian): This is a workaround until the mapping is handle by kernel AddSceneMappings(catalogItem); Vector3 editionPosition = modeController.GetCurrentEditionPosition(); BIWEntity entity = entityHandler.CreateEmptyEntity(sceneToEdit, startPosition, editionPosition, false); entity.isFloor = isFloor; entity.SetRotation(Vector3.zero); if (!isFloor) { CreateLoadingObject(entity); } entity.rootEntity.OnShapeUpdated += (entity) => onFloorLoadedAction?.Invoke(entity); AddShape(catalogItem, entity); AddEntityNameComponent(catalogItem, entity); AddLockedComponent(entity); if (catalogItem.IsSmartItem()) { AddSmartItemComponent(entity); } if (catalogItem.IsVoxel()) { entity.isVoxel = true; } if (autoSelect) { entityHandler.DeselectEntities(); entityHandler.Select(entity.rootEntity); } entity.rootEntity.gameObject.transform.eulerAngles = Vector3.zero; modeController.CreatedEntity(entity); lastCatalogItemCreated = catalogItem; entityHandler.EntityListChanged(); entityHandler.NotifyEntityIsCreated(entity.rootEntity); OnInputDone?.Invoke(); OnCatalogItemPlaced?.Invoke(); return(entity); }
public void SetContent(CatalogItem catalogItem) { this.catalogItem = catalogItem; if (favImg != null) { favImg.color = catalogItem.IsFavorite() ? onFavoriteColor : offFavoriteColor; } if (backgroundImg != null) { backgroundImg.color = catalogItem.IsSmartItem() ? smartItemColor : normalColor; } smartItemGO.SetActive(catalogItem.IsSmartItem()); GetThumbnail(); lockedGO.gameObject.SetActive(false); if (catalogItem.IsNFT() && BIWNFTController.i.IsNFTInUse(catalogItem.id)) { lockedGO.gameObject.SetActive(true); } }
public static void AddSceneObject(SceneObject sceneObject) { if (DataStore.i.builderInWorld.catalogItemDict.ContainsKey(sceneObject.id)) { return; } CatalogItem catalogItem = CreateCatalogItem(sceneObject); //TODO: SmartItems disabled until kernel has them implemented if (!catalogItem.IsSmartItem()) { DataStore.i.builderInWorld.catalogItemDict.Add(catalogItem.id, catalogItem); } }