Example #1
0
 public override void Setup(IXmlConfigurator configurator)
 {
     Mdp = new MdpClient();
     configurator.RegisterAction("Config", (_, node) => Mdp.Configure(node));
     configurator.RegisterAction("AddFiles", (_, node) => Mdp.AddFiles(node));
     configurator.RegisterAction("MdpVerify", (_, node) => Mdp.Run(ModLoader.CurrentLoader.Configuration.ParentDirectory));
 }
        protected void IncludeXml(IXmlConfigurator configurator, XmlNode node)
        {
            string path = node.Attributes["src"]?.Value;

            if (path is null)
            {
                return;
            }
            ExecuteFromPath(path);
        }
Example #3
0
 public override void Setup(IXmlConfigurator configurator)
 {
     configurator.RegisterAction("Asset", LoadAsset);
     configurator.RegisterAction("Texture", LoadTexture);
     configurator.RegisterAction("Assembly", LoadAssembly);
     configurator.RegisterAction("Model", LoadModel);
     configurator.RegisterAction("Audio", LoadAudio);
     configurator.RegisterAction("Text", LoadText);
     configurator.RegisterAction("BinaryData", LoadData);
     configurator.RegisterAction("Bundle", LoadBundle);
     configurator.RegisterAction("RequireAsset", RequireAsset);
     configurator.RegisterAction("CreateAssetDatabase", CreateAssetDatabase);
 }
Example #4
0
        private void RequireAsset(IXmlConfigurator _, XmlNode node)
        {
            string path = node.Attributes["path"]?.Value;

            if (path is null)
            {
                throw new System.ArgumentException($"Invalid asset path [Empty]");
            }
            string[] parts = path.Split(':');
            if (parts.Length != 2)
            {
                throw new System.ArgumentException($"Invalid asset path \"{path}\". Must be in the format \"ModName:AssetName\"");
            }
        }
Example #5
0
        private void LoadBundle(IXmlConfigurator _, XmlNode node)
        {
            // TODO: reimplement this, create better exceptions
            string path = node.Attributes["src"]?.Value;
            string name = node.Attributes["name"]?.Value;

            if (path is null)
            {
                Debug.Fail($"tried to load a data file, but no path was given");
                return;
            }
            if (name is null)
            {
                Debug.Fail($"tried to load a data file, but no name was given");
                return;
            }
            UnityEngine.AssetBundle data = UnityEngine.AssetBundle.LoadFromFile(Path.Combine(ModLoader.CurrentLoader.CurrentMod.Directory, path));
            GetModAssets(ModLoader.CurrentLoader.CurrentMod.Name).AddResource(name, data);
        }
Example #6
0
        private void LoadAssembly(IXmlConfigurator _, XmlNode node)
        {
            // TODO: reimplement this, create better exceptions
            string path = node.Attributes["src"]?.Value;
            string name = node.Attributes["name"]?.Value;

            if (path is null)
            {
                Debug.Fail($"tried to load an assembly, but no path was given");
                return;
            }
            if (name is null)
            {
                Debug.Fail($"tried to load an assembly, but no name was given");
                return;
            }
            Assembly assembly = Assembly.LoadFrom(Path.Combine(ModLoader.CurrentLoader.CurrentMod.Directory, path));

            GetModAssets(ModLoader.CurrentLoader.CurrentMod.Name).AddResource(name, assembly);
        }
Example #7
0
 private void LoadAudio(IXmlConfigurator _, XmlNode node)
 {
 }
Example #8
0
 private void LoadModel(IXmlConfigurator _, XmlNode node)
 {
 }
Example #9
0
 private void LoadTexture(IXmlConfigurator _, XmlNode node)
 {
 }
Example #10
0
 private void LoadAsset(IXmlConfigurator _, XmlNode node)
 {
 }
Example #11
0
 private void CreateAssetDatabase(IXmlConfigurator _, XmlNode __)
 {
     assets.Add(ModLoader.CurrentLoader.CurrentMod.Name, new ResourceDatabase());
 }
Example #12
0
 public override void Setup(IXmlConfigurator configurator)
 {
     Configurator = configurator;
     configurator.RegisterAction("AddModule", (_, node) => AddModuleFromXml(node));
 }
Example #13
0
 public abstract void Setup(IXmlConfigurator configurator);