From ef859b2dd271c1eadc3cc2bded4f39fa94ebb0f9 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 16 Dec 2024 22:30:21 -0300 Subject: [PATCH 01/10] Logout flow --- .../Meta/SceneRoomMetaDataSource.cs | 3 +- .../RealUserInAppInitializationFlow.cs | 62 ++++++++----------- .../SceneLifeCycle/Realm/IRealmNavigator.cs | 3 + .../Scripts/Global/Dynamic/RealmNavigator.cs | 6 ++ 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs b/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs index bc6deb18ab..73003ee89c 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs @@ -64,6 +64,7 @@ public async UniTask MetaDataAsync(MetaData.Input input, CancellationT : new MetaData(null, input); } - public bool MetadataIsDirty => !realmData.ScenesAreFixed && characterTransform.Position.IsDirty; + public bool MetadataIsDirty => realmData is { Configured: true, ScenesAreFixed: false } && + characterTransform.Position.IsDirty; } } diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs index 53861ce183..8fa6f31495 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs @@ -42,6 +42,8 @@ public class RealUserInAppInitializationFlow : IUserInAppInitializationFlow private readonly RestartRealmStartupOperation restartRealmStartupOperation; private readonly IStartupOperation startupOperation; + private readonly IRealmController realmController; + public RealUserInAppInitializationFlow( ILoadingStatus loadingStatus, IHealthCheck livekitHealthCheck, @@ -70,6 +72,7 @@ public RealUserInAppInitializationFlow( this.backgroundMusic = backgroundMusic; this.realmNavigator = realmNavigator; this.loadingScreen = loadingScreen; + this.realmController = realmController; this.roomHub = roomHub; var ensureLivekitConnectionStartupOperation = new EnsureLivekitConnectionStartupOperation(loadingStatus, livekitHealthCheck); @@ -113,51 +116,36 @@ public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters paramete do { - if (parameters.FromLogout) - - // Disconnect current livekit connection on logout so the avatar is removed from other peers - await roomHub.StopAsync().Timeout(TimeSpan.FromSeconds(10)); - if (parameters.ShowAuthentication) { loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.AuthenticationScreenShowing); - await ShowAuthenticationScreenAsync(ct); + if (parameters.FromLogout) + { + realmNavigator.RemoveCameraSamplingData(); + await UniTask.WhenAll(ShowAuthenticationScreenAsync(ct), realmController.RestartRealmAsync(ct)); + } + else + { + await ShowAuthenticationScreenAsync(ct); + } } - if (parameters.FromLogout) - { - // If we are coming from a logout, we teleport the user to Genesis Plaza and force realm change to reset the scene properly - var url = URLDomain.FromString(decentralandUrlsSource.Url(DecentralandUrl.Genesis)); - var changeRealmResult = await realmNavigator.TryChangeRealmAsync(url, ct); - - if (changeRealmResult.Success == false) - ReportHub.LogError(ReportCategory.AUTHENTICATION, changeRealmResult.AsResult().ErrorMessage!); + var loadingResult = await LoadingScreen(parameters.ShowLoading) + .ShowWhileExecuteTaskAsync( + async (parentLoadReport, ct) => + { + result = await startupOperation.ExecuteAsync(parentLoadReport, ct); - // Restart livekit connection - await roomHub.StartAsync().Timeout(TimeSpan.FromSeconds(10)); - result = changeRealmResult.AsResult(); + if (result.Success) + parentLoadReport.SetProgress( + loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.Completed)); - // We need to flag the process as completed, otherwise the multiplayer systems will not run - loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.Completed); - } - else - { - Result loadingResult = await LoadingScreen(parameters.ShowLoading) - .ShowWhileExecuteTaskAsync( - async (parentLoadReport, ct) => - { - result = await startupOperation.ExecuteAsync(parentLoadReport, ct); - - if (result.Success) - parentLoadReport.SetProgress(loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.Completed)); + return result; + }, + ct + ); - return result; - }, - ct - ); - - ApplyErrorIfLoadingScreenError(ref result, loadingResult); - } + ApplyErrorIfLoadingScreenError(ref result, loadingResult); if (result.Success == false) ReportHub.LogError(ReportCategory.DEBUG, result.ErrorMessage!); diff --git a/Explorer/Assets/Scripts/ECS/SceneLifeCycle/Realm/IRealmNavigator.cs b/Explorer/Assets/Scripts/ECS/SceneLifeCycle/Realm/IRealmNavigator.cs index 04cad85556..7c7cc44f4d 100644 --- a/Explorer/Assets/Scripts/ECS/SceneLifeCycle/Realm/IRealmNavigator.cs +++ b/Explorer/Assets/Scripts/ECS/SceneLifeCycle/Realm/IRealmNavigator.cs @@ -40,8 +40,11 @@ UniTask> TryChangeRealmAsync( UniTask InitializeTeleportToSpawnPointAsync(AsyncLoadProcessReport teleportLoadReport, CancellationToken ct, Vector2Int parcelToTeleport); + void RemoveCameraSamplingData(); + void SwitchMiscVisibilityAsync(); UniTask ChangeRealmAsync(URLDomain realm, CancellationToken ct); + } } diff --git a/Explorer/Assets/Scripts/Global/Dynamic/RealmNavigator.cs b/Explorer/Assets/Scripts/Global/Dynamic/RealmNavigator.cs index 2cfdff4b24..1f3295daaf 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/RealmNavigator.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/RealmNavigator.cs @@ -247,6 +247,12 @@ private Func> DoChang }; } + public void RemoveCameraSamplingData() + { + if (globalWorld.Has(cameraEntity.Object)) + globalWorld.Remove(cameraEntity.Object); + } + public async UniTask InitializeTeleportToSpawnPointAsync( AsyncLoadProcessReport teleportLoadReport, CancellationToken ct, From cfe0cae2646dfc9368b799cf3ea0a3328a17176b Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Tue, 17 Dec 2024 09:37:30 -0300 Subject: [PATCH 02/10] Be in Mordor while scene loads --- .../Systems/TeleportCharacterSystem.cs | 3 +++ .../RealUserInAppInitializationFlow.cs | 26 ++++++++++++------- .../Global/Dynamic/DynamicWorldContainer.cs | 1 - 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/TeleportCharacterSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/TeleportCharacterSystem.cs index 5d70b4df2f..f59f406484 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/TeleportCharacterSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/TeleportCharacterSystem.cs @@ -51,6 +51,9 @@ private void TeleportPlayer(Entity entity, CharacterController controller, ref C switch (status.TaskStatus) { + case UniTaskStatus.Pending: + controller.transform.position = new Vector3(15000, 0, 15000); + return; case UniTaskStatus.Succeeded: ResolveAsSuccess(entity, in teleportIntent, controller, ref platformComponent); return; diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs index 8fa6f31495..84f4f43ce9 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs @@ -1,5 +1,3 @@ -using CommunicationData.URLHelpers; -using System; using System.Threading; using Cysharp.Threading.Tasks; using DCL.Audio; @@ -8,7 +6,6 @@ using DCL.Diagnostics; using DCL.FeatureFlags; using DCL.Multiplayer.Connections.DecentralandUrls; -using DCL.Multiplayer.Connections.RoomHubs; using DCL.Multiplayer.HealthChecks; using DCL.Profiles.Self; using DCL.SceneLoadingScreens.LoadingScreen; @@ -31,16 +28,16 @@ public class RealUserInAppInitializationFlow : IUserInAppInitializationFlow private static readonly ILoadingScreen.EmptyLoadingScreen EMPTY_LOADING_SCREEN = new (); private readonly ILoadingStatus loadingStatus; - private readonly IDecentralandUrlsSource decentralandUrlsSource; private readonly IMVCManager mvcManager; private readonly AudioClipConfig backgroundMusic; private readonly IRealmNavigator realmNavigator; private readonly ILoadingScreen loadingScreen; - private readonly IRoomHub roomHub; private readonly LoadPlayerAvatarStartupOperation loadPlayerAvatarStartupOperation; private readonly CheckOnboardingStartupOperation checkOnboardingStartupOperation; private readonly RestartRealmStartupOperation restartRealmStartupOperation; private readonly IStartupOperation startupOperation; + private readonly IStartupOperation reloginOperation; + private readonly IRealmController realmController; @@ -63,17 +60,14 @@ public RealUserInAppInitializationFlow( IAppArgs appParameters, IDebugSettings debugSettings, IPortableExperiencesController portableExperiencesController, - IRoomHub roomHub, DiagnosticsContainer diagnosticsContainer) { this.loadingStatus = loadingStatus; - this.decentralandUrlsSource = decentralandUrlsSource; this.mvcManager = mvcManager; this.backgroundMusic = backgroundMusic; this.realmNavigator = realmNavigator; this.loadingScreen = loadingScreen; this.realmController = realmController; - this.roomHub = roomHub; var ensureLivekitConnectionStartupOperation = new EnsureLivekitConnectionStartupOperation(loadingStatus, livekitHealthCheck); var initializeFeatureFlagsStartupOperation = new InitializeFeatureFlagsStartupOperation(loadingStatus, featureFlagsProvider, web3IdentityCache, decentralandUrlsSource, appParameters); @@ -101,6 +95,18 @@ public RealUserInAppInitializationFlow( loadGlobalPxOperation, sentryDiagnostics ); + + reloginOperation = new SequentialStartupOperation( + loadingStatus, + preloadProfileStartupOperation, + switchRealmMiscVisibilityStartupOperation, + loadPlayerAvatarStartupOperation, + loadLandscapeStartupOperation, + checkOnboardingStartupOperation, + restartRealmStartupOperation, + teleportStartupOperation, + loadGlobalPxOperation, + sentryDiagnostics); } public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters parameters, CancellationToken ct) @@ -130,11 +136,13 @@ public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters paramete } } + var flowToRun = parameters.FromLogout ? reloginOperation : startupOperation; + var loadingResult = await LoadingScreen(parameters.ShowLoading) .ShowWhileExecuteTaskAsync( async (parentLoadReport, ct) => { - result = await startupOperation.ExecuteAsync(parentLoadReport, ct); + result = await flowToRun.ExecuteAsync(parentLoadReport, ct); if (result.Success) parentLoadReport.SetProgress( diff --git a/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs b/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs index 3c40ce03ca..8e388f6258 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs @@ -400,7 +400,6 @@ IMultiPool MultiPoolFactory() => dynamicWorldParams.AppParameters, bootstrapContainer.DebugSettings, staticContainer.PortableExperiencesController, - container.RoomHub, bootstrapContainer.DiagnosticsContainer); var worldInfoHub = new LocationBasedWorldInfoHub( From 64e40774eb0810187f055aeba6e83c280ec8d7aa Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Tue, 17 Dec 2024 10:30:48 -0300 Subject: [PATCH 03/10] Clear chat history and mordor position encapsulation --- .../Systems/TeleportCharacterSystem.cs | 3 ++- .../DCL/PluginSystem/Utils/MordorConstants.cs | 9 +++++++++ .../DCL/PluginSystem/Utils/MordorConstants.cs.meta | 11 +++++++++++ .../DCL/PluginSystem/World/TransformsPlugin.cs | 2 +- .../DCL.UserInAppInitializationFlow.asmdef | 3 ++- .../RealUserInAppInitializationFlow.cs | 14 +++++++++++--- .../Global/Dynamic/DynamicWorldContainer.cs | 7 ++++--- 7 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs create mode 100644 Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs.meta diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/TeleportCharacterSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/TeleportCharacterSystem.cs index f59f406484..9803fcc63b 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/TeleportCharacterSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/TeleportCharacterSystem.cs @@ -52,7 +52,8 @@ private void TeleportPlayer(Entity entity, CharacterController controller, ref C switch (status.TaskStatus) { case UniTaskStatus.Pending: - controller.transform.position = new Vector3(15000, 0, 15000); + // Teleport the character to a far away place while the teleport is executed + controller.transform.position = MordorConstants.PLAYER_MORDOR_POSITION; return; case UniTaskStatus.Succeeded: ResolveAsSuccess(entity, in teleportIntent, controller, ref platformComponent); diff --git a/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs b/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs new file mode 100644 index 0000000000..6d71332b18 --- /dev/null +++ b/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs @@ -0,0 +1,9 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public static class MordorConstants +{ + public static Vector3 PLAYER_MORDOR_POSITION = new(15000, 0, 15000); + public static Vector3 SCENE_MORDOR_POSITION = new(0, -10000, 0); +} \ No newline at end of file diff --git a/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs.meta b/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs.meta new file mode 100644 index 0000000000..4cd6fb278f --- /dev/null +++ b/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d6aaaa3e9c49f4b6cbe91de72dbb33e2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Explorer/Assets/DCL/PluginSystem/World/TransformsPlugin.cs b/Explorer/Assets/DCL/PluginSystem/World/TransformsPlugin.cs index c3979ecfcc..d9ae320412 100644 --- a/Explorer/Assets/DCL/PluginSystem/World/TransformsPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/World/TransformsPlugin.cs @@ -61,7 +61,7 @@ private void CreateReservedTransforms(ArchSystemsWorldBuilder b { //The scene container, which is only modified by the client, starts in a position that cannot be seen by the player. Once it finished loading //in GatherGLTFAssetSystem.cs, it will be moved to the correct position. - var sceneRootContainerTransform = GetNewTransform(position: new Vector3(0, -10000, 0)); + var sceneRootContainerTransform = GetNewTransform(position: MordorConstants.SCENE_MORDOR_POSITION); sceneRootContainerTransform.name = $"{sharedDependencies.SceneData.SceneShortInfo.BaseParcel}_{sharedDependencies.SceneData.SceneShortInfo.Name}_Container"; builder.World.Add(persistentEntities.SceneContainer, new TransformComponent(sceneRootContainerTransform)); diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/DCL.UserInAppInitializationFlow.asmdef b/Explorer/Assets/DCL/UserInAppInitializationFlow/DCL.UserInAppInitializationFlow.asmdef index 6270b68ac6..7e3ab95d81 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/DCL.UserInAppInitializationFlow.asmdef +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/DCL.UserInAppInitializationFlow.asmdef @@ -34,7 +34,8 @@ "GUID:f1eaef1b40a68e74cb90cbedebf57bbf", "GUID:8c4c611b27046bc4a848721d1fdd4a9f", "GUID:4725c02394ab4ce19f889e4e8001f989", - "GUID:e25ef972de004615a22937e739de2def" + "GUID:e25ef972de004615a22937e739de2def", + "GUID:766b242fb43af451aaa331f39872177d" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs index 84f4f43ce9..a0d858566f 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs @@ -1,8 +1,10 @@ using System.Threading; +using CommunicationData.URLHelpers; using Cysharp.Threading.Tasks; using DCL.Audio; using DCL.AuthenticationScreenFlow; using DCL.AvatarRendering.AvatarShape.UnityInterface; +using DCL.Chat.History; using DCL.Diagnostics; using DCL.FeatureFlags; using DCL.Multiplayer.Connections.DecentralandUrls; @@ -37,7 +39,8 @@ public class RealUserInAppInitializationFlow : IUserInAppInitializationFlow private readonly RestartRealmStartupOperation restartRealmStartupOperation; private readonly IStartupOperation startupOperation; private readonly IStartupOperation reloginOperation; - + private readonly IDecentralandUrlsSource decentralandUrlsSource; + private readonly IChatHistory chatHistory; private readonly IRealmController realmController; @@ -60,14 +63,16 @@ public RealUserInAppInitializationFlow( IAppArgs appParameters, IDebugSettings debugSettings, IPortableExperiencesController portableExperiencesController, - DiagnosticsContainer diagnosticsContainer) + DiagnosticsContainer diagnosticsContainer, IChatHistory chatHistory) { this.loadingStatus = loadingStatus; + this.decentralandUrlsSource = decentralandUrlsSource; this.mvcManager = mvcManager; this.backgroundMusic = backgroundMusic; this.realmNavigator = realmNavigator; this.loadingScreen = loadingScreen; this.realmController = realmController; + this.chatHistory = chatHistory; var ensureLivekitConnectionStartupOperation = new EnsureLivekitConnectionStartupOperation(loadingStatus, livekitHealthCheck); var initializeFeatureFlagsStartupOperation = new InitializeFeatureFlagsStartupOperation(loadingStatus, featureFlagsProvider, web3IdentityCache, decentralandUrlsSource, appParameters); @@ -128,7 +133,10 @@ public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters paramete if (parameters.FromLogout) { realmNavigator.RemoveCameraSamplingData(); - await UniTask.WhenAll(ShowAuthenticationScreenAsync(ct), realmController.RestartRealmAsync(ct)); + chatHistory.Clear(); + await UniTask.WhenAll(ShowAuthenticationScreenAsync(ct), + realmController.SetRealmAsync( + URLDomain.FromString(decentralandUrlsSource.Url(DecentralandUrl.Genesis)), ct)); } else { diff --git a/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs b/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs index 8e388f6258..a1edd2cdf1 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs @@ -381,6 +381,8 @@ IMultiPool MultiPoolFactory() => livekitHealthCheck.WithRetries(); + var chatHistory = new ChatHistory(); + container.UserInAppInAppInitializationFlow = new RealUserInAppInitializationFlow( staticContainer.LoadingStatus, livekitHealthCheck, @@ -400,7 +402,8 @@ IMultiPool MultiPoolFactory() => dynamicWorldParams.AppParameters, bootstrapContainer.DebugSettings, staticContainer.PortableExperiencesController, - bootstrapContainer.DiagnosticsContainer); + bootstrapContainer.DiagnosticsContainer, + chatHistory); var worldInfoHub = new LocationBasedWorldInfoHub( new WorldInfoHub(staticContainer.SingletonSharedDependencies.SceneMapping), @@ -411,8 +414,6 @@ IMultiPool MultiPoolFactory() => container.CharacterDataPropagationUtility = new CharacterDataPropagationUtility(staticContainer.ComponentsContainer.ComponentPoolsRegistry.AddComponentPool()); - var chatHistory = new ChatHistory(); - var currentSceneInfo = new CurrentSceneInfo(); var connectionStatusPanelPlugin = new ConnectionStatusPanelPlugin(container.UserInAppInAppInitializationFlow, container.MvcManager, mainUIView, roomsStatus, currentSceneInfo, container.reloadSceneController, globalWorld, playerEntity, debugBuilder); From a8455afb6c57a0a872d698123f0146131e1f25d9 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Tue, 17 Dec 2024 11:39:57 -0300 Subject: [PATCH 04/10] UNload PX, remove unnecessary RestartRealmOperation, start gathering logout operations --- .../RealUserInAppInitializationFlow.cs | 16 +++++++++++----- .../Global/Dynamic/DynamicWorldContainer.cs | 3 ++- .../ECSPortableExperiencesController.cs | 6 ++++++ .../IPortableExperiencesController.cs | 2 ++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs index a0d858566f..82708b2e18 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs @@ -1,3 +1,4 @@ +using System; using System.Threading; using CommunicationData.URLHelpers; using Cysharp.Threading.Tasks; @@ -8,6 +9,7 @@ using DCL.Diagnostics; using DCL.FeatureFlags; using DCL.Multiplayer.Connections.DecentralandUrls; +using DCL.Multiplayer.Connections.RoomHubs; using DCL.Multiplayer.HealthChecks; using DCL.Profiles.Self; using DCL.SceneLoadingScreens.LoadingScreen; @@ -43,6 +45,8 @@ public class RealUserInAppInitializationFlow : IUserInAppInitializationFlow private readonly IChatHistory chatHistory; private readonly IRealmController realmController; + private readonly IRoomHub roomHub; + private readonly IPortableExperiencesController portableExperiencesController; public RealUserInAppInitializationFlow( ILoadingStatus loadingStatus, @@ -63,7 +67,7 @@ public RealUserInAppInitializationFlow( IAppArgs appParameters, IDebugSettings debugSettings, IPortableExperiencesController portableExperiencesController, - DiagnosticsContainer diagnosticsContainer, IChatHistory chatHistory) + DiagnosticsContainer diagnosticsContainer, IChatHistory chatHistory, IRoomHub roomHub) { this.loadingStatus = loadingStatus; this.decentralandUrlsSource = decentralandUrlsSource; @@ -72,7 +76,9 @@ public RealUserInAppInitializationFlow( this.realmNavigator = realmNavigator; this.loadingScreen = loadingScreen; this.realmController = realmController; + this.portableExperiencesController = portableExperiencesController; this.chatHistory = chatHistory; + this.roomHub = roomHub; var ensureLivekitConnectionStartupOperation = new EnsureLivekitConnectionStartupOperation(loadingStatus, livekitHealthCheck); var initializeFeatureFlagsStartupOperation = new InitializeFeatureFlagsStartupOperation(loadingStatus, featureFlagsProvider, web3IdentityCache, decentralandUrlsSource, appParameters); @@ -81,7 +87,6 @@ public RealUserInAppInitializationFlow( loadPlayerAvatarStartupOperation = new LoadPlayerAvatarStartupOperation(loadingStatus, selfProfile, mainPlayerAvatarBaseProxy); var loadLandscapeStartupOperation = new LoadLandscapeStartupOperation(loadingStatus, landscape); checkOnboardingStartupOperation = new CheckOnboardingStartupOperation(loadingStatus, selfProfile, featureFlagsCache, decentralandUrlsSource, appParameters, realmNavigator); - restartRealmStartupOperation = new RestartRealmStartupOperation(loadingStatus, realmController); var teleportStartupOperation = new TeleportStartupOperation(loadingStatus, realmNavigator, startParcel); var loadGlobalPxOperation = new LoadGlobalPortableExperiencesStartupOperation(loadingStatus, selfProfile, featureFlagsCache, debugSettings, portableExperiencesController); var sentryDiagnostics = new SentryDiagnosticStartupOperation(realmController, diagnosticsContainer); @@ -95,7 +100,6 @@ public RealUserInAppInitializationFlow( loadPlayerAvatarStartupOperation, loadLandscapeStartupOperation, checkOnboardingStartupOperation, - restartRealmStartupOperation, teleportStartupOperation, loadGlobalPxOperation, sentryDiagnostics @@ -103,17 +107,18 @@ public RealUserInAppInitializationFlow( reloginOperation = new SequentialStartupOperation( loadingStatus, + ensureLivekitConnectionStartupOperation, preloadProfileStartupOperation, switchRealmMiscVisibilityStartupOperation, loadPlayerAvatarStartupOperation, loadLandscapeStartupOperation, checkOnboardingStartupOperation, - restartRealmStartupOperation, teleportStartupOperation, loadGlobalPxOperation, sentryDiagnostics); } + public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters parameters, CancellationToken ct) { loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.Init); @@ -121,7 +126,6 @@ public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters paramete Result result = default; loadPlayerAvatarStartupOperation.AssignWorld(parameters.World, parameters.PlayerEntity); - restartRealmStartupOperation.EnableReload(parameters.ReloadRealm); using UIAudioEventsBus.PlayAudioScope playAudioScope = UIAudioEventsBus.Instance.NewPlayAudioScope(backgroundMusic); @@ -132,8 +136,10 @@ public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters paramete loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.AuthenticationScreenShowing); if (parameters.FromLogout) { + portableExperiencesController.UnloadAllPortableExperiences(); realmNavigator.RemoveCameraSamplingData(); chatHistory.Clear(); + await roomHub.StopAsync().Timeout(TimeSpan.FromSeconds(10)); await UniTask.WhenAll(ShowAuthenticationScreenAsync(ct), realmController.SetRealmAsync( URLDomain.FromString(decentralandUrlsSource.Url(DecentralandUrl.Genesis)), ct)); diff --git a/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs b/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs index a1edd2cdf1..fa8dfa1e93 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs @@ -403,7 +403,8 @@ IMultiPool MultiPoolFactory() => bootstrapContainer.DebugSettings, staticContainer.PortableExperiencesController, bootstrapContainer.DiagnosticsContainer, - chatHistory); + chatHistory, + container.RoomHub); var worldInfoHub = new LocationBasedWorldInfoHub( new WorldInfoHub(staticContainer.SingletonSharedDependencies.SceneMapping), diff --git a/Explorer/Assets/Scripts/Global/Dynamic/PortableExperiences/ECSPortableExperiencesController.cs b/Explorer/Assets/Scripts/Global/Dynamic/PortableExperiences/ECSPortableExperiencesController.cs index ccfb45c6f5..0b177e4f91 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/PortableExperiences/ECSPortableExperiencesController.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/PortableExperiences/ECSPortableExperiencesController.cs @@ -140,6 +140,12 @@ public bool CanKillPortableExperience(ENS ens) return spawnResponsesList; } + public void UnloadAllPortableExperiences() + { + foreach (var spawnResponse in GetAllPortableExperiences()) + UnloadPortableExperienceByEns(new ENS(spawnResponse.ens)); + } + public IPortableExperiencesController.ExitResponse UnloadPortableExperienceByEns(ENS ens) { if (!ens.IsValid) throw new ArgumentException($"The provided ens {ens.ToString()} is invalid"); diff --git a/Explorer/Assets/Scripts/Global/Dynamic/PortableExperiences/IPortableExperiencesController.cs b/Explorer/Assets/Scripts/Global/Dynamic/PortableExperiences/IPortableExperiencesController.cs index 9d6c43b728..5060d0135d 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/PortableExperiences/IPortableExperiencesController.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/PortableExperiences/IPortableExperiencesController.cs @@ -33,5 +33,7 @@ public struct ExitResponse { public bool status; } + + void UnloadAllPortableExperiences(); } } From d73322d158c4121b3ac523ff886fc570952b2623 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Tue, 17 Dec 2024 11:44:36 -0300 Subject: [PATCH 05/10] Deleted RestartRealmStartupOperation --- .../ConnectionStatusPanelController.cs | 1 - .../DCL/UI/SystemMenu/SystemMenuController.cs | 4 --- .../RealUserInAppInitializationFlow.cs | 16 ++++++--- .../RestartRealmStartupOperation.cs | 33 ------------------- .../RestartRealmStartupOperation.cs.meta | 11 ------- .../UserInAppInitializationFlowParameters.cs | 1 - 6 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 Explorer/Assets/DCL/UserInAppInitializationFlow/StartupOperations/RestartRealmStartupOperation.cs delete mode 100644 Explorer/Assets/DCL/UserInAppInitializationFlow/StartupOperations/RestartRealmStartupOperation.cs.meta diff --git a/Explorer/Assets/DCL/UI/ConnectionStatusPanel/ConnectionStatusPanelController.cs b/Explorer/Assets/DCL/UI/ConnectionStatusPanel/ConnectionStatusPanelController.cs index 53f482f5f1..1b1f1055be 100644 --- a/Explorer/Assets/DCL/UI/ConnectionStatusPanel/ConnectionStatusPanelController.cs +++ b/Explorer/Assets/DCL/UI/ConnectionStatusPanel/ConnectionStatusPanelController.cs @@ -125,7 +125,6 @@ await userInAppInitializationFlow.ExecuteAsync( { ShowAuthentication = true, ShowLoading = true, - ReloadRealm = true, FromLogout = false, World = world, PlayerEntity = playerEntity, diff --git a/Explorer/Assets/DCL/UI/SystemMenu/SystemMenuController.cs b/Explorer/Assets/DCL/UI/SystemMenu/SystemMenuController.cs index a944f36d90..a8458837c7 100644 --- a/Explorer/Assets/DCL/UI/SystemMenu/SystemMenuController.cs +++ b/Explorer/Assets/DCL/UI/SystemMenu/SystemMenuController.cs @@ -125,10 +125,6 @@ await userInAppInitializationFlow.ExecuteAsync( { ShowAuthentication = true, ShowLoading = true, - // We have to reload the realm so the scenes are recreated when coming back to the world - // The realm fetches the scene entity definitions again and creates the components in ecs - // so the SceneFacade can be later attached into the entity - ReloadRealm = true, FromLogout = true, World = world, PlayerEntity = playerEntity, diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs index 82708b2e18..ef1a75cf38 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs @@ -1,5 +1,6 @@ using System; using System.Threading; +using System.Threading.Tasks; using CommunicationData.URLHelpers; using Cysharp.Threading.Tasks; using DCL.Audio; @@ -38,7 +39,6 @@ public class RealUserInAppInitializationFlow : IUserInAppInitializationFlow private readonly ILoadingScreen loadingScreen; private readonly LoadPlayerAvatarStartupOperation loadPlayerAvatarStartupOperation; private readonly CheckOnboardingStartupOperation checkOnboardingStartupOperation; - private readonly RestartRealmStartupOperation restartRealmStartupOperation; private readonly IStartupOperation startupOperation; private readonly IStartupOperation reloginOperation; private readonly IDecentralandUrlsSource decentralandUrlsSource; @@ -136,10 +136,8 @@ public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters paramete loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.AuthenticationScreenShowing); if (parameters.FromLogout) { - portableExperiencesController.UnloadAllPortableExperiences(); - realmNavigator.RemoveCameraSamplingData(); - chatHistory.Clear(); - await roomHub.StopAsync().Timeout(TimeSpan.FromSeconds(10)); + await DoLogoutOperations(); + //Restart the realm and show the authentications screen simultaneously to avoid the "empty space" flicker await UniTask.WhenAll(ShowAuthenticationScreenAsync(ct), realmController.SetRealmAsync( URLDomain.FromString(decentralandUrlsSource.Url(DecentralandUrl.Genesis)), ct)); @@ -180,6 +178,14 @@ await UniTask.WhenAll(ShowAuthenticationScreenAsync(ct), loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.Completed); } + private async UniTask DoLogoutOperations() + { + portableExperiencesController.UnloadAllPortableExperiences(); + realmNavigator.RemoveCameraSamplingData(); + chatHistory.Clear(); + await roomHub.StopAsync().Timeout(TimeSpan.FromSeconds(10)); + } + private static void ApplyErrorIfLoadingScreenError(ref Result result, Result showResult) { if (!showResult.Success) diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/StartupOperations/RestartRealmStartupOperation.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/StartupOperations/RestartRealmStartupOperation.cs deleted file mode 100644 index 0b99e3d405..0000000000 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/StartupOperations/RestartRealmStartupOperation.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Cysharp.Threading.Tasks; -using DCL.AsyncLoadReporting; -using ECS.SceneLifeCycle.Realm; -using System.Threading; - -namespace DCL.UserInAppInitializationFlow.StartupOperations -{ - public class RestartRealmStartupOperation : StartUpOperationBase - { - private readonly ILoadingStatus loadingStatus; - private readonly IRealmController realmController; - private bool reloadRealm; - - public RestartRealmStartupOperation(ILoadingStatus loadingStatus, IRealmController realmController) - { - this.loadingStatus = loadingStatus; - this.realmController = realmController; - } - - public void EnableReload(bool enable) - { - reloadRealm = enable; - } - - protected override async UniTask InternalExecuteAsync(AsyncLoadProcessReport report, CancellationToken ct) - { - float finalizationProgress = loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.RealmRestarting); - if (reloadRealm) - await realmController.RestartRealmAsync(ct); - report.SetProgress(finalizationProgress); - } - } -} diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/StartupOperations/RestartRealmStartupOperation.cs.meta b/Explorer/Assets/DCL/UserInAppInitializationFlow/StartupOperations/RestartRealmStartupOperation.cs.meta deleted file mode 100644 index 4d744ba09e..0000000000 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/StartupOperations/RestartRealmStartupOperation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5da97f7e02354e9283ca78e2b81840de -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/UserInAppInitializationFlowParameters.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/UserInAppInitializationFlowParameters.cs index b8309c8055..ad292910d9 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/UserInAppInitializationFlowParameters.cs +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/UserInAppInitializationFlowParameters.cs @@ -6,7 +6,6 @@ public struct UserInAppInitializationFlowParameters { public bool ShowAuthentication { get; set; } public bool ShowLoading { get; set; } - public bool ReloadRealm { get; set; } public bool FromLogout { get; set; } public World World { get; set; } public Entity PlayerEntity { get; set; } From 3f3b68982fe9254d67ce218c756fa0ff0dc9dbd9 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Tue, 17 Dec 2024 11:49:43 -0300 Subject: [PATCH 06/10] Rollback on condition of `SceneRoomMetaDataSource` --- .../Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs | 3 +-- Explorer/Assets/Scripts/Global/Dynamic/Bootstraper.cs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs b/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs index 73003ee89c..bc6deb18ab 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs @@ -64,7 +64,6 @@ public async UniTask MetaDataAsync(MetaData.Input input, CancellationT : new MetaData(null, input); } - public bool MetadataIsDirty => realmData is { Configured: true, ScenesAreFixed: false } && - characterTransform.Position.IsDirty; + public bool MetadataIsDirty => !realmData.ScenesAreFixed && characterTransform.Position.IsDirty; } } diff --git a/Explorer/Assets/Scripts/Global/Dynamic/Bootstraper.cs b/Explorer/Assets/Scripts/Global/Dynamic/Bootstraper.cs index bf1cc45b1a..bfeb8e6085 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/Bootstraper.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/Bootstraper.cs @@ -266,7 +266,6 @@ await dynamicWorldContainer.UserInAppInAppInitializationFlow.ExecuteAsync( { ShowAuthentication = debugSettings.ShowAuthentication, ShowLoading = debugSettings.ShowLoading, - ReloadRealm = false, FromLogout = false, World = globalWorld.EcsWorld, PlayerEntity = playerEntity, From f93b9a9713aca57089e01e526da5e7b9ae29a4cc Mon Sep 17 00:00:00 2001 From: Fran Colarich <56565104+fcolarich@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:18:28 +0100 Subject: [PATCH 07/10] Fixed issue with PXs entities being removed when changing realm --- Explorer/Assets/Scripts/Global/Dynamic/RealmController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Explorer/Assets/Scripts/Global/Dynamic/RealmController.cs b/Explorer/Assets/Scripts/Global/Dynamic/RealmController.cs index bb40c249bb..a78eee2ebe 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/RealmController.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/RealmController.cs @@ -33,7 +33,7 @@ public class RealmController : IGlobalRealmController // TODO it can be dangerous to clear the realm, instead we may destroy it fully and reconstruct but we will need to // TODO construct player/camera entities again and allocate more memory. Evaluate // Realms + Promises - private static readonly QueryDescription CLEAR_QUERY = new QueryDescription().WithAny(); + private static readonly QueryDescription CLEAR_QUERY = new QueryDescription().WithAny().WithNone(); private readonly List allScenes = new (PoolConstants.SCENES_COUNT); private readonly ServerAbout serverAbout = new (); From 8c21a11811b106daa33bcdb31e248a4aafa141e0 Mon Sep 17 00:00:00 2001 From: Fran Colarich <56565104+fcolarich@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:19:10 +0100 Subject: [PATCH 08/10] Fixed issue with PX scene entity not being properly removed after killing a PX --- Explorer/Assets/DCL/PluginSystem/Utils.meta | 8 ++++++++ .../ECS/SceneLifeCycle/Systems/UnloadSceneSystem.cs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 Explorer/Assets/DCL/PluginSystem/Utils.meta diff --git a/Explorer/Assets/DCL/PluginSystem/Utils.meta b/Explorer/Assets/DCL/PluginSystem/Utils.meta new file mode 100644 index 0000000000..e29a73f077 --- /dev/null +++ b/Explorer/Assets/DCL/PluginSystem/Utils.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6abd0582b91e77c4e8ed0850d71e37c7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Explorer/Assets/Scripts/ECS/SceneLifeCycle/Systems/UnloadSceneSystem.cs b/Explorer/Assets/Scripts/ECS/SceneLifeCycle/Systems/UnloadSceneSystem.cs index 17611a1a7a..e3cea1c96b 100644 --- a/Explorer/Assets/Scripts/ECS/SceneLifeCycle/Systems/UnloadSceneSystem.cs +++ b/Explorer/Assets/Scripts/ECS/SceneLifeCycle/Systems/UnloadSceneSystem.cs @@ -59,7 +59,7 @@ private void UnloadLoadedPortableExperienceScene(in Entity entity, ref SceneDefi { sceneFacade.DisposeAsync().Forget(); scenesCache.RemovePortableExperienceFacade(definitionComponent.IpfsPath.EntityId); - World.Remove(entity); + World.Destroy(entity); } [Query] From 8095b412d654af0458032236f42d34f5c65d0a31 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Wed, 18 Dec 2024 10:40:24 -0300 Subject: [PATCH 09/10] Fix async method --- .../RealUserInAppInitializationFlow.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs index ef1a75cf38..756b291494 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs @@ -136,7 +136,7 @@ public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters paramete loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.AuthenticationScreenShowing); if (parameters.FromLogout) { - await DoLogoutOperations(); + await DoLogoutOperationsAsync(); //Restart the realm and show the authentications screen simultaneously to avoid the "empty space" flicker await UniTask.WhenAll(ShowAuthenticationScreenAsync(ct), realmController.SetRealmAsync( @@ -178,7 +178,7 @@ await UniTask.WhenAll(ShowAuthenticationScreenAsync(ct), loadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.Completed); } - private async UniTask DoLogoutOperations() + private async UniTask DoLogoutOperationsAsync() { portableExperiencesController.UnloadAllPortableExperiences(); realmNavigator.RemoveCameraSamplingData(); From e6374984646117303fad5a86ded3da34ca0d1b9c Mon Sep 17 00:00:00 2001 From: Fran Colarich <56565104+fcolarich@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:14:32 +0100 Subject: [PATCH 10/10] Unified mordor constants and moved the file to a better location --- Explorer/Assets/DCL/PluginSystem/Utils.meta | 8 -------- .../Assets/DCL/PluginSystem/Utils/MordorConstants.cs | 9 --------- .../AvatarAttach/Systems/AvatarAttachHandlerSystem.cs | 9 +-------- Explorer/Assets/DCL/Utilities/MordorConstants.cs | 8 ++++++++ .../Utils => Utilities}/MordorConstants.cs.meta | 0 5 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 Explorer/Assets/DCL/PluginSystem/Utils.meta delete mode 100644 Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs create mode 100644 Explorer/Assets/DCL/Utilities/MordorConstants.cs rename Explorer/Assets/DCL/{PluginSystem/Utils => Utilities}/MordorConstants.cs.meta (100%) diff --git a/Explorer/Assets/DCL/PluginSystem/Utils.meta b/Explorer/Assets/DCL/PluginSystem/Utils.meta deleted file mode 100644 index e29a73f077..0000000000 --- a/Explorer/Assets/DCL/PluginSystem/Utils.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6abd0582b91e77c4e8ed0850d71e37c7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs b/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs deleted file mode 100644 index 6d71332b18..0000000000 --- a/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class MordorConstants -{ - public static Vector3 PLAYER_MORDOR_POSITION = new(15000, 0, 15000); - public static Vector3 SCENE_MORDOR_POSITION = new(0, -10000, 0); -} \ No newline at end of file diff --git a/Explorer/Assets/DCL/SDKComponents/AvatarAttach/Systems/AvatarAttachHandlerSystem.cs b/Explorer/Assets/DCL/SDKComponents/AvatarAttach/Systems/AvatarAttachHandlerSystem.cs index 9f55d7d360..272871e4f6 100644 --- a/Explorer/Assets/DCL/SDKComponents/AvatarAttach/Systems/AvatarAttachHandlerSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/AvatarAttach/Systems/AvatarAttachHandlerSystem.cs @@ -12,8 +12,6 @@ using ECS.LifeCycle.Components; using ECS.Unity.Transforms.Components; using SceneRunner.Scene; -using System; -using UnityEngine; namespace DCL.SDKComponents.AvatarAttach.Systems { @@ -21,11 +19,6 @@ namespace DCL.SDKComponents.AvatarAttach.Systems [LogCategory(ReportCategory.AVATAR_ATTACH)] public partial class AvatarAttachHandlerSystem : BaseUnityLoopSystem, IFinalizeWorldSystem { - /// - /// Integrated from the previous implementation - /// - private static readonly Vector3 MORDOR = Vector3.one * 8000; - private static readonly QueryDescription ENTITY_DESTRUCTION_QUERY = new QueryDescription().WithAll(); private static readonly QueryDescription COMPONENT_REMOVAL_QUERY = new QueryDescription().WithAll().WithNone(); private readonly ObjectProxy mainPlayerAvatarBaseProxy; @@ -54,7 +47,7 @@ protected override void Update(float t) private void HideDetached(ref TransformComponent transformComponent) { if (!sceneStateProvider.IsCurrent) return; - transformComponent.Apply(MORDOR); + transformComponent.Apply(MordorConstants.AVATAR_ATTACH_MORDOR_POSITION); } [Query] diff --git a/Explorer/Assets/DCL/Utilities/MordorConstants.cs b/Explorer/Assets/DCL/Utilities/MordorConstants.cs new file mode 100644 index 0000000000..75242e88c3 --- /dev/null +++ b/Explorer/Assets/DCL/Utilities/MordorConstants.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +public static class MordorConstants +{ + public static readonly Vector3 PLAYER_MORDOR_POSITION = new(15000, 0, 15000); + public static readonly Vector3 SCENE_MORDOR_POSITION = new(0, -10000, 0); + public static readonly Vector3 AVATAR_ATTACH_MORDOR_POSITION = new(8000,0,0); +} diff --git a/Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs.meta b/Explorer/Assets/DCL/Utilities/MordorConstants.cs.meta similarity index 100% rename from Explorer/Assets/DCL/PluginSystem/Utils/MordorConstants.cs.meta rename to Explorer/Assets/DCL/Utilities/MordorConstants.cs.meta