예제 #1
0
        private void menuModdingRun_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // Run
            if (e.Item == toolsRun)
            {
                Run(RunMode.DEFAULT, "");
            }

            // Run fullscreen
            if (e.Item == menuModdingRunFullscreen || e.Item == toolsRunPopupRunFullscreen)
            {
                Run(RunMode.FULLSCREEN, "");
            }

            // Run Windowed
            else if (e.Item == menuModdingRunWindowed || e.Item == toolsRunPopupRunWindowed)
            {
                Run(RunMode.WINDOWED, "");
            }

            // Run VR
            if (e.Item == menuModdingRunVR || e.Item == toolsRunPopupRunVR)
            {
                Run(RunMode.VR, "");
            }

            // Expert mode
            else if (e.Item == menuModdingRunExpert || e.Item == toolsRunPopupExpert)
            {
                RunDialog dialog = new RunDialog(launcher);
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string    arguments = dialog.commands;
                    RunPreset runPreset = dialog.runPreset;
                    Run(runPreset, arguments);
                }
            }
        }
예제 #2
0
        private void menuLevelDesign_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // Run Map
            if (e.Item == menuLevelDesignRunMap)
            {
                Game         game = launcher.GetCurrentGame();
                FileExplorer form = new FileExplorer(launcher);
                form.RootDirectory = "maps/";
                form.Filter        = "BSP Files (*.bsp)|*.bsp|VPK Files (*.vpk)|*.vpk";
                if (form.ShowDialog() == DialogResult.OK)
                {
                    VPK.File file = form.selectedFiles[0];
                    if ((file.type == ".bsp" && game.engine == Engine.GOLDSRC) || (file.type == ".bsp" && game.engine == Engine.SOURCE) || (file.type == ".vpk" && file.path.StartsWith("maps/") && game.engine == Engine.SOURCE2))
                    {
                        // It's a map
                        string mapName = Path.GetFileNameWithoutExtension(file.path);
                        if (instance != null)
                        {
                            instance.Command("+map " + mapName);
                        }
                        else
                        {
                            RunDialog runDialog = new RunDialog(launcher);
                            if (runDialog.ShowDialog() == DialogResult.OK)
                            {
                                Run(runDialog.runPreset, string.Join(" ", new string[] { runDialog.commands, "+map " + mapName }));
                            }
                        }
                    }
                }
            }
            // Hammer
            if (e.Item == menuLevelDesignHammer)
            {
                Hammer.RunHammer(launcher.GetCurrentMod());
            }

            // Fog Previewer
            else if (e.Item == menuLevelDesignFogPreviewer)
            {
                FogForm form = new FogForm(launcher);
                form.ShowDialog();
            }

            // Prefabs
            else if (e.Item == menuLevelDesignPrefabs)
            {
                switch (launcher.GetCurrentGame().engine)
                {
                case Engine.SOURCE:
                    string gamePath = launcher.GetCurrentGame().installPath;
                    Process.Start(gamePath + "\\bin\\Prefabs");
                    break;

                case Engine.GOLDSRC:
                    Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\Tools\\HammerEditor\\prefabs");
                    break;
                }
            }

            // Mapsrc
            else if (e.Item == menuLevelDesignMapsrc)
            {
                // TODO implement this
            }

            // Crafty
            else if (e.Item == menuLevelDesignCrafty)
            {
                Process.Start("Tools\\Crafty\\Crafty.exe");
            }

            // Terrain generator
            else if (e.Item == menuLevelDesignTerrainGenerator)
            {
                Process.Start("Tools\\TerrainGenerator\\TerrainGenerator.exe");
            }

            // Batch compiler
            else if (e.Item == menuLevelDesignBatchCompiler)
            {
                Process.Start("Tools\\BatchCompiler\\Batch Compiler.exe");
            }
        }