Example #1
0
        public StarterCollection(IRtdxRom rom, ILuaGenerator luaGenerator, ICSharpGenerator cSharpGenerator)
        {
            this.rom             = rom ?? throw new ArgumentNullException(nameof(rom));
            this.luaGenerator    = luaGenerator ?? throw new ArgumentNullException(nameof(luaGenerator));
            this.cSharpGenerator = cSharpGenerator ?? throw new ArgumentNullException(nameof(cSharpGenerator));

            this.Starters         = LoadStarters();
            this.OriginalStarters = Starters.Select(s => s.Clone()).ToArray();
        }
Example #2
0
        internal static IServiceProvider CreateRtdxRomServiceProvider(IRtdxRom rom)
        {
            IServiceProvider?serviceProvider = null;
            var services = new ServiceCollection();

            services
            .AddSingleton(_ => serviceProvider ?? throw new Exception("Failed to register IServiceProvider within itself"))
            .AddSingleton <IRtdxRom>(rom)
            .AddSingleton <ICommonStrings>(_ => rom.GetCommonStrings())
            .AddSingleton <ILuaGenerator, LuaGenerator>()
            .AddSingleton <ICSharpGenerator, CSharpGenerator>()
            .AddCustomScriptExpressionGeneratorsAsSingleton();

            serviceProvider = services.BuildServiceProvider();

            return(serviceProvider);
        }
Example #3
0
 public CustomScriptHost(IRtdxRom rom)
 {
     Globals             = new ScriptContext <IRtdxRom>(rom);
     CSharpScriptImports = new List <string>();
 }
Example #4
0
 private void OnEnable()
 {
     _rom = SkyEditorHelpers.GetRom();
 }
Example #5
0
        public DungeonCollection(IRtdxRom rom)
        {
            this.rom = rom ?? throw new ArgumentNullException(nameof(rom));

            this.Dungeons = LoadDungeons();
        }
Example #6
0
 public static void SaveRom(IRtdxRom rom)
 {
     rom.Save(ConfigManager.BuildDir, PhysicalFileSystem.Instance);
 }