Skip to content
Permalink
Browse files

[Assets] Temporary fixes for root assets and default scene opening

  • Loading branch information
xen2 committed Oct 3, 2018
1 parent 49240a8 commit e132f1b6f47e91a92bb36fb4ef6fe575d52e5ab0
@@ -186,7 +186,8 @@ public int CompareTo(PackageViewModel other)
public bool IsInScope(AssetViewModel asset)
{
var assetPackage = asset.Directory.Package;
return assetPackage == this || Dependencies.Content.Any(x => x.Target == assetPackage);
// Note: Would be better to switch to Dependencies view model as soon as we have FlattenedDependencies in those
return assetPackage == this || Package.Container.FlattenedDependencies.Any(x => x.Package == assetPackage.Package);
}

/// <summary>
@@ -324,6 +324,29 @@ private async void OpenDefaultScene(SessionViewModel session)
return;

var gameSettingsAsset = startupPackage.Assets.FirstOrDefault(x => x.Url == Assets.GameSettingsAsset.GameSettingsLocation);
if (gameSettingsAsset == null)
{
// Scan dependencies for game settings
// TODO: Scanning order? (direct dependencies first)
// TODO: Switch to using startupPackage.Dependencies view model instead
foreach (var dependency in startupPackage.PackageContainer.FlattenedDependencies)
{
if (dependency.Package == null)
continue;

var dependencyPackageViewModel = session.AllPackages.First(x => x.Package == dependency.Package);
if (dependencyPackageViewModel == null)
continue;

gameSettingsAsset = dependencyPackageViewModel.Assets.FirstOrDefault(x => x.Url == Assets.GameSettingsAsset.GameSettingsLocation);
if (gameSettingsAsset != null)
break;
}
}

if (gameSettingsAsset == null)
return;

var defaultScene = ((Assets.GameSettingsAsset)gameSettingsAsset?.Asset)?.DefaultScene;
if (defaultScene == null)
return;

0 comments on commit e132f1b

Please sign in to comment.
You can’t perform that action at this time.