Load all UI packages in UILayoutTest

This commit is contained in:
Nahuel Rocchetti 2023-05-28 14:52:39 -03:00
parent 3037c33c7e
commit bb797ad81c

View file

@ -16,17 +16,25 @@ namespace OpenTS2.Engine.Tests
public class UILayoutTest : MonoBehaviour public class UILayoutTest : MonoBehaviour
{ {
public Transform Canvas; public Transform Canvas;
private void Start() void LoadAllUIPackages()
{ {
var contentProvider = ContentProvider.Get(); var contentProvider = ContentProvider.Get();
var uiPackageLocation = Path.Combine(Filesystem.PathProvider.GetDataPathForProduct(ProductFlags.BaseGame), "Res/UI/ui.package"); var relativePackagePath = "Res/UI/ui.package";
contentProvider.AddPackage(uiPackageLocation); var products = EPManager.Get().GetInstalledProducts();
uiPackageLocation = Path.Combine(Filesystem.PathProvider.GetDataPathForProduct(ProductFlags.Mansion), "Res/UI/ui.package"); foreach(var product in products)
contentProvider.AddPackage(uiPackageLocation); {
var fullPath = Path.Combine(Filesystem.PathProvider.GetDataPathForProduct(product), relativePackagePath);
contentProvider.AddPackage(fullPath);
}
}
private void Start()
{
LoadAllUIPackages();
var contentProvider = ContentProvider.Get();
// Main Menu // Main Menu
//var key = new ResourceKey(0x49001017, 0xA99D8A11, TypeIDs.UI); var key = new ResourceKey(0x49001017, 0xA99D8A11, TypeIDs.UI);
// Neighborhood View // Neighborhood View
var key = new ResourceKey(0x49000000, 0xA99D8A11, TypeIDs.UI); //var key = new ResourceKey(0x49000000, 0xA99D8A11, TypeIDs.UI);
//var key = new ResourceKey(0x49001010, 0xA99D8A11, TypeIDs.UI); //var key = new ResourceKey(0x49001010, 0xA99D8A11, TypeIDs.UI);
var mainMenuUILayout = contentProvider.GetAsset<UILayout>(key); var mainMenuUILayout = contentProvider.GetAsset<UILayout>(key);
mainMenuUILayout.Instantiate(Canvas); mainMenuUILayout.Instantiate(Canvas);