| | 1 | | using DCL; |
| | 2 | | using DCL.Components; |
| | 3 | | using DCL.Configuration; |
| | 4 | | using DCL.Controllers; |
| | 5 | | using DCL.Helpers; |
| | 6 | | using DCL.Interface; |
| | 7 | | using DCL.Models; |
| | 8 | | using Newtonsoft.Json; |
| | 9 | | using System; |
| | 10 | | using System.Collections; |
| | 11 | | using System.Collections.Generic; |
| | 12 | | using System.Diagnostics.CodeAnalysis; |
| | 13 | | using UnityEngine; |
| | 14 | | using Environment = DCL.Environment; |
| | 15 | |
|
| | 16 | | public interface IBIWEntityHandler : IBIWController |
| | 17 | | { |
| | 18 | | event Action<BIWEntity> OnEntityDeselected; |
| | 19 | | event Action OnEntitySelected; |
| | 20 | | event Action<List<BIWEntity>> OnDeleteSelectedEntities; |
| | 21 | | event Action<BIWEntity> OnEntityDeleted; |
| | 22 | | BIWEntity GetConvertedEntity(string entityId); |
| | 23 | | BIWEntity GetConvertedEntity(IDCLEntity entity); |
| | 24 | | void DeleteEntity(BIWEntity entityToDelete); |
| | 25 | | void DeleteEntity(string entityId); |
| | 26 | | void DeleteFloorEntities(); |
| | 27 | | void DeleteSelectedEntities(); |
| | 28 | | IDCLEntity CreateEntityFromJSON(string entityJson); |
| | 29 | | BIWEntity CreateEmptyEntity(ParcelScene parcelScene, Vector3 entryPoint, Vector3 editionGOPosition, bool notifyEntit |
| | 30 | | List<BIWEntity> GetAllEntitiesFromCurrentScene(); |
| | 31 | | void DeselectEntities(); |
| | 32 | | List<BIWEntity> GetSelectedEntityList(); |
| | 33 | | bool IsAnyEntitySelected(); |
| | 34 | | void SetActiveMode(BIWMode buildMode); |
| | 35 | | void SetMultiSelectionActive(bool isActive); |
| | 36 | | void ChangeLockStateSelectedEntities(); |
| | 37 | | void DeleteEntitiesOutsideSceneBoundaries(); |
| | 38 | | bool AreAllEntitiesInsideBoundaries(); |
| | 39 | | void EntityListChanged(); |
| | 40 | | void NotifyEntityIsCreated(IDCLEntity entity); |
| | 41 | | void SetEntityName(BIWEntity entityToApply, string newName, bool sendUpdateToKernel = true); |
| | 42 | | void EntityClicked(BIWEntity entityToSelect); |
| | 43 | | void ReportTransform(bool forceReport = false); |
| | 44 | | void CancelSelection(); |
| | 45 | | bool IsPointerInSelectedEntity(); |
| | 46 | | void DestroyLastCreatedEntities(); |
| | 47 | | void Select(IDCLEntity entity); |
| | 48 | | bool SelectEntity(BIWEntity entityEditable, bool selectedFromCatalog = false); |
| | 49 | | void DeselectEntity(BIWEntity entity); |
| | 50 | | int GetCurrentSceneEntityCount(); |
| | 51 | | } |
| | 52 | |
|
| | 53 | | public class BIWEntityHandler : BIWController, IBIWEntityHandler |
| | 54 | | { |
| | 55 | | private const float DUPLICATE_OFFSET = 2f; |
| | 56 | |
|
| | 57 | | private IBIWOutlinerController outlinerController; |
| | 58 | |
|
| | 59 | | private IBIWModeController modeController; |
| | 60 | | private IBIWActionController actionController; |
| | 61 | | private IBIWCreatorController creatorController; |
| | 62 | | private IBIWRaycastController raycastController; |
| | 63 | |
|
| | 64 | | private BuilderInWorldBridge bridge; |
| | 65 | | private Material editMaterial; |
| | 66 | |
|
| | 67 | | private InputAction_Trigger hideSelectedEntitiesAction; |
| | 68 | |
|
| | 69 | | private InputAction_Trigger showAllEntitiesAction; |
| | 70 | |
|
| 95 | 71 | | private readonly Dictionary<string, BIWEntity> convertedEntities = new Dictionary<string, BIWEntity>(); |
| 95 | 72 | | private readonly List<BIWEntity> selectedEntities = new List<BIWEntity>(); |
| | 73 | |
|
| | 74 | | private BIWMode currentActiveMode; |
| | 75 | | internal bool isMultiSelectionActive = false; |
| | 76 | | internal bool isSecondayClickPressed = false; |
| | 77 | |
|
| | 78 | | private float lastTransformReportTime; |
| | 79 | |
|
| 95 | 80 | | private List<string> entityNameList = new List<string>(); |
| | 81 | |
|
| | 82 | | private InputAction_Trigger.Triggered hideSelectedEntitiesDelegate; |
| | 83 | | private InputAction_Trigger.Triggered showAllEntitiesDelegate; |
| | 84 | |
|
| | 85 | | private BuildModeHUDController hudController; |
| | 86 | |
|
| | 87 | | public event Action<BIWEntity> OnEntityDeselected; |
| | 88 | | public event Action OnEntitySelected; |
| | 89 | | public event Action<List<BIWEntity>> OnDeleteSelectedEntities; |
| | 90 | | public event Action<BIWEntity> OnEntityDeleted; |
| | 91 | |
|
| | 92 | | private BIWEntity lastClickedEntity; |
| | 93 | | private float lastTimeEntityClicked; |
| | 94 | |
|
| | 95 | | public override void Initialize(BIWContext context) |
| | 96 | | { |
| 95 | 97 | | base.Initialize(context); |
| 95 | 98 | | if (HUDController.i.builderInWorldMainHud != null) |
| | 99 | | { |
| 25 | 100 | | hudController = HUDController.i.builderInWorldMainHud; |
| 25 | 101 | | hudController.OnEntityDelete += DeleteSingleEntity; |
| 25 | 102 | | hudController.OnDuplicateSelectedAction += DuplicateSelectedEntitiesInput; |
| 25 | 103 | | hudController.OnDeleteSelectedAction += DeleteSelectedEntitiesInput; |
| 25 | 104 | | hudController.OnEntityClick += ChangeEntitySelectionFromList; |
| 25 | 105 | | hudController.OnEntityLock += ChangeEntityLockStatus; |
| 25 | 106 | | hudController.OnEntityChangeVisibility += ChangeEntityVisibilityStatus; |
| 25 | 107 | | hudController.OnEntityRename += SetEntityName; |
| 25 | 108 | | hudController.OnEntitySmartItemComponentUpdate += UpdateSmartItemComponentInKernel; |
| | 109 | | } |
| | 110 | |
|
| | 111 | |
|
| 95 | 112 | | BIWInputWrapper.OnMouseDown += OnInputMouseDown; |
| 95 | 113 | | BIWInputWrapper.OnMouseUp += OnInputMouseUp; |
| | 114 | |
|
| 95 | 115 | | DCL.Environment.i.world.sceneBoundsChecker.OnEntityBoundsCheckerStatusChanged += ChangeEntityBoundsCheckerStatus |
| | 116 | |
|
| 95 | 117 | | bridge = context.sceneReferences.builderInWorldBridge; |
| | 118 | |
|
| 95 | 119 | | outlinerController = context.outlinerController; |
| | 120 | |
|
| 95 | 121 | | modeController = context.modeController; |
| 95 | 122 | | actionController = context.actionController; |
| 95 | 123 | | creatorController = context.creatorController; |
| 95 | 124 | | raycastController = context.raycastController; |
| | 125 | |
|
| 95 | 126 | | editMaterial = context.projectReferencesAsset.editMaterial; |
| | 127 | |
|
| 95 | 128 | | hideSelectedEntitiesAction = context.inputsReferencesAsset.hideSelectedEntitiesAction; |
| 95 | 129 | | showAllEntitiesAction = context.inputsReferencesAsset.showAllEntitiesAction; |
| | 130 | |
|
| 95 | 131 | | hideSelectedEntitiesDelegate = (action) => ChangeShowStateSelectedEntities(); |
| 95 | 132 | | showAllEntitiesDelegate = (action) => ShowAllEntities(); |
| | 133 | |
|
| 95 | 134 | | hideSelectedEntitiesAction.OnTriggered += hideSelectedEntitiesDelegate; |
| 95 | 135 | | showAllEntitiesAction.OnTriggered += showAllEntitiesDelegate; |
| | 136 | |
|
| 95 | 137 | | actionController.OnRedo += ReSelectEntities; |
| 95 | 138 | | actionController.OnUndo += ReSelectEntities; |
| 95 | 139 | | } |
| | 140 | |
|
| | 141 | | internal void OnInputMouseDown(int buttonId, Vector3 mousePosition) |
| | 142 | | { |
| 0 | 143 | | if (buttonId == 1) |
| 0 | 144 | | isSecondayClickPressed = true; |
| 0 | 145 | | } |
| | 146 | |
|
| | 147 | | internal void OnInputMouseUp(int buttonId, Vector3 mousePosition) |
| | 148 | | { |
| 5 | 149 | | if (buttonId == 1) |
| 5 | 150 | | isSecondayClickPressed = false; |
| 5 | 151 | | } |
| | 152 | |
|
| | 153 | | public override void Dispose() |
| | 154 | | { |
| 81 | 155 | | DestroyCollidersForAllEntities(); |
| | 156 | |
|
| 81 | 157 | | actionController.OnRedo -= ReSelectEntities; |
| 81 | 158 | | actionController.OnUndo -= ReSelectEntities; |
| | 159 | |
|
| 81 | 160 | | hideSelectedEntitiesAction.OnTriggered -= hideSelectedEntitiesDelegate; |
| 81 | 161 | | showAllEntitiesAction.OnTriggered -= showAllEntitiesDelegate; |
| | 162 | |
|
| 81 | 163 | | DCL.Environment.i.world.sceneBoundsChecker.OnEntityBoundsCheckerStatusChanged -= ChangeEntityBoundsCheckerStatus |
| | 164 | |
|
| 81 | 165 | | BIWInputWrapper.OnMouseDown -= OnInputMouseDown; |
| 81 | 166 | | BIWInputWrapper.OnMouseUp -= OnInputMouseUp; |
| | 167 | |
|
| 81 | 168 | | if (hudController != null) |
| | 169 | | { |
| 25 | 170 | | hudController.OnEntityDelete -= DeleteSingleEntity; |
| 25 | 171 | | hudController.OnDuplicateSelectedAction -= DuplicateSelectedEntitiesInput; |
| 25 | 172 | | hudController.OnDeleteSelectedAction -= DeleteSelectedEntitiesInput; |
| 25 | 173 | | hudController.OnEntityClick -= ChangeEntitySelectionFromList; |
| 25 | 174 | | hudController.OnEntityLock -= ChangeEntityLockStatus; |
| 25 | 175 | | hudController.OnEntityChangeVisibility -= ChangeEntityVisibilityStatus; |
| 25 | 176 | | hudController.OnEntityChangeVisibility -= ChangeEntityVisibilityStatus; |
| 25 | 177 | | hudController.OnEntityRename -= SetEntityName; |
| 25 | 178 | | hudController.OnEntitySmartItemComponentUpdate -= UpdateSmartItemComponentInKernel; |
| | 179 | | } |
| 81 | 180 | | } |
| | 181 | |
|
| | 182 | | public override void Update() |
| | 183 | | { |
| 2 | 184 | | base.Update(); |
| | 185 | |
|
| 2 | 186 | | if (selectedEntities.Count == 0) |
| 2 | 187 | | return; |
| 0 | 188 | | if ((DCLTime.realtimeSinceStartup - lastTransformReportTime) <= BIWSettings.ENTITY_POSITION_REPORTING_DELAY) |
| 0 | 189 | | return; |
| | 190 | |
|
| 0 | 191 | | ReportTransform(); |
| 0 | 192 | | } |
| | 193 | |
|
| | 194 | | public void ReportTransform(bool forceReport = false) |
| | 195 | | { |
| 4 | 196 | | foreach (BIWEntity entity in selectedEntities) |
| | 197 | | { |
| 0 | 198 | | if (!entity.HasMovedSinceLastReport() && |
| | 199 | | !entity.HasScaledSinceLastReport() && |
| | 200 | | !entity.HasRotatedSinceLastReport() && |
| | 201 | | !forceReport) |
| 0 | 202 | | return; |
| 0 | 203 | | bridge.EntityTransformReport(entity.rootEntity, sceneToEdit); |
| 0 | 204 | | entity.PositionReported(); |
| 0 | 205 | | entity.ScaleReported(); |
| 0 | 206 | | entity.RotationReported(); |
| | 207 | | } |
| | 208 | |
|
| 2 | 209 | | lastTransformReportTime = DCLTime.realtimeSinceStartup; |
| 2 | 210 | | } |
| | 211 | |
|
| 0 | 212 | | public float GetLastTimeReport() { return lastTransformReportTime; } |
| | 213 | |
|
| 50 | 214 | | public List<BIWEntity> GetSelectedEntityList() { return selectedEntities; } |
| | 215 | |
|
| 2 | 216 | | public bool IsAnyEntitySelected() { return selectedEntities.Count > 0; } |
| | 217 | |
|
| | 218 | | public void SetActiveMode(BIWMode buildMode) |
| | 219 | | { |
| 8 | 220 | | currentActiveMode = buildMode; |
| 8 | 221 | | DeselectEntities(); |
| 8 | 222 | | } |
| | 223 | |
|
| 0 | 224 | | public void SetMultiSelectionActive(bool isActive) { isMultiSelectionActive = isActive; } |
| | 225 | |
|
| | 226 | | public override void EnterEditMode(IParcelScene scene) |
| | 227 | | { |
| 80 | 228 | | base.EnterEditMode(scene); |
| | 229 | |
|
| 80 | 230 | | SetupAllEntities(); |
| 80 | 231 | | EntityListChanged(); |
| 80 | 232 | | CheckErrorOnEntities(); |
| 80 | 233 | | } |
| | 234 | |
|
| | 235 | | private void CheckErrorOnEntities() |
| | 236 | | { |
| 284 | 237 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 238 | | { |
| 62 | 239 | | entity.CheckErrors(); |
| 62 | 240 | | if (entity.hasMissingCatalogItemError) |
| 62 | 241 | | creatorController.CreateErrorOnEntity(entity); |
| | 242 | | } |
| 80 | 243 | | } |
| | 244 | |
|
| | 245 | | public bool IsPointerInSelectedEntity() |
| | 246 | | { |
| 2 | 247 | | BIWEntity entityInPointer = raycastController.GetEntityOnPointer(); |
| 2 | 248 | | if (entityInPointer == null) |
| 1 | 249 | | return false; |
| | 250 | |
|
| 3 | 251 | | foreach (BIWEntity entity in selectedEntities) |
| | 252 | | { |
| 1 | 253 | | if (entityInPointer == entity) |
| 1 | 254 | | return true; |
| | 255 | | } |
| | 256 | |
|
| 0 | 257 | | return false; |
| 1 | 258 | | } |
| | 259 | |
|
| | 260 | | private void DeleteSelectedEntitiesInput() |
| | 261 | | { |
| 0 | 262 | | if (selectedEntities.Count > 0) |
| 0 | 263 | | DeleteSelectedEntities(); |
| 0 | 264 | | } |
| | 265 | |
|
| | 266 | | private void DuplicateSelectedEntitiesInput() |
| | 267 | | { |
| 0 | 268 | | if (selectedEntities.Count <= 0 || isSecondayClickPressed) |
| 0 | 269 | | return; |
| | 270 | |
|
| 0 | 271 | | DuplicateSelectedEntities(); |
| 0 | 272 | | } |
| | 273 | |
|
| | 274 | | public override void ExitEditMode() |
| | 275 | | { |
| 4 | 276 | | base.ExitEditMode(); |
| 4 | 277 | | DeselectEntities(); |
| | 278 | |
|
| 16 | 279 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 280 | | { |
| 4 | 281 | | entity.Dispose(); |
| | 282 | | } |
| | 283 | |
|
| 4 | 284 | | convertedEntities.Clear(); |
| 4 | 285 | | } |
| | 286 | |
|
| | 287 | | internal void ChangeEntitySelectionFromList(BIWEntity entityToEdit) |
| | 288 | | { |
| 1 | 289 | | if (!selectedEntities.Contains(entityToEdit)) |
| 1 | 290 | | SelectFromList(entityToEdit); |
| | 291 | | else |
| 0 | 292 | | DeselectEntity(entityToEdit); |
| 0 | 293 | | } |
| | 294 | |
|
| | 295 | | private void SelectFromList(BIWEntity entityToEdit) |
| | 296 | | { |
| 1 | 297 | | if (!isMultiSelectionActive) |
| 1 | 298 | | DeselectEntities(); |
| 1 | 299 | | if (SelectEntity(entityToEdit)) |
| | 300 | | { |
| 1 | 301 | | if (!isMultiSelectionActive) |
| 1 | 302 | | outlinerController.OutlineEntity(entityToEdit); |
| | 303 | | else |
| 0 | 304 | | outlinerController.OutlineEntities(selectedEntities); |
| | 305 | | } |
| 0 | 306 | | } |
| | 307 | |
|
| | 308 | | public void DeselectEntity(BIWEntity entity) |
| | 309 | | { |
| 12 | 310 | | if (!selectedEntities.Contains(entity)) |
| 0 | 311 | | return; |
| | 312 | |
|
| 12 | 313 | | entity.Deselect(); |
| | 314 | |
|
| 12 | 315 | | outlinerController.CancelEntityOutline(entity); |
| 12 | 316 | | selectedEntities.Remove(entity); |
| 12 | 317 | | hudController?.UpdateEntitiesSelection(selectedEntities.Count); |
| 12 | 318 | | currentActiveMode?.EntityDeselected(entity); |
| 12 | 319 | | if (selectedEntities.Count <= 0 && |
| | 320 | | hudController != null) |
| 0 | 321 | | hudController.HideEntityInformation(); |
| | 322 | |
|
| 12 | 323 | | OnEntityDeselected?.Invoke(entity); |
| 0 | 324 | | } |
| | 325 | |
|
| | 326 | | public void DeselectEntities() |
| | 327 | | { |
| 55 | 328 | | if (selectedEntities.Count <= 0) |
| 46 | 329 | | return; |
| | 330 | |
|
| 9 | 331 | | int amountToDeselect = selectedEntities.Count; |
| 36 | 332 | | for (int i = 0; i < amountToDeselect; i++) |
| | 333 | | { |
| 9 | 334 | | DeselectEntity(selectedEntities[0]); |
| | 335 | | } |
| | 336 | |
|
| 9 | 337 | | currentActiveMode?.OnDeselectedEntities(); |
| | 338 | |
|
| 9 | 339 | | Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); |
| 9 | 340 | | } |
| | 341 | |
|
| | 342 | | public void EntityClicked(BIWEntity entityToSelect) |
| | 343 | | { |
| 3 | 344 | | if (entityToSelect != null) |
| | 345 | | { |
| 3 | 346 | | if (!isMultiSelectionActive) |
| 3 | 347 | | DeselectEntities(); |
| | 348 | |
|
| 3 | 349 | | if (!entityToSelect.isLocked) |
| 3 | 350 | | ChangeEntitySelectStatus(entityToSelect); |
| | 351 | |
|
| 3 | 352 | | if (entityToSelect == lastClickedEntity && (lastTimeEntityClicked + BIWSettings.MOUSE_MS_DOUBLE_CLICK_THRESH |
| 1 | 353 | | modeController.EntityDoubleClick(entityToSelect); |
| | 354 | |
|
| 3 | 355 | | lastClickedEntity = entityToSelect; |
| 3 | 356 | | lastTimeEntityClicked = Time.realtimeSinceStartup; |
| 3 | 357 | | } |
| 0 | 358 | | else if (!isMultiSelectionActive) |
| | 359 | | { |
| 0 | 360 | | DeselectEntities(); |
| | 361 | | } |
| 0 | 362 | | } |
| | 363 | |
|
| | 364 | | internal void ReSelectEntities() |
| | 365 | | { |
| 13 | 366 | | List<BIWEntity> entitiesToReselect = new List<BIWEntity>(); |
| 28 | 367 | | foreach (BIWEntity entity in selectedEntities) |
| | 368 | | { |
| 1 | 369 | | entitiesToReselect.Add(entity); |
| | 370 | | } |
| | 371 | |
|
| 13 | 372 | | DeselectEntities(); |
| | 373 | |
|
| 28 | 374 | | foreach (BIWEntity entity in entitiesToReselect) |
| | 375 | | { |
| 1 | 376 | | SelectEntity(entity); |
| | 377 | | } |
| 13 | 378 | | } |
| | 379 | |
|
| | 380 | | internal void ChangeEntitySelectStatus(BIWEntity entityCliked) |
| | 381 | | { |
| 3 | 382 | | if (entityCliked.isSelected) |
| 0 | 383 | | DeselectEntity(entityCliked); |
| | 384 | | else |
| 3 | 385 | | SelectEntity(entityCliked); |
| 3 | 386 | | } |
| | 387 | |
|
| | 388 | | public void CancelSelection() |
| | 389 | | { |
| 1 | 390 | | if (selectedEntities.Count == 0) |
| 0 | 391 | | return; |
| | 392 | |
|
| 1 | 393 | | DestroyLastCreatedEntities(); |
| 1 | 394 | | DeselectEntities(); |
| 1 | 395 | | } |
| | 396 | |
|
| | 397 | | public void ChangeLockStateSelectedEntities() |
| | 398 | | { |
| 4 | 399 | | foreach (BIWEntity entity in selectedEntities) |
| | 400 | | { |
| 1 | 401 | | entity.ToggleLockStatus(); |
| | 402 | | } |
| | 403 | |
|
| 1 | 404 | | DeselectEntities(); |
| 1 | 405 | | } |
| | 406 | |
|
| | 407 | | public void ShowAllEntities() |
| | 408 | | { |
| 4 | 409 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 410 | | { |
| 1 | 411 | | if (!entity.isVisible) |
| 1 | 412 | | entity.ToggleShowStatus(); |
| | 413 | | } |
| 1 | 414 | | } |
| | 415 | |
|
| | 416 | | public void ChangeShowStateSelectedEntities() |
| | 417 | | { |
| 1 | 418 | | List<BIWEntity> entitiesToHide = new List<BIWEntity>(selectedEntities); |
| | 419 | |
|
| 4 | 420 | | foreach (BIWEntity entity in entitiesToHide) |
| | 421 | | { |
| 1 | 422 | | if (entity.isVisible && entity.isSelected) |
| 1 | 423 | | DeselectEntity(entity); |
| 1 | 424 | | entity.ToggleShowStatus(); |
| | 425 | | } |
| 1 | 426 | | } |
| | 427 | |
|
| | 428 | | public void Select(IDCLEntity entity) |
| | 429 | | { |
| 8 | 430 | | BIWEntity entityEditable = GetConvertedEntity(entity); |
| 8 | 431 | | if (entityEditable == null) |
| 0 | 432 | | return; |
| | 433 | |
|
| 8 | 434 | | SelectEntity(entityEditable, true); |
| 8 | 435 | | } |
| | 436 | |
|
| | 437 | | public bool SelectEntity(BIWEntity entityEditable, bool selectedFromCatalog = false) |
| | 438 | | { |
| 27 | 439 | | if (entityEditable.isLocked) |
| 1 | 440 | | return false; |
| | 441 | |
|
| 26 | 442 | | if (entityEditable.isSelected) |
| 0 | 443 | | return false; |
| | 444 | |
|
| 26 | 445 | | entityEditable.Select(); |
| | 446 | |
|
| 26 | 447 | | selectedEntities.Add(entityEditable); |
| | 448 | |
|
| 26 | 449 | | currentActiveMode?.SelectedEntity(entityEditable); |
| | 450 | |
|
| 26 | 451 | | if (HUDController.i.builderInWorldMainHud != null) |
| | 452 | | { |
| 0 | 453 | | hudController.UpdateEntitiesSelection(selectedEntities.Count); |
| 0 | 454 | | hudController.ShowEntityInformation(selectedFromCatalog); |
| 0 | 455 | | hudController.EntityInformationSetEntity(entityEditable, sceneToEdit); |
| | 456 | | } |
| | 457 | |
|
| 26 | 458 | | outlinerController.CancelAllOutlines(); |
| | 459 | |
|
| 26 | 460 | | OnEntitySelected?.Invoke(); |
| | 461 | |
|
| 26 | 462 | | return true; |
| | 463 | | } |
| | 464 | |
|
| | 465 | | public List<BIWEntity> GetAllVoxelsEntities() |
| | 466 | | { |
| 1 | 467 | | List<BIWEntity> voxelEntities = new List<BIWEntity>(); |
| 4 | 468 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 469 | | { |
| 1 | 470 | | if (entity.rootEntity.scene == sceneToEdit && entity.isVoxel) |
| 1 | 471 | | voxelEntities.Add(entity); |
| | 472 | | } |
| | 473 | |
|
| 1 | 474 | | return voxelEntities; |
| | 475 | | } |
| | 476 | |
|
| | 477 | | public List<BIWEntity> GetAllEntitiesFromCurrentScene() |
| | 478 | | { |
| 56 | 479 | | List<BIWEntity> entities = new List<BIWEntity>(); |
| 246 | 480 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 481 | | { |
| 67 | 482 | | if (entity.rootEntity.scene == sceneToEdit) |
| 67 | 483 | | entities.Add(entity); |
| | 484 | | } |
| | 485 | |
|
| 56 | 486 | | return entities; |
| | 487 | | } |
| | 488 | |
|
| | 489 | | public BIWEntity GetConvertedEntity(string entityId) |
| | 490 | | { |
| 6 | 491 | | if (convertedEntities.ContainsKey(GetConvertedUniqueKeyForEntity(entityId))) |
| 6 | 492 | | return convertedEntities[GetConvertedUniqueKeyForEntity(entityId)]; |
| | 493 | |
|
| 0 | 494 | | return null; |
| | 495 | | } |
| | 496 | |
|
| | 497 | | public BIWEntity GetConvertedEntity(IDCLEntity entity) |
| | 498 | | { |
| 17 | 499 | | if (convertedEntities.ContainsKey(GetConvertedUniqueKeyForEntity(entity))) |
| 16 | 500 | | return convertedEntities[GetConvertedUniqueKeyForEntity(entity)]; |
| | 501 | |
|
| 1 | 502 | | return null; |
| | 503 | | } |
| | 504 | |
|
| | 505 | | public void DuplicateSelectedEntities() |
| | 506 | | { |
| 2 | 507 | | BIWCompleteAction buildAction = new BIWCompleteAction(); |
| 2 | 508 | | buildAction.actionType = BIWCompleteAction.ActionType.CREATE; |
| | 509 | |
|
| 2 | 510 | | List<BIWEntityAction> entityActionList = new List<BIWEntityAction>(); |
| 2 | 511 | | List<BIWEntity> entitiesToDuplicate = new List<BIWEntity>(selectedEntities); |
| 2 | 512 | | DeselectEntities(); |
| | 513 | |
|
| 8 | 514 | | foreach (BIWEntity entityToDuplicate in entitiesToDuplicate) |
| | 515 | | { |
| 2 | 516 | | if (entityToDuplicate.isNFT) |
| | 517 | | continue; |
| | 518 | |
|
| 2 | 519 | | var entityDuplicated = DuplicateEntity(entityToDuplicate); |
| 2 | 520 | | BIWEntityAction biwEntityAction = new BIWEntityAction(entityDuplicated.rootEntity, entityDuplicated.rootEnti |
| 2 | 521 | | entityActionList.Add(biwEntityAction); |
| 2 | 522 | | SelectEntity(entityDuplicated); |
| | 523 | | } |
| | 524 | |
|
| 2 | 525 | | currentActiveMode?.SetDuplicationOffset(DUPLICATE_OFFSET); |
| | 526 | |
|
| 2 | 527 | | buildAction.CreateActionType(entityActionList, BIWCompleteAction.ActionType.CREATE); |
| 2 | 528 | | actionController.AddAction(buildAction); |
| 2 | 529 | | } |
| | 530 | |
|
| | 531 | | public BIWEntity DuplicateEntity(BIWEntity entityToDuplicate) |
| | 532 | | { |
| 3 | 533 | | IDCLEntity entity = SceneUtils.DuplicateEntity(sceneToEdit, entityToDuplicate.rootEntity); |
| | 534 | | //Note: If the entity contains the name component or DCLLockedOnEdit, we don't want to copy them |
| 3 | 535 | | entity.RemoveSharedComponent(typeof(DCLName), false); |
| 3 | 536 | | entity.RemoveSharedComponent(typeof(DCLLockedOnEdit), false); |
| | 537 | |
|
| 3 | 538 | | BIWUtils.CopyGameObjectStatus(entityToDuplicate.rootEntity.gameObject, entity.gameObject, false, false); |
| 3 | 539 | | BIWEntity convertedEntity = SetupEntityToEdit(entity); |
| | 540 | |
|
| 3 | 541 | | NotifyEntityIsCreated(entity); |
| 3 | 542 | | EntityListChanged(); |
| 3 | 543 | | return convertedEntity; |
| | 544 | | } |
| | 545 | |
|
| | 546 | | public IDCLEntity CreateEntityFromJSON(string entityJson) |
| | 547 | | { |
| 3 | 548 | | EntityData data = BIWUtils.ConvertJSONToEntityData(entityJson); |
| | 549 | |
|
| 3 | 550 | | IDCLEntity newEntity = sceneToEdit.CreateEntity(data.entityId); |
| | 551 | |
|
| | 552 | |
|
| 3 | 553 | | if (data.transformComponent != null) |
| | 554 | | { |
| 1 | 555 | | DCLTransform.model.position = data.transformComponent.position; |
| 1 | 556 | | DCLTransform.model.rotation = Quaternion.Euler(data.transformComponent.rotation); |
| 1 | 557 | | DCLTransform.model.scale = data.transformComponent.scale; |
| 1 | 558 | | sceneToEdit.EntityComponentCreateOrUpdateWithModel(newEntity.entityId, CLASS_ID_COMPONENT.TRANSFORM, DCLTran |
| | 559 | | } |
| | 560 | |
|
| 6 | 561 | | foreach (ProtocolV2.GenericComponent component in data.components) |
| | 562 | | { |
| 0 | 563 | | sceneToEdit.EntityComponentCreateOrUpdateWithModel(newEntity.entityId, (CLASS_ID_COMPONENT) component.compon |
| | 564 | | } |
| | 565 | |
|
| 10 | 566 | | foreach (ProtocolV2.GenericComponent component in data.sharedComponents) |
| | 567 | | { |
| 2 | 568 | | sceneToEdit.SharedComponentAttach(newEntity.entityId, component.classId); |
| | 569 | | } |
| | 570 | |
|
| 3 | 571 | | if (data.nftComponent != null) |
| | 572 | | { |
| 1 | 573 | | NFTShape nftShape = (NFTShape) sceneToEdit.SharedComponentCreate(data.nftComponent.id, Convert.ToInt32(CLASS |
| 1 | 574 | | nftShape.model = new NFTShape.Model(); |
| 1 | 575 | | nftShape.model.color = data.nftComponent.color.ToColor(); |
| 1 | 576 | | nftShape.model.src = data.nftComponent.src; |
| 1 | 577 | | nftShape.model.assetId = data.nftComponent.assetId; |
| | 578 | |
|
| 1 | 579 | | sceneToEdit.SharedComponentAttach(newEntity.entityId, nftShape.id); |
| | 580 | | } |
| | 581 | |
|
| 3 | 582 | | var convertedEntity = SetupEntityToEdit(newEntity, true); |
| | 583 | |
|
| 3 | 584 | | if (convertedEntity.rootEntity.TryGetSharedComponent(CLASS_ID.GLTF_SHAPE, out var gltfComponent)) |
| 0 | 585 | | gltfComponent.CallWhenReady(convertedEntity.ShapeLoadFinish); |
| | 586 | |
|
| 3 | 587 | | if (convertedEntity.rootEntity.TryGetSharedComponent(CLASS_ID.NFT_SHAPE, out var nftComponent)) |
| 1 | 588 | | nftComponent.CallWhenReady(convertedEntity.ShapeLoadFinish); |
| | 589 | |
|
| | 590 | |
|
| 3 | 591 | | creatorController.CreateLoadingObject(convertedEntity); |
| 3 | 592 | | EntityListChanged(); |
| | 593 | |
|
| 3 | 594 | | return newEntity; |
| | 595 | | } |
| | 596 | |
|
| | 597 | | public BIWEntity CreateEmptyEntity(ParcelScene parcelScene, Vector3 entryPoint, Vector3 editionGOPosition, bool noti |
| | 598 | | { |
| 30 | 599 | | IDCLEntity newEntity = parcelScene.CreateEntity(Guid.NewGuid().ToString()); |
| | 600 | |
|
| 30 | 601 | | DCLTransform.model.position = WorldStateUtils.ConvertUnityToScenePosition(entryPoint, parcelScene); |
| | 602 | |
|
| 30 | 603 | | Vector3 pointToLookAt = Camera.main.transform.position; |
| 30 | 604 | | pointToLookAt.y = editionGOPosition.y; |
| 30 | 605 | | Quaternion lookOnLook = Quaternion.LookRotation(editionGOPosition - pointToLookAt); |
| | 606 | |
|
| 30 | 607 | | DCLTransform.model.rotation = lookOnLook; |
| 30 | 608 | | DCLTransform.model.scale = newEntity.gameObject.transform.lossyScale; |
| | 609 | |
|
| 30 | 610 | | parcelScene.EntityComponentCreateOrUpdateWithModel(newEntity.entityId, CLASS_ID_COMPONENT.TRANSFORM, DCLTransfor |
| | 611 | |
|
| 30 | 612 | | BIWEntity convertedEntity = SetupEntityToEdit(newEntity, true); |
| 30 | 613 | | hudController?.UpdateSceneLimitInfo(); |
| | 614 | |
|
| 30 | 615 | | if (notifyEntityList) |
| 11 | 616 | | EntityListChanged(); |
| 30 | 617 | | return convertedEntity; |
| | 618 | | } |
| | 619 | |
|
| | 620 | | private void SetupAllEntities() |
| | 621 | | { |
| 284 | 622 | | foreach (IDCLEntity entity in sceneToEdit.entities.Values) |
| | 623 | | { |
| 62 | 624 | | SetupEntityToEdit(entity); |
| | 625 | | } |
| 80 | 626 | | } |
| | 627 | |
|
| | 628 | | public void DestroyLastCreatedEntities() |
| | 629 | | { |
| 2 | 630 | | List<BIWEntity> entitiesToRemove = new List<BIWEntity>(); |
| 8 | 631 | | foreach (BIWEntity entity in selectedEntities) |
| | 632 | | { |
| 2 | 633 | | if (entity.isSelected && entity.isNew) |
| 1 | 634 | | entitiesToRemove.Add(entity); |
| | 635 | | } |
| | 636 | |
|
| 2 | 637 | | if (entitiesToRemove.Count == 0) |
| 1 | 638 | | return; |
| | 639 | |
|
| 1 | 640 | | modeController.UndoEditionGOLastStep(); |
| | 641 | |
|
| 4 | 642 | | foreach (BIWEntity entity in entitiesToRemove) |
| | 643 | | { |
| 1 | 644 | | DeleteEntity(entity, false); |
| | 645 | | } |
| | 646 | |
|
| 1 | 647 | | hudController?.HideEntityInformation(); |
| 0 | 648 | | } |
| | 649 | |
|
| | 650 | | public void EntityListChanged() |
| | 651 | | { |
| 125 | 652 | | if (HUDController.i.builderInWorldMainHud == null) |
| 117 | 653 | | return; |
| 8 | 654 | | hudController.SetEntityList(GetEntitiesInCurrentScene()); |
| 8 | 655 | | } |
| | 656 | |
|
| 10 | 657 | | public int GetCurrentSceneEntityCount() { return GetEntitiesInCurrentScene().Count; } |
| | 658 | |
|
| | 659 | | List<BIWEntity> GetEntitiesInCurrentScene() |
| | 660 | | { |
| 18 | 661 | | List<BIWEntity> currentEntitiesInScene = new List<BIWEntity>(); |
| 98 | 662 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 663 | | { |
| 31 | 664 | | if (entity.rootEntity.scene == sceneToEdit) |
| 31 | 665 | | currentEntitiesInScene.Add(entity); |
| | 666 | | } |
| | 667 | |
|
| 18 | 668 | | return currentEntitiesInScene; |
| | 669 | | } |
| | 670 | |
|
| | 671 | | BIWEntity SetupEntityToEdit(IDCLEntity entity, bool hasBeenCreated = false) |
| | 672 | | { |
| 98 | 673 | | string biwEntityId = GetConvertedUniqueKeyForEntity(entity); |
| | 674 | |
|
| 98 | 675 | | if (convertedEntities.ContainsKey(biwEntityId)) |
| 1 | 676 | | return convertedEntities[biwEntityId]; |
| | 677 | |
|
| 97 | 678 | | BIWEntity entityToEdit = new BIWEntity(); |
| 97 | 679 | | entityToEdit.Initialize(entity, editMaterial); |
| 97 | 680 | | convertedEntities.Add(entityToEdit.entityUniqueId, entityToEdit); |
| 97 | 681 | | entity.OnRemoved += RemoveConvertedEntity; |
| 97 | 682 | | entityToEdit.isNew = hasBeenCreated; |
| | 683 | |
|
| 97 | 684 | | string entityName = entityToEdit.GetDescriptiveName(); |
| 97 | 685 | | var catalogItem = entityToEdit.GetCatalogItemAssociated(); |
| | 686 | |
|
| 97 | 687 | | if ((string.IsNullOrEmpty(entityName) || entityNameList.Contains(entityName)) && catalogItem != null) |
| | 688 | | { |
| 0 | 689 | | entityName = GetNewNameForEntity(catalogItem); |
| 0 | 690 | | SetEntityName(entityToEdit, entityName); |
| 0 | 691 | | } |
| 97 | 692 | | else if (!string.IsNullOrEmpty(entityName) && !entityNameList.Contains(entityName)) |
| | 693 | | { |
| 0 | 694 | | entityNameList.Add(entityName); |
| | 695 | | } |
| | 696 | |
|
| 97 | 697 | | return entityToEdit; |
| | 698 | | } |
| | 699 | |
|
| | 700 | | internal void ChangeEntityBoundsCheckerStatus(IDCLEntity entity, bool isInsideBoundaries) |
| | 701 | | { |
| 2 | 702 | | var convertedEntity = GetConvertedEntity(entity); |
| 2 | 703 | | if (convertedEntity == null) |
| 1 | 704 | | return; |
| | 705 | |
|
| 1 | 706 | | convertedEntity.SetEntityBoundariesError(isInsideBoundaries); |
| 1 | 707 | | } |
| | 708 | |
|
| 1 | 709 | | public string GetNewNameForEntity(CatalogItem sceneObject) { return GetNewNameForEntity(sceneObject.name); } |
| | 710 | |
|
| | 711 | | public string GetNewNameForEntity(string name) |
| | 712 | | { |
| 3 | 713 | | int i = 1; |
| 3 | 714 | | if (!entityNameList.Contains(name)) |
| 1 | 715 | | return name; |
| | 716 | |
|
| 2 | 717 | | string newName = name + " " + i; |
| 2 | 718 | | while (entityNameList.Contains(newName)) |
| | 719 | | { |
| 0 | 720 | | i++; |
| 0 | 721 | | newName = name + " " + i; |
| | 722 | | } |
| | 723 | |
|
| 2 | 724 | | return newName; |
| | 725 | | } |
| | 726 | |
|
| | 727 | | public void DeleteFloorEntities() |
| | 728 | | { |
| 4 | 729 | | List<BIWEntity> entitiesToDelete = new List<BIWEntity>(); |
| | 730 | |
|
| 22 | 731 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 732 | | { |
| 7 | 733 | | if (entity.isFloor) |
| | 734 | | { |
| 4 | 735 | | entitiesToDelete.Add(entity); |
| | 736 | | } |
| | 737 | | } |
| | 738 | |
|
| 16 | 739 | | foreach (BIWEntity entity in entitiesToDelete) |
| 4 | 740 | | DeleteEntity(entity, false); |
| 4 | 741 | | } |
| | 742 | |
|
| | 743 | | public void DeleteEntity(string entityId) |
| | 744 | | { |
| 3 | 745 | | BIWEntity entity = convertedEntities[GetConvertedUniqueKeyForEntity(entityId)]; |
| 3 | 746 | | DeleteEntity(entity, true); |
| 3 | 747 | | } |
| | 748 | |
|
| 8 | 749 | | public void DeleteEntity(BIWEntity entityToDelete) { DeleteEntity(entityToDelete, true); } |
| | 750 | |
|
| | 751 | | public void DeleteEntity(BIWEntity entityToDelete, bool checkSelection) |
| | 752 | | { |
| 13 | 753 | | if (entityToDelete.isSelected && checkSelection) |
| 0 | 754 | | DeselectEntity(entityToDelete); |
| | 755 | |
|
| 13 | 756 | | if (selectedEntities.Contains(entityToDelete)) |
| | 757 | | { |
| 1 | 758 | | selectedEntities.Remove(entityToDelete); |
| 1 | 759 | | hudController?.UpdateEntitiesSelection(selectedEntities.Count); |
| | 760 | | } |
| | 761 | |
|
| 13 | 762 | | string entityName = entityToDelete.GetDescriptiveName(); |
| | 763 | |
|
| 13 | 764 | | if (entityNameList.Contains(entityName)) |
| 4 | 765 | | entityNameList.Remove(entityName); |
| | 766 | |
|
| 13 | 767 | | RemoveConvertedEntity(entityToDelete.rootEntity); |
| 13 | 768 | | entityToDelete.rootEntity.OnRemoved -= RemoveConvertedEntity; |
| 13 | 769 | | entityToDelete.Delete(); |
| 13 | 770 | | string idToRemove = entityToDelete.rootEntity.entityId; |
| 13 | 771 | | OnEntityDeleted?.Invoke(entityToDelete); |
| 13 | 772 | | creatorController.RemoveLoadingObjectInmediate(entityToDelete.rootEntity.entityId); |
| 13 | 773 | | if (sceneToEdit.entities.ContainsKey(idToRemove)) |
| 13 | 774 | | sceneToEdit.RemoveEntity(idToRemove, true); |
| | 775 | |
|
| 13 | 776 | | hudController?.RefreshCatalogAssetPack(); |
| 13 | 777 | | EntityListChanged(); |
| 13 | 778 | | bridge?.RemoveEntityOnKernel(idToRemove, sceneToEdit); |
| 0 | 779 | | } |
| | 780 | |
|
| | 781 | | public void DeleteSingleEntity(BIWEntity entityToDelete) |
| | 782 | | { |
| 1 | 783 | | actionController.CreateActionEntityDeleted(entityToDelete); |
| 1 | 784 | | DeleteEntity(entityToDelete, true); |
| 1 | 785 | | } |
| | 786 | |
|
| | 787 | | public void DeleteSelectedEntities() |
| | 788 | | { |
| 2 | 789 | | List<BIWEntity> entitiesToRemove = new List<BIWEntity>(); |
| | 790 | |
|
| 8 | 791 | | for (int i = 0; i < selectedEntities.Count; i++) |
| | 792 | | { |
| 2 | 793 | | entitiesToRemove.Add(selectedEntities[i]); |
| | 794 | | } |
| | 795 | |
|
| 2 | 796 | | actionController.CreateActionEntityDeleted(entitiesToRemove); |
| | 797 | |
|
| 2 | 798 | | DeselectEntities(); |
| | 799 | |
|
| 8 | 800 | | foreach (BIWEntity entity in entitiesToRemove) |
| | 801 | | { |
| 2 | 802 | | DeleteEntity(entity); |
| | 803 | | } |
| | 804 | |
|
| 2 | 805 | | OnDeleteSelectedEntities?.Invoke(entitiesToRemove); |
| 0 | 806 | | } |
| | 807 | |
|
| | 808 | | public void DeleteEntitiesOutsideSceneBoundaries() |
| | 809 | | { |
| 1 | 810 | | List<BIWEntity> entitiesToRemove = new List<BIWEntity>(); |
| 6 | 811 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 812 | | { |
| 2 | 813 | | if (entity.rootEntity.scene == sceneToEdit) |
| | 814 | | { |
| 2 | 815 | | if (!DCL.Environment.i.world.sceneBoundsChecker.IsEntityInsideSceneBoundaries(entity.rootEntity)) |
| | 816 | | { |
| 2 | 817 | | entitiesToRemove.Add(entity); |
| | 818 | | } |
| | 819 | | } |
| | 820 | | } |
| | 821 | |
|
| 6 | 822 | | foreach (BIWEntity entity in entitiesToRemove) |
| | 823 | | { |
| 2 | 824 | | DeleteEntity(entity); |
| | 825 | | } |
| 1 | 826 | | } |
| | 827 | |
|
| | 828 | | private void DestroyCollidersForAllEntities() |
| | 829 | | { |
| 300 | 830 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 831 | | { |
| 69 | 832 | | entity.DestroyColliders(); |
| | 833 | | } |
| 81 | 834 | | } |
| | 835 | |
|
| 194 | 836 | | private void RemoveConvertedEntity(IDCLEntity entity) { convertedEntities.Remove(GetConvertedUniqueKeyForEntity(enti |
| | 837 | |
|
| 18 | 838 | | public void NotifyEntityIsCreated(IDCLEntity entity) { bridge?.AddEntityOnKernel(entity, sceneToEdit); } |
| | 839 | |
|
| | 840 | | [ExcludeFromCodeCoverage] |
| | 841 | | public void UpdateSmartItemComponentInKernel(BIWEntity entityToUpdate) { bridge?.UpdateSmartItemComponent(entityToUp |
| | 842 | |
|
| 4 | 843 | | public void SetEntityName(BIWEntity entityToApply, string newName) { SetEntityName(entityToApply, newName, true); } |
| | 844 | |
|
| | 845 | | public void SetEntityName(BIWEntity entityToApply, string newName, bool sendUpdateToKernel = true) |
| | 846 | | { |
| 17 | 847 | | string currentName = entityToApply.GetDescriptiveName(); |
| | 848 | |
|
| 17 | 849 | | if (currentName == newName) |
| 0 | 850 | | return; |
| | 851 | |
|
| 17 | 852 | | if (entityNameList.Contains(newName)) |
| 2 | 853 | | newName = GetNewNameForEntity(newName); |
| | 854 | |
|
| 17 | 855 | | if (entityNameList.Contains(currentName)) |
| 0 | 856 | | entityNameList.Remove(currentName); |
| | 857 | |
|
| 17 | 858 | | entityToApply.SetDescriptiveName(newName); |
| 17 | 859 | | entityNameList.Add(newName); |
| | 860 | |
|
| 17 | 861 | | if (sendUpdateToKernel) |
| 2 | 862 | | bridge?.ChangedEntityName(entityToApply, sceneToEdit); |
| 15 | 863 | | } |
| | 864 | |
|
| | 865 | | internal void ChangeEntityVisibilityStatus(BIWEntity entityToApply) |
| | 866 | | { |
| 1 | 867 | | entityToApply.ToggleShowStatus(); |
| 1 | 868 | | if (!entityToApply.isVisible && selectedEntities.Contains(entityToApply)) |
| 1 | 869 | | DeselectEntity(entityToApply); |
| 1 | 870 | | } |
| | 871 | |
|
| | 872 | | internal void ChangeEntityLockStatus(BIWEntity entityToApply) |
| | 873 | | { |
| 1 | 874 | | entityToApply.ToggleLockStatus(); |
| 1 | 875 | | if (entityToApply.isLocked && selectedEntities.Contains(entityToApply)) |
| 0 | 876 | | DeselectEntity(entityToApply); |
| | 877 | |
|
| 1 | 878 | | bridge?.ChangeEntityLockStatus(entityToApply, sceneToEdit); |
| 0 | 879 | | } |
| | 880 | |
|
| 15 | 881 | | private string GetConvertedUniqueKeyForEntity(string entityID) { return sceneToEdit.sceneData.id + entityID; } |
| | 882 | |
|
| 228 | 883 | | private string GetConvertedUniqueKeyForEntity(IDCLEntity entity) { return entity.scene.sceneData.id + entity.entityI |
| | 884 | |
|
| | 885 | | public bool AreAllEntitiesInsideBoundaries() |
| | 886 | | { |
| 4 | 887 | | bool areAllIn = true; |
| 12 | 888 | | foreach (BIWEntity entity in convertedEntities.Values) |
| | 889 | | { |
| 3 | 890 | | if (!DCL.Environment.i.world.sceneBoundsChecker.IsEntityInsideSceneBoundaries(entity.rootEntity)) |
| | 891 | | { |
| 2 | 892 | | areAllIn = false; |
| 2 | 893 | | break; |
| | 894 | | } |
| | 895 | | } |
| | 896 | |
|
| 4 | 897 | | return areAllIn; |
| | 898 | | } |
| | 899 | | } |