Example #1
0
    public static string MakeDecisions(string[] dependCS)
    {
        List <string> SourceCodes = new List <string>(dependCS);

        CSharpCompiler.ScriptBundleLoader.IScriptBundle bd = csharpLoader.LoadAndWatchSourceBundle(SourceCodes);

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

        Type[] FlagTypes = types.Where(x => x.BaseType.Name == "DefDecision").ToArray();

        var fields = new List <Tuple <string, Type, Type, List <object>, CodeAttributeDeclaration> >();

        foreach (var type in FlagTypes)
        {
            fields.Add(new Tuple <string, Type, Type, List <object>, CodeAttributeDeclaration>(type.Name, type, type, null, null));
        }

        CodeDomGen sourceCodeCreater = new CodeDomGen("Decisions", fields);
        string     source            = sourceCodeCreater.Create();

        Debug.Log(source);

        Debug.Log("Load decision count:" + FlagTypes.Count());
        return(source);
    }