GenerateClassWraps() private méthode

private GenerateClassWraps ( ) : void
Résultat void
Exemple #1
0
        public static void Bsn_All()
        {
            Debug.Log("NBsnEditor.Menu Bsn_All()");

            AssetDatabase.Refresh();

            ToLuaMenu.beAutoGen = true;
            ToLuaMenu.ClearLuaWraps();
            ToLuaMenu.ClearBaseTypeLuaWrap();
            AssetDatabase.Refresh();

            var staticClassTypes_back = CustomSettings.staticClassTypes;
            var staticClassTypes_new  = new List <Type>();

            staticClassTypes_new.AddRange(staticClassTypes_back);
            // staticClassTypes_new.AddRange(NBsn.Config.m_reg2LuaStaticType);

            HashSet <Type> set = new HashSet <Type>();
            var            customTypeList_back = CustomSettings.customTypeList;
            List <Type>    reg2LuaType         = new List <Type>();

            // reg2LuaType.AddRange(NBsn.Config.m_reg2LuaType);
            GetUnityEngine(ref reg2LuaType);
            GetCustom(ref reg2LuaType);
            GetUGUI(ref reg2LuaType);
            for (int i = 0; i < reg2LuaType.Count; i++)
            {
                set.Add(reg2LuaType[i]);
            }
            for (int i = 0; i < customTypeList_back.Length; i++)
            {
                set.Add(reg2LuaType[i]);
            }
            foreach (var item in staticClassTypes_new)
            {
                set.Add(item);
            }
            foreach (var item in CustomSettings.dynamicList)
            {
                set.Add(item);
            }
            foreach (var item in ms_reg2LuaType)
            {
                set.Add(item);
            }
            foreach (var item in ToLuaMenu.dropType)
            {
                set.Remove(item);
            }
            foreach (var item in ToLuaMenu.baseType)
            {
                set.Remove(item);
            }

            var temp = new List <BindType>();

            foreach (var t in set)
            {
                if (t.GetCustomAttributes(typeof(ObsoleteAttribute), false).Length > 0)   // 废弃类型
                {
                    continue;
                }
                if (t.GetCustomAttributes(typeof(NBsn.NotReg2LuaAttribute), false).Length > 0)   // 不需要注册的类型
                {
                    continue;
                }
                temp.Add(new BindType(t));
            }
            var customTypeList_new = new BindType[temp.Count];

            temp.CopyTo(customTypeList_new);

            CustomSettings.customTypeList   = customTypeList_new;
            CustomSettings.staticClassTypes = staticClassTypes_new;

            ToLuaMenu.GenBaseTypeLuaWrap();
            ToLuaMenu.GenLuaDelegates();
            ToLuaMenu.GenerateClassWraps();
            ToLuaMenu.GenLuaBinder();
            ToLuaMenu.beAutoGen = false;

            CustomSettings.customTypeList   = customTypeList_back;
            CustomSettings.staticClassTypes = staticClassTypes_back;
        }