public void DuplicateSelectedEntities() { BuildInWorldCompleteAction buildAction = new BuildInWorldCompleteAction(); buildAction.actionType = BuildInWorldCompleteAction.ActionType.CREATE; List <BuilderInWorldEntityAction> entityActionList = new List <BuilderInWorldEntityAction>(); int amount = selectedEntities.Count; for (int i = 0; i < amount; i++) { if (selectedEntities[i].isNFT) { continue; } DecentralandEntity entityDuplicated = DuplicateEntity(selectedEntities[i]); BuilderInWorldEntityAction builderInWorldEntityAction = new BuilderInWorldEntityAction(entityDuplicated, entityDuplicated.entityId, BuilderInWorldUtils.ConvertEntityToJSON(entityDuplicated)); entityActionList.Add(builderInWorldEntityAction); } currentActiveMode?.SetDuplicationOffset(duplicateOffset); Cursor.SetCursor(duplicateCursorTexture, Vector2.zero, CursorMode.Auto); buildAction.CreateActionType(entityActionList, BuildInWorldCompleteAction.ActionType.CREATE); actionController.AddAction(buildAction); }
public void DuplicateSelectedEntities() { BuildInWorldCompleteAction buildAction = new BuildInWorldCompleteAction(); buildAction.actionType = BuildInWorldCompleteAction.ActionType.CREATE; List <BuilderInWorldEntityAction> entityActionList = new List <BuilderInWorldEntityAction>(); List <DCLBuilderInWorldEntity> entitiesToDuplicate = new List <DCLBuilderInWorldEntity>(selectedEntities); DeselectEntities(); foreach (DCLBuilderInWorldEntity entityToDuplicate in entitiesToDuplicate) { if (entityToDuplicate.isNFT) { continue; } var entityDuplicated = DuplicateEntity(entityToDuplicate); BuilderInWorldEntityAction builderInWorldEntityAction = new BuilderInWorldEntityAction(entityDuplicated.rootEntity, entityDuplicated.rootEntity.entityId, BuilderInWorldUtils.ConvertEntityToJSON(entityDuplicated.rootEntity)); entityActionList.Add(builderInWorldEntityAction); SelectEntity(entityDuplicated); } currentActiveMode?.SetDuplicationOffset(duplicateOffset); buildAction.CreateActionType(entityActionList, BuildInWorldCompleteAction.ActionType.CREATE); actionController.AddAction(buildAction); }
public void DuplicateSelectedEntities() { foreach (DCLBuilderInWorldEntity entity in selectedEntities) { if (!DCL.Environment.i.world.sceneBoundsChecker.IsEntityInsideSceneBoundaries(entity.rootEntity)) { return; } } BuildInWorldCompleteAction buildAction = new BuildInWorldCompleteAction(); buildAction.actionType = BuildInWorldCompleteAction.ActionType.CREATE; List <BuilderInWorldEntityAction> entityActionList = new List <BuilderInWorldEntityAction>(); int amount = selectedEntities.Count; for (int i = 0; i < amount; i++) { if (selectedEntities[i].isNFT) { continue; } DecentralandEntity entityDuplicated = DuplicateEntity(selectedEntities[i]); BuilderInWorldEntityAction builderInWorldEntityAction = new BuilderInWorldEntityAction(entityDuplicated, entityDuplicated.entityId, BuilderInWorldUtils.ConvertEntityToJSON(entityDuplicated)); entityActionList.Add(builderInWorldEntityAction); } currentActiveMode.SetDuplicationOffset(duplicateOffset); Cursor.SetCursor(duplicateCursorTexture, Vector2.zero, CursorMode.Auto); buildAction.CreateActionType(entityActionList, BuildInWorldCompleteAction.ActionType.CREATE); actionController.AddAction(buildAction); }