Example #1
0
        private static void Main(string[] args)
        {
#if iOS
            GameBase game = new GameBaseIphone();
            game.Run();
#else
            GameBase game = new GameBaseDesktop();
            game.Run();
#endif
        }
Example #2
0
        private string CombinateAndTest(bool runTest = true)
        {
            string packageName = null;

            Invoke((MethodInvoker) delegate
            {
                console.Text = string.Empty;
                if (checkBoxAnalysis.Checked)
                {
                    modconsole.Text = string.Empty;
                }

                panelButtons.Enabled = false;
            });

            if (game != null)
            {
                GameBase.Scheduler.Add(delegate { Director.ChangeMode(OsuMode.PositioningTest, null); }, true);
                while (Director.CurrentOsuMode == OsuMode.PlayTest)
                {
                    Thread.Sleep(100);
                }
            }

            try
            {
                GameBase.Instance = null;
                //temporarily remove any instance to ensure we get correct and speedy calculations.
                //this will be restored at the end of processing.

                Environment.CurrentDirectory = tempDir;
                BeatmapCombinator.BeatmapCombinator.Analysis = checkBoxAnalysis.Checked;
                packageName = tempDir + "\\" + BeatmapCombinator.BeatmapCombinator.Process(Filename, checkBoxQuick.Checked);
                Environment.CurrentDirectory = osusDir;

                GameBase.Instance = game;

                PlayTest.StartTime         = Int32.Parse(textBoxStartTime.Text);
                PlayTest.AllowStreamSwitch = streamSwitch.Checked;
                Player.Beatmap             = new Beatmap(packageName);
                Player.Autoplay            = checkBoxAutoplay.Checked;

                if (radioButtonStreamUp.Checked)
                {
                    PlayTest.InitialHp = 200;
                }
                else if (radioButtonStreamDown.Checked)
                {
                    PlayTest.InitialHp = 0;
                }
                else
                {
                    PlayTest.InitialHp = 100;
                }

                if (radioButtonEasy.Checked)
                {
                    PlayTest.InitialDifficulty = Difficulty.Easy;
                }
                else if (radioButtonNormal.Checked)
                {
                    PlayTest.InitialDifficulty = Difficulty.Normal;
                }
                else if (radioButtonHard.Checked)
                {
                    PlayTest.InitialDifficulty = Difficulty.Hard;
                }
                else if (radioButtonExpert.Checked)
                {
                    PlayTest.InitialDifficulty = Difficulty.Expert;
                }

                switch (PlayTest.InitialDifficulty)
                {
                case Difficulty.Expert:
                    Player.Difficulty = Difficulty.Expert;
                    break;

                default:
                    Player.Difficulty = PlayTest.AllowStreamSwitch ? Difficulty.Normal : PlayTest.InitialDifficulty;
                    break;
                }

                Invoke((MethodInvoker) delegate { visualisePackage(packageName); });

                if (runTest && !checkBoxm4a.Checked)
                {
                    if (game == null)
                    {
                        ThreadPool.QueueUserWorkItem(w =>
                        {
                            try
                            {
                                game = new GameBaseDesktop(OsuMode.PlayTest);
                                game.Run();
                            }
                            catch (ApplicationException ex)
                            {
                                MessageBox.Show(ex.Message);
                                game.Exit();
                            }
                        });
                    }
                    else
                    {
                        GameBase.Scheduler.Add(delegate { Director.ChangeMode(OsuMode.PlayTest, null); }, true);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR:\n" + ex);
            }

            Invoke((MethodInvoker) delegate { panelButtons.Enabled = true; });

            File.Delete(tempDir + "\\" + Path.GetFileNameWithoutExtension(Filename) + ".osc");

            if (checkBoxm4a.Checked)
            {
                Process.Start(tempDir);
            }

            return(packageName);
        }