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 Transform Canvas;
private void Start()
void LoadAllUIPackages()
{
var contentProvider = ContentProvider.Get();
var uiPackageLocation = Path.Combine(Filesystem.PathProvider.GetDataPathForProduct(ProductFlags.BaseGame), "Res/UI/ui.package");
contentProvider.AddPackage(uiPackageLocation);
uiPackageLocation = Path.Combine(Filesystem.PathProvider.GetDataPathForProduct(ProductFlags.Mansion), "Res/UI/ui.package");
contentProvider.AddPackage(uiPackageLocation);
var relativePackagePath = "Res/UI/ui.package";
var products = EPManager.Get().GetInstalledProducts();
foreach(var product in products)
{
var fullPath = Path.Combine(Filesystem.PathProvider.GetDataPathForProduct(product), relativePackagePath);
contentProvider.AddPackage(fullPath);
}
}
private void Start()
{
LoadAllUIPackages();
var contentProvider = ContentProvider.Get();
// Main Menu
//var key = new ResourceKey(0x49001017, 0xA99D8A11, TypeIDs.UI);
var key = new ResourceKey(0x49001017, 0xA99D8A11, TypeIDs.UI);
// 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 mainMenuUILayout = contentProvider.GetAsset<UILayout>(key);
mainMenuUILayout.Instantiate(Canvas);