/////////////////////////////////////////
        void OnDropAction()
        {
            var currentParams = P.GetCurrentParams();

            var m = new GenericMenu();

            if (Directory.Exists(P.currentOutputPackageDirectory))
            {
                m.AddItem(SS._OpenOutputFolder, () => {
                    ShellUtils.OpenDirectory(P.currentOutputPackageDirectory);
                });
            }
            else
            {
                m.AddDisabledItem($"{S.__NotFoundDirectory__}{P.currentOutputPackageDirectory.TryReplace( "/", "." )}]".content());
            }
            m.AddSeparator("");

            if (PB.i.enableAssetBundleBuild)
            {
                m.AddItem(S._BuildAssetBundletogether, currentParams.buildAssetBundlesTogether, () => { currentParams.buildAssetBundlesTogether = !currentParams.buildAssetBundlesTogether; });
            }
            if (UnitySymbol.Has("UNITY_EDITOR_WIN"))
            {
                m.AddItem(S._CreateabuildBATfile, () => {
                    var tname = $"{UnityEditorEditorUserBuildSettings.activeBuildTargetGroup.ToString()}_{currentParams.name}";
                    fs.WriteFileAll($"Build_{tname}.bat", b => {
                        b.AppendLine($"@echo off");
                        b.AppendLine($"set PATH=%PATH%;{EditorApplication.applicationPath.GetDirectory()}");
                        b.AppendLine($"set OPT1=-batchmode -nographics");
                        b.AppendLine($"set BUILD=-buildTarget {B.BuildTargetToBatchName( currentParams.buildTarget )}");
                        b.AppendLine($"set PROJ=-projectPath {Environment.CurrentDirectory}");
                        b.AppendLine($"set LOG=-logFile \"Logs/Editor_{tname}.log\"");
                        b.AppendLine($"set METHOD=-executeMethod Hananoki.{Package.name}.{nameof( BuildCommands )}.Batch -buildIndex:{P.i.selectParamsIndex}");
                        b.AppendLine($"Unity.exe %OPT1% %BUILD% %PROJ% %LOG% %METHOD% -quit");
                        b.AppendLine($"pause");
                    }, utf8bom: false);
                    EditorUtility.DisplayDialog(SS._Confirm, $"{S._BuildBATcreated}\n{Environment.CurrentDirectory}/{$"Build_{tname}.bat"}", SS._OK);
                });
            }
            m.DropDown(HEditorGUI.lastRect.PopupRect());
        }
Example #2
0
        static void Button_ScreenShot()
        {
            var  cont = EditorHelper.TempContent(EditorIcon.sceneviewfx, S._GameViewScreenShot);
            Rect r    = GUILayoutUtility.GetRect(cont, s_styles.DropDownButton, GUILayout.Width(50));

            Rect rr = r;

            rr.width = 20;
            rr.x    += 30;
            if (EditorHelper.HasMouseClick(rr))
            {
                var m     = new GenericMenu();
                var dname = Directory.GetCurrentDirectory() + "/ScreenShot";
                if (Directory.Exists(dname))
                {
                    m.AddItem(S._OpenOutputFolder, false, () => {
                        ShellUtils.OpenDirectory(dname);
                    });
                }
                else
                {
                    m.AddDisabledItem(S._OpenOutputFolder);
                }
                m.DropDown(r.PopupRect());
                Event.current.Use();
            }

            if (GUI.Button(r, cont, s_styles.DropDownButton))
            {
                EditorHelper.SaveScreenCapture();
            }

            if (UnitySymbol.UNITY_2019_3_OR_NEWER)
            {
                rr.y      += 3;
                rr.height -= 6;
                GUI.Label(rr, GUIContent.none, "DopesheetBackground");
            }
        }