ClearLuaWraps() private méthode

private ClearLuaWraps ( ) : void
Résultat void
        protected override void PreProcess()
        {
            Module.DisplayProgressBar("Clear Wrap Files...", 0, true);
            ToLuaMenu.ClearLuaWraps();
            Module.DisplayProgressBar("Clear Lua Files...", 0.2f, true);
            LuaScriptsPreProcessor.Clean();

            EBPUtility.RefreshAssets();
        }
Exemple #2
0
        public void Prepare()
        {
            try
            {
                Module.StartLog();
                Module.LogHead("Start Prepare", 1);

                Module.DisplayProgressBar("Clear Lua Wraps", 0, true);
                ToLuaMenu.ClearLuaWraps();

                EBPUtility.RefreshAssets();

                Module.DisplayProgressBar("Preparing BuildOptions", 0.2f, true);
                PrepareBuildOptions();

                Module.DisplayProgressBar("Start DownloadConfigs", 0.22f, true);
                DownLoadConfigs(0.22f, 0.5f);

                Module.DisplayProgressBar("Creating Building Configs Class File", 0.5f, true);
                CreateBuildingConfigsClassFile();

                Module.DisplayProgressBar("Applying PlayerSettings", 0.55f, true);
                ApplyPlayerSettings(BuildPlayerOptions.target);

                if (CommonModule.CommonConfig.IsBatchMode)
                {
                    Module.DisplayProgressBar("Start Copy Directories", 0.6f, true);
                    CopyAllDirectories(BuildPlayerOptions.target, Path.Combine(CommonModule.CommonConfig.CurrentLogFolderPath, copyFileLogName));

                    Module.DisplayProgressBar("Applying Scripting Defines", 0.95f, true);
                    ApplyScriptDefines(BuildPlayerOptions.target);
                }
                EBPUtility.RefreshAssets();
            }
            catch (Exception e)
            {
                var state = Module.ModuleStateConfig.Json;
                state.ErrorMessage         = e.Message;
                state.DetailedErrorMessage = e.ToString();
                if (!string.IsNullOrEmpty(Module.ModuleStateConfig.JsonPath))
                {
                    Module.ModuleStateConfig.Save();
                }
                Module.Log(state.DetailedErrorMessage);
                throw new EBPException(e.Message, e);
            }
            finally
            {
                Module.LogHead("End Prepare", 1);
                Module.EndLog();
                EditorUtility.ClearProgressBar();
            }
        }
Exemple #3
0
        protected override void Finally()
        {
            iOSBuildPostProcessor.DisableOnce = false;

            if (CommonModule.CommonConfig.IsBatchMode)
            {
                //还原宏定义
                Module.DisplayProgressBar("Revert Scripting Defines", 0f, true);
                ApplyScriptDefines(EditorUserBuildSettings.activeBuildTarget, true);

                //还原被拷贝覆盖的文件
                Module.DisplayProgressBar("Revert Copied Files", 0f, true);
                string copyFileLogPath = Path.Combine(CommonModule.CommonConfig.CurrentLogFolderPath, copyFileLogName);
                if (File.Exists(copyFileLogPath))
                {
                    RevertAllCopiedFiles(File.ReadAllLines(copyFileLogPath), Path.Combine(CommonModule.CommonConfig.CurrentLogFolderPath, "RevertFiles.log"));
                }

                //清除Wrap
                ToLuaMenu.ClearLuaWraps();
            }

            EBPUtility.RefreshAssets();
        }
Exemple #4
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;
        }
        public void OnGUI()
        {
            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

            if (creatingNewConfig == true && GUI.GetNameOfFocusedControl() != "InputField1")
            {
                creatingNewConfig = false;
            }
            //Root
            GUILayout.FlexibleSpace();
            EBPEditorGUILayout.RootSettingLine(PlayerBuilder.G.Module, ChangeRootPath);
            GUILayout.FlexibleSpace();

            //SVN Update
            EditorGUILayout.BeginHorizontal();
            FrontIndicator(currentStep == Step.SVNUpdate, false, G.Module.SVNUpdateRunner.errorMessage);
            G.Module.SVNUpdateRunner.IsPartOfPipeline = GUILayout.Toggle(G.Module.SVNUpdateRunner.IsPartOfPipeline, "SVN Update", GUILayout.Width(200)) && G.Module.SVNUpdateRunner.Available;
            SVNInfo();
            if (GUILayout.Button(refreshIcon, miniButtonOptions))
            {
                RunSVNCheckProcess();
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            //AssetPreprocessor
            EditorGUILayout.BeginHorizontal();
            FrontIndicator(currentStep == Step.PreprocessAssets, G.Module.AssetPreprocessorModule.ModuleStateConfig.Json.Applying,
                           G.Module.AssetPreprocessorModule.ModuleStateConfig.Json.ErrorMessage);
            G.Module.AssetPreprocessorModule.ModuleStateConfig.Json.IsPartOfPipeline = EditorGUILayout.BeginToggleGroup(
                assetPreprocessorContent, G.Module.AssetPreprocessorModule.ModuleStateConfig.Json.IsPartOfPipeline);

            EditorGUILayout.BeginHorizontal();
            int index_new = EditorGUILayout.Popup(assetPreprocessorUserConfigSelectedIndex, assetPreprocessorUserConfigNames, dropdownOptions);

            if (assetPreprocessorUserConfigSelectedIndex != index_new)
            {
                assetPreprocessorUserConfigSelectedIndex = index_new;
                G.Module.AssetPreprocessorModule.ModuleStateConfig.Json.CurrentUserConfigName = assetPreprocessorUserConfigNames[index_new] + ".json";
                G.Module.AssetPreprocessorModule.LoadUserConfig();
                return;
            }
            if (GUILayout.Button(settingGUIContent, miniButtonOptions))
            {
                AssetPreprocessor.G.OverrideCurrentUserConfigName = G.Module.AssetPreprocessorModule.ModuleStateConfig.Json.CurrentUserConfigName;
                if (AssetPreprocessor.G.g == null)
                {
                    EditorWindow.GetWindow <AssetPreprocessor.Editor.AssetPreprocessorWindow>();
                    AssetPreprocessor.G.g.OnChangeCurrentUserConfig += Action_AssetPreprocessor_OnChangeCurrentConfig;
                    AssetPreprocessor.G.g.OnChangeConfigList        += Action_OnChangeConfigList;
                }
                else
                {
                    EditorWindow.GetWindow <AssetPreprocessor.Editor.AssetPreprocessorWindow>();
                }
                return;
            }
            GUILayout.Space(10);
            GUILayout.Label(G.Module.AssetPreprocessorModule.ModuleStateConfig.Json.IsPartOfPipeline ?
                            "<color=orange>→  " + EBPUtility.GetTagStr(G.Module.AssetPreprocessorModule.UserConfig.Json.Tags) + "</color>" :
                            "<color=cyan>" + EBPUtility.GetTagStr(CommonModule.CommonConfig.Json.CurrentAssetTag) + "</color>", richTextLabel);
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndToggleGroup();
            EditorGUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            //BundleManager
            EditorGUILayout.BeginHorizontal();
            FrontIndicator(currentStep == Step.BuildBundles, G.Module.BundleManagerModule.ModuleStateConfig.Json.Applying,
                           G.Module.BundleManagerModule.ModuleStateConfig.Json.ErrorMessage);
            G.Module.BundleManagerModule.ModuleStateConfig.Json.IsPartOfPipeline = EditorGUILayout.BeginToggleGroup(
                bundleManagerContent, G.Module.BundleManagerModule.ModuleStateConfig.Json.IsPartOfPipeline);
            EditorGUILayout.BeginHorizontal();

            index_new = EditorGUILayout.Popup(bundleManagerUserConfigSelectedIndex, bundleManagerUserConfigNames, dropdownOptions);
            if (bundleManagerUserConfigSelectedIndex != index_new)
            {
                bundleManagerUserConfigSelectedIndex = index_new;
                G.Module.BundleManagerModule.ModuleStateConfig.Json.CurrentUserConfigName = bundleManagerUserConfigNames[index_new] + ".json";
                return;
            }
            if (GUILayout.Button(settingGUIContent, miniButtonOptions))
            {
                if (BundleManager.G.g == null)
                {
                    EditorWindow.GetWindow <BundleManager.Editor.BundleManagerWindow>();
                    BundleManager.G.g.OnChangeConfigList += Action_OnChangeConfigList;
                }
                else
                {
                    EditorWindow.GetWindow <BundleManager.Editor.BundleManagerWindow>();
                }
                return;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndToggleGroup();

            GUILayout.Space(10);
            EditorGUILayout.LabelField("Resource Version:", labelOptions);
            int n = EditorGUILayout.IntField(G.Module.BundleManagerModule.ModuleStateConfig.Json.ResourceVersion, inputOptions);

            if (G.Module.BundleManagerModule.ModuleStateConfig.Json.ResourceVersion != n)
            {
                G.Module.BundleManagerModule.ModuleStateConfig.Json.ResourceVersion = n;
            }

            int selectedCompressionIndex_new = EditorGUILayout.Popup(selectedCompressionIndex, G.Module.BundleManagerModule.CompressionEnum, dropdownOptions2);

            if (selectedCompressionIndex_new != selectedCompressionIndex)
            {
                G.Module.BundleManagerModule.ModuleStateConfig.Json.CompressionOption = G.Module.BundleManagerModule.CompressionEnumMap[G.Module.BundleManagerModule.CompressionEnum[selectedCompressionIndex_new]];
                selectedCompressionIndex = selectedCompressionIndex_new;
                return;
            }

            G.Module.BundleManagerModule.ModuleStateConfig.Json.CleanUpBundles = GUILayout.Toggle(G.Module.BundleManagerModule.ModuleStateConfig.Json.CleanUpBundles, "CleanUp");

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            //PackageManager
            EditorGUILayout.BeginHorizontal();
            FrontIndicator(currentStep == Step.BuildPackages, G.Module.PackageManagerModule.ModuleStateConfig.Json.Applying,
                           G.Module.PackageManagerModule.ModuleStateConfig.Json.ErrorMessage);
            G.Module.PackageManagerModule.ModuleStateConfig.Json.IsPartOfPipeline = EditorGUILayout.BeginToggleGroup(
                packageManagerContent, G.Module.PackageManagerModule.ModuleStateConfig.Json.IsPartOfPipeline);
            EditorGUILayout.BeginHorizontal();

            index_new = EditorGUILayout.Popup(packageManagerUserConfigSelectedIndex, packageManagerUserConfigNames, dropdownOptions);
            if (packageManagerUserConfigSelectedIndex != index_new)
            {
                packageManagerUserConfigSelectedIndex = index_new;
                G.Module.PackageManagerModule.ModuleStateConfig.Json.CurrentUserConfigName = packageManagerUserConfigNames[index_new] + ".json";
                return;
            }
            if (GUILayout.Button(settingGUIContent, miniButtonOptions))
            {
                PackageManager.G.OverrideCurrentUserConfigName = G.Module.PackageManagerModule.ModuleStateConfig.Json.CurrentUserConfigName;
                if (PackageManager.G.g == null)
                {
                    EditorWindow.GetWindow <PackageManager.Editor.PackageManagerWindow>();
                    PackageManager.G.g.OnChangeConfigList += Action_OnChangeConfigList;
                }
                else
                {
                    EditorWindow.GetWindow <PackageManager.Editor.PackageManagerWindow>();
                }
                return;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndToggleGroup();

            GUILayout.Space(10);
            EditorGUILayout.LabelField("Client Version:", labelOptions);
            string packageVersion_new = EditorGUILayout.TextField(G.Module.PackageManagerModule.ModuleStateConfig.Json.ClientVersion, inputOptions);

            if (G.Module.PackageManagerModule.ModuleStateConfig.Json.ClientVersion != packageVersion_new)
            {
                G.Module.PackageManagerModule.ModuleStateConfig.Json.ClientVersion = packageVersion_new;
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            //BuildPlayer
            EditorGUILayout.BeginHorizontal();
            FrontIndicator(currentStep == Step.BuildPlayer || currentStep == Step.Prepare, G.Module.PlayerBuilderModule.ModuleStateConfig.Json.Applying,
                           G.Module.PlayerBuilderModule.ModuleStateConfig.Json.ErrorMessage);
            G.Module.PlayerBuilderModule.ModuleStateConfig.Json.IsPartOfPipeline = EditorGUILayout.BeginToggleGroup(
                playerBuilderContent, G.Module.PlayerBuilderModule.ModuleStateConfig.Json.IsPartOfPipeline);
            EditorGUILayout.BeginHorizontal();
            if (creatingNewConfig)
            {
                ShowInputField();
            }
            else
            {
                if (ShowBuildSettingDropdown())
                {
                    return;
                }
            }
            if (GUILayout.Button(new GUIContent(EditorGUIUtility.FindTexture("ViewToolOrbit"), "查看该文件"), miniButtonOptions))
            {
                ClickedShowConfigFile(); return;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndToggleGroup();
            GUILayout.Space(10);
            EditorGUILayout.LabelField("Build Number:", labelOptions);
            int buildNum = EditorGUILayout.IntField(G.Module.PlayerBuilderModule.ModuleStateConfig.Json.BuildNumber, inputOptions);

            if (G.Module.PlayerBuilderModule.ModuleStateConfig.Json.BuildNumber != buildNum)
            {
                G.Module.PlayerBuilderModule.ModuleStateConfig.Json.BuildNumber = buildNum;
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(30);
            if (GUILayout.Button(new GUIContent("New", "新建配置文件"), buttonOptions))
            {
                ClickedNew(); return;
            }
            if (GUILayout.Button(new GUIContent("Save", "保存配置文件"), buttonOptions))
            {
                ClickedSave(); return;
            }
            if (GUILayout.Button(new GUIContent("Revert", "重新载入配置文件"), buttonOptions))
            {
                ClickedRevert(); return;
            }
            if (GUILayout.Button(new GUIContent("Apply", "应用下面的PlayerSettings(不包括宏定义)"), buttonOptions))
            {
                ClickedApply(); return;
            }
            if (GUILayout.Button(new GUIContent("Fetch", "获取当前的PlayerSettings"), buttonOptions))
            {
                FetchSettings(); return;
            }
            if (GUILayout.Button(new GUIContent("CopyDir", "自动拷贝目录并设置宏定义"), buttonOptions))
            {
                if (PlayerBuilder.Editor.PlayerSettingsPanel.CopyNow(EditorUserBuildSettings.activeBuildTarget))
                {
                    G.Module.PlayerBuilderRunner.ApplyScriptDefines(EditorUserBuildSettings.activeBuildTarget);
                    ToLuaMenu.ClearLuaWraps();
                }
                return;
            }
            if (GUILayout.Button(new GUIContent("RevertDir", "自动恢复拷贝目录并恢复宏定义"), buttonOptions))
            {
                if (PlayerBuilder.Editor.PlayerSettingsPanel.RevertNow())
                {
                    G.Module.PlayerBuilderRunner.ApplyScriptDefines(EditorUserBuildSettings.activeBuildTarget, true);
                    ToLuaMenu.ClearLuaWraps();
                }
                return;
            }
            GUILayout.FlexibleSpace();

            //Run Button
            Color defaultColor = GUI.contentColor;

            GUI.contentColor = Color.green;
            if (PlayerBuilder.G.Module.StateConfigAvailable)
            {
                if (GUILayout.Button(new GUIContent("Run Pipeline")))
                {
                    ClickedRunPipeline(); return;
                }
            }
            else
            {
                if (GUILayout.Button(new GUIContent("Check", "检查所有勾选的模块配置")))
                {
                    ClickedCheckAll(); return;
                }
            }
            GUI.contentColor = defaultColor;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndScrollView();
        }
 private static void ClearLuaWraps()
 {
     ToLuaMenu.ClearLuaWraps();
 }
 public static void clearAndBuild()
 {
     PlayerPrefs.SetInt("clearAndBuild", 1);
     ToLuaMenu.ClearLuaWraps();
 }