Пример #1
0
        static AssetLoadTests()
        {
            var disk    = new MockFileSystem(true);
            var baseDir = ConfigUtil.FindBasePath(disk);

            GeneralConfig = AssetSystem.LoadGeneralConfig(baseDir, disk, JsonUtil);
            CoreConfig    = new CoreConfig();
            GameConfig    = AssetSystem.LoadGameConfig(baseDir, disk, JsonUtil);
            Settings      = new GeneralSettings
            {
                ActiveMods = { "Base" },
                Language   = Language.English
            };
        }
Пример #2
0
        IModApplier BuildApplier(string mod)
        {
            var generalConfig = AssetSystem.LoadGeneralConfig(_baseDir, _disk, JsonUtil);
            var coreConfig    = new CoreConfig();
            var gameConfig    = AssetSystem.LoadGameConfig(_baseDir, _disk, JsonUtil);
            var settings      = new GeneralSettings
            {
                ActiveMods = { mod },
                Language   = Language.English
            };
            var exchange = AssetSystem.Setup(_disk, JsonUtil, generalConfig, settings, coreConfig, gameConfig);

            return(exchange.Resolve <IModApplier>());
        }
Пример #3
0
    static (MockFileSystem disk, string baseDir, GeneralConfig generalConfig, AssetMapping mapping) SetupAssets(IJsonUtil jsonUtil)
    {
        Event.AddEventsFromAssembly(typeof(ActionEvent).Assembly);
        var mapping         = new AssetMapping();
        var disk            = new MockFileSystem(true);
        var baseDir         = ConfigUtil.FindBasePath(disk);
        var assetConfigPath = Path.Combine(baseDir, "mods", "Base", "assets.json");
        var assetConfig     = AssetConfig.Load(assetConfigPath, mapping, disk, jsonUtil);
        var generalConfig   = AssetSystem.LoadGeneralConfig(baseDir, disk, jsonUtil);

        foreach (var assetType in assetConfig.IdTypes.Values)
        {
            var enumType = Type.GetType(assetType.EnumType);
            if (enumType == null)
            {
                throw new InvalidOperationException(
                          $"Could not load enum type \"{assetType.EnumType}\" defined in \"{assetConfigPath}\"");
            }

            mapping.RegisterAssetType(assetType.EnumType, assetType.AssetType);
        }

        return(disk, baseDir, generalConfig, mapping);
    }