Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: moved environment selection to EntryPoint #3183

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Explorer/Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ MonoBehaviour:
useRemoteAssetsBundles: 1
isolateSceneCommunication: 0
portableExperiencesEnsToLoadAtGameStart: []
decentralandEnvironment: 0
debugViewsCatalog:
<Widget>k__BackingField: {fileID: 9197481963319205126, guid: f3bf08b2b62097d4aa0574f7bafa4a86, type: 3}
<ControlContainer>k__BackingField: {fileID: 9197481963319205126, guid: 6da3ff28c8a87e0428fa07019c15fa2f, type: 3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static async UniTask<BootstrapContainer> CreateAsync(
ICompressShaders compressShaders,
IRealmUrls realmUrls,
World world,
DecentralandEnvironment decentralandEnvironment,
CancellationToken ct)
{
var browser = new UnityAppWebBrowser(decentralandUrlsSource);
Expand All @@ -98,7 +99,7 @@ public static async UniTask<BootstrapContainer> CreateAsync(
ApplicationParametersParser = applicationParametersParser,
DebugSettings = debugSettings,
WorldVolumeMacBus = new WorldVolumeMacBus(),
Environment = sceneLoaderSettings.DecentralandEnvironment
Environment = decentralandEnvironment
};

await bootstrapContainer.InitializeContainerAsync<BootstrapContainer, BootstrapSettings>(settingsContainer, ct, async container =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,8 @@ namespace Global.Dynamic
[CreateAssetMenu(fileName = "DynamicSceneLoaderSettings", menuName = "DCL/Various/Dynamic Scene LoaderSettings")]
public class DynamicSceneLoaderSettings : ScriptableObject
{
[field: SerializeField] public DecentralandEnvironment DecentralandEnvironment { get; private set; }
[field: SerializeField] public List<string> Realms { get; private set; }
[field: SerializeField] public List<string> Web3WhitelistMethods { get; private set; }

public void ApplyConfig(IAppArgs applicationParametersParser)
{
if (applicationParametersParser.TryGetValue(AppArgsFlags.ENVIRONMENT, out string? environment))
ParseEnvironment(environment!);
}

private void ParseEnvironment(string environment)
{
if (Enum.TryParse(environment, true, out DecentralandEnvironment env))
DecentralandEnvironment = env;
}
}
}
22 changes: 19 additions & 3 deletions Explorer/Assets/Scripts/Global/Dynamic/MainSceneLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using DCL.DebugUtilities;
using DCL.Diagnostics;
using DCL.Input.Component;
using DCL.Multiplayer.Connections.DecentralandUrls;
using DCL.Optimization.PerformanceBudgeting;
using DCL.Platforms;
using DCL.PluginSystem;
Expand All @@ -18,7 +19,6 @@
using DCL.Utilities.Extensions;
using DCL.Web3.Accounts.Factory;
using DCL.Web3.Identities;
using DCL.WebRequests;
using DCL.WebRequests.Analytics;
using Global.AppArgs;
using Global.Dynamic.RealmUrl;
Expand All @@ -42,6 +42,9 @@ public class MainSceneLoader : MonoBehaviour, ICoroutineRunner
[Header("Startup Config")] [SerializeField]
private RealmLaunchSettings launchSettings = null!;

[Space]
[SerializeField] private DecentralandEnvironment decentralandEnvironment;

[Space]
[SerializeField] private DebugViewsCatalog debugViewsCatalog = new ();

Expand Down Expand Up @@ -100,6 +103,18 @@ private void OnDestroy()
ReportHub.Log(ReportCategory.ENGINE, "OnDestroy successfully finished");
}

public void ApplyConfig(IAppArgs applicationParametersParser)
{
if (applicationParametersParser.TryGetValue(AppArgsFlags.ENVIRONMENT, out string? environment))
ParseEnvironment(environment!);
}

private void ParseEnvironment(string environment)
{
if (Enum.TryParse(environment, true, out DecentralandEnvironment env))
decentralandEnvironment = env;
}

private async UniTask InitializeFlowAsync(CancellationToken ct)
{
IAppArgs applicationParametersParser = new ApplicationParametersParser(
Expand Down Expand Up @@ -129,13 +144,13 @@ ITexturesFuse TextureFuseFactory() =>

ISystemMemoryCap memoryCap = new SystemMemoryCap(MemoryCapMode.MAX_SYSTEM_MEMORY); // we use max memory on the loading screen

settings.ApplyConfig(applicationParametersParser);
ApplyConfig(applicationParametersParser);
launchSettings.ApplyConfig(applicationParametersParser);

World world = World.Create();

var splashScreen = new SplashScreen(splashScreenAnimation, splashRoot, debugSettings.ShowSplash, splashScreenText);
var decentralandUrlsSource = new DecentralandUrlsSource(settings.DecentralandEnvironment, launchSettings.IsLocalSceneDevelopmentRealm);
var decentralandUrlsSource = new DecentralandUrlsSource(decentralandEnvironment, launchSettings.IsLocalSceneDevelopmentRealm);

var texturesFuse = TextureFuseFactory();

Expand All @@ -161,6 +176,7 @@ ITexturesFuse TextureFuseFactory() =>
.WithLog("Load Guard"),
realmUrls,
world,
decentralandEnvironment,
destroyCancellationToken
);

Expand Down
Loading