Beispiel #1
0
        private void GenScriptableObject(List <FieldInfo> list, ScriptComponentLoader scrLoader, Component comp)
        {
            CodeGener gener = new CodeGener("ResetCore.ReAssembly.Data", GetScrObjName(comp));

            gener
            .AddImport("UnityEngine")
            .AddBaseType("ScriptableObject");
            foreach (FieldInfo info in list)
            {
                gener.AddMemberField(info.FieldType, info.Name, null, System.CodeDom.MemberAttributes.Public);
            }
            gener.GenCSharp(DllManagerConst.scriptableCSOutputPath);
        }
Beispiel #2
0
        /// <summary>
        /// 生成Bundle列表类
        /// </summary>
        private void GenBundleList()
        {
            CodeGener gener = new CodeGener("ResetCore.NAsset", "Bundles");

            foreach (var kvp in assetBundleDict)
            {
                string name = kvp.Key;
                if (name == "none")
                {
                    continue;
                }
                string defName = name.Replace(" ", "_").Replace("/", "_");
                gener.AddMemberField(typeof(string), defName, (field) =>
                {
                    CodeVariableReferenceExpression fieldExpression = new CodeVariableReferenceExpression("\"" + name + "\"");
                    field.InitExpression = fieldExpression;
                }, MemberAttributes.Static | MemberAttributes.Public);
            }
            gener.GenCSharp(Path.Combine(Application.dataPath, "AssetBundle/Loader/temp"));
        }
Beispiel #3
0
        /// <summary>
        /// 生成资源列表类
        /// </summary>
        private void GenRList()
        {
            CodeGener gener = new CodeGener("ResetCore.NAsset", "R");

            foreach (var kvp in assetBundleDict)
            {
                if (kvp.Key == "none")
                {
                    continue;
                }
                foreach (var path in kvp.Value)
                {
                    string name    = kvp.Key + "_" + FileEx.GetFileNameWithoutExtention(path);
                    string defName = name.Replace(" ", "_").Replace("/", "_");
                    string content = kvp.Key + "###" + FileEx.GetFileNameWithoutExtention(path);
                    gener.AddMemberField(typeof(string), defName, (field) =>
                    {
                        CodeVariableReferenceExpression fieldExpression = new CodeVariableReferenceExpression("\"" + content + "\"");
                        field.InitExpression = fieldExpression;
                    }, MemberAttributes.Static | MemberAttributes.Public);
                }
            }
            gener.GenCSharp(Path.Combine(Application.dataPath, "AssetBundle/Loader/temp"));
        }