Ejemplo n.º 1
0
    private void LoadMod(string path)
    {
        Debug.Log(string.Format("*****************Start Load mod {0}********************", path));

        CSVManager.Load(path);

        CSGenerator.csharpLoader = csharpLoader;
        CSGenerator.path         = path;

        List <string> sourceCodes = new List <string>();

        sourceCodes.Add(CSGenerator.MakeOffices());
        sourceCodes.Add(CSGenerator.MakeFactions());

        sourceCodes.AddRange(ReadAllCSInPath(path + "/name"));
        sourceCodes.AddRange(ReadAllCSInPath(path + "/flag"));
        sourceCodes.AddRange(ReadAllCSInPath(path + "/decision"));

        sourceCodes.Add(CSGenerator.MakeFlags());
        sourceCodes.Add(CSGenerator.MakeDecisions(sourceCodes.ToArray()));

        sourceCodes.AddRange(ReadAllCSInPath(path + "/event"));

        CSharpCompiler.ScriptBundleLoader.IScriptBundle bd = csharpLoader.LoadAndWatchSourceBundle(sourceCodes.ToArray());

        Type[] Types = bd.assembly.GetTypes();

        DynastyName.Load(Types);
        YearName.Load(Types);
        PersonName.Load(Types);
        EventManager.Load(Types);


        var qurey = (from x in Types
                     where x.Name == "CountryFlags"
                     select x).Single();

        System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(qurey.TypeHandle);

        qurey = (from x in Types
                 where x.Name == "Decisions"
                 select x).Single();
        System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(qurey.TypeHandle);

        qurey = (from x in Types
                 where x.Name == "Offices"
                 select x).Single();
        System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(qurey.TypeHandle);

        qurey = (from x in Types
                 where x.Name == "Factions"
                 select x).Single();
        System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(qurey.TypeHandle);

        Debug.Log(string.Format("******************End Load mod {0}********************", path));
    }
Ejemplo n.º 2
0
        public Mod(string name, string path)
        {
            this.name = name;
            this.path = path;

            languages   = Language.Load(path + "/language");
            initSelects = InitSelect.Load(name, path + "/init_select");
            personName  = PersonName.Load(path + "/person_name");
            parties     = Party.Load(name, path + "/party");
            departs     = Depart.Load(name, path + "/depart");
            pops        = Pop.Load(name, path + "/pop");
            common      = Common.Load(name, path + "/common");
            events      = GEvent.Load(name, path + "/event");
            warns       = Warn.Load(name, path + "/warn");
            risks       = Risk.Load(name, path + "/risk");
            adjusts     = Adjust.Load(name, path + "/adjust");
        }