Example #1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolver);

            // Close program if there is another instance running
            if (!EnsureSingleInstance())
            {
                //TODO: put it into language file
                MessageBox.Show("Another Instance of Vocaluxe is already runnning!");
                return;
            }

            Application.DoEvents();

            try
            {
                // Init Log
                CLog.Init();

                CSettings.CreateFolders();
                Application.DoEvents();

                // Init Language
                CLog.StartBenchmark(0, "Init Language");
                CLanguage.Init();
                CLog.StopBenchmark(0, "Init Language");

                Application.DoEvents();

                // load config
                CLog.StartBenchmark(0, "Init Config");
                CConfig.LoadCommandLineParams(args);
                CConfig.UseCommandLineParamsBefore();
                CConfig.Init();
                CConfig.UseCommandLineParamsAfter();
                CLog.StopBenchmark(0, "Init Config");

                Application.DoEvents();
                _SplashScreen = new SplashScreen();
                Application.DoEvents();

                // Init Draw
                CLog.StartBenchmark(0, "Init Draw");
                CDraw.InitDraw();
                CLog.StopBenchmark(0, "Init Draw");

                Application.DoEvents();

                // Init Database
                CLog.StartBenchmark(0, "Init Database");
                CDataBase.Init();
                CLog.StopBenchmark(0, "Init Database");

                Application.DoEvents();

                // Init Playback
                CLog.StartBenchmark(0, "Init Playback");
                CSound.PlaybackInit();
                CLog.StopBenchmark(0, "Init Playback");

                Application.DoEvents();

                // Init Record
                CLog.StartBenchmark(0, "Init Record");
                CSound.RecordInit();
                CLog.StopBenchmark(0, "Init Record");

                Application.DoEvents();

                // Init Background Music
                CLog.StartBenchmark(0, "Init Background Music");
                CBackgroundMusic.Init();
                CLog.StopBenchmark(0, "Init Background Music");

                Application.DoEvents();

                // Init Profiles
                CLog.StartBenchmark(0, "Init Profiles");
                CProfiles.Init();
                CLog.StopBenchmark(0, "Init Profiles");

                Application.DoEvents();

                // Init Font
                CLog.StartBenchmark(0, "Init Font");
                CFonts.Init();
                CLog.StopBenchmark(0, "Init Font");

                Application.DoEvents();

                // Init VideoDecoder
                CLog.StartBenchmark(0, "Init Videodecoder");
                CVideo.Init();
                CLog.StopBenchmark(0, "Init Videodecoder");

                Application.DoEvents();

                // Load Cover
                CLog.StartBenchmark(0, "Init Cover");
                CCover.Init();
                CLog.StopBenchmark(0, "Init Cover");

                Application.DoEvents();

                // Theme System
                CLog.StartBenchmark(0, "Init Theme");
                CTheme.InitTheme();
                CLog.StopBenchmark(0, "Init Theme");

                Application.DoEvents();

                // Init Screens
                CLog.StartBenchmark(0, "Init Screens");
                CGraphics.InitGraphics();
                CLog.StopBenchmark(0, "Init Screens");

                Application.DoEvents();

                // Init Game;
                CLog.StartBenchmark(0, "Init Game");
                CGame.Init();
                CLog.StopBenchmark(0, "Init Game");
            }
            catch (Exception e)
            {
                MessageBox.Show("Error on start up: " + e.Message + e.StackTrace);
                CLog.LogError("Error on start up: " + e.Message + e.StackTrace);
                CloseProgram();
                Environment.Exit(Environment.ExitCode);
            }
            Application.DoEvents();

            // Start Main Loop
            _SplashScreen.Close();

            try
            {
                CDraw.MainLoop();
            }
            catch (Exception e)
            {
                MessageBox.Show("Unhandled error: " + e.Message + e.StackTrace);
                CLog.LogError("Unhandled error: " + e.Message + e.StackTrace);
            }

            CloseProgram();
        }
Example #2
0
    public static bool UpdateOptionsMenu(float dt, GameObject pointerObj, ref int index, Vector3 offset, CSound sound)
    {
        if (Input.GetTriggered(0, "MenuBack") != 0.0f)
        {
            return(true);
        }

        if (Input.GetTriggered(0, "MenuSelect") != 0.0f)
        {
            switch (index)
            {
            case 0:     // Fullscreen
            {
                bool isFullscreen = Engine.getInstance().GetGameWnd().IsFullScreen();
                Engine.getInstance().GetGameWnd().SetFullScreen(!isFullscreen);
                Common.GetMenuFullscreenX().setEnabled(!isFullscreen);
            }
            break;

            case 2:     // Mute
            {
                bool isMute = AudioManager.getInstance().GetMuteSound();
                //AudioManager.getInstance().SetMuteMusic(!isMute);
                AudioManager.getInstance().SetMuteSound(!AudioManager.getInstance().GetMuteSound());

                Common.GetMenuMuteX().setEnabled(!isMute);

                SetVolumeText();
            }
            break;
            }
        }
        if (index == 1) // over volume
        {
            if (Common.TriggeredLeft() || Common.TriggeredRight())
            {
                float currVolume = AudioManager.getInstance().GetSoundVolume();
                if (Common.TriggeredLeft())
                {
                    currVolume -= 0.1f;
                    if (currVolume < 0.0f)
                    {
                        currVolume = 0.0f;
                    }
                }
                else
                {
                    currVolume += 0.1f;
                    if (currVolume > 1.0f)
                    {
                        currVolume = 1.0f;
                    }

                    if (AudioManager.getInstance().GetMuteSound())
                    {
                        AudioManager.getInstance().SetMuteSound(false);
                        Common.GetMenuMuteX().setEnabled(false);
                    }
                }
                AudioManager.getInstance().SetSoundVolume(currVolume);
                // Might be mute, so get the actual vol again
                SetVolumeText();

                Common.GetMenuMuteX().setEnabled(AudioManager.getInstance().GetMuteSound()); // Show updated mute or not
            }
        }

        if (Common.TriggeredUp() || Common.TriggeredDown())
        {
            sound.PlayIndependentEvent("BUTTON_GREEN.vente", false, 0);

            if (Common.TriggeredDown())
            {
                if (index < 2)
                {
                    ++index;
                }
            }
            else
            {
                if (index != 0)
                {
                    --index;
                }
            }
            PositionOptionsPointer(pointerObj, index, offset);
        }

        return(false); // No back button pressed (stay in options menu)
    }
Example #3
0
        private async void tプレビューサウンドの作成()
        {
            Cスコア cスコア = TJAPlayer3.stage選曲.act曲リスト.r現在選択中のスコア;

            if ((cスコア != null) && !string.IsNullOrEmpty(cスコア.譜面情報.strBGMファイル名) && TJAPlayer3.stage選曲.eフェーズID != CStage.Eフェーズ.選曲_NowLoading画面へのフェードアウト)
            {
                string strPreviewFilename = cスコア.ファイル情報.フォルダの絶対パス + cスコア.譜面情報.strBGMファイル名;
                try
                {
                    // 2020.06.15 Mr-Ojii TJAP2fPCより拝借-----------
                    // 2019.03.22 kairera0467 簡易マルチスレッド化
                    Task <CSound> task = Task.Run <CSound>(() => {
                        token = new CancellationTokenSource();
                        return(this.tプレビューサウンドの作成MT(strPreviewFilename));
                    });
                    CSound tmps = await task;

                    token.Token.ThrowIfCancellationRequested();
                    this.tサウンドの停止MT();

                    this.sound = tmps;
                    //------------

                    // 2018-08-27 twopointzero - DO attempt to load (or queue scanning) loudness metadata here.
                    //                           Initialization, song enumeration, and/or interactions may have
                    //                           caused background scanning and the metadata may now be available.
                    //                           If is not yet available then we wish to queue scanning.
                    var loudnessMetadata = cスコア.譜面情報.SongLoudnessMetadata
                                           ?? LoudnessMetadataScanner.LoadForAudioPath(strPreviewFilename);
                    TJAPlayer3.SongGainController.Set(cスコア.譜面情報.SongVol, loudnessMetadata, this.sound);

                    this.long再生位置 = -1;

                    if (ctBGMフェードイン用 != null)
                    {
                        this.sound.AutomationLevel = 100 - this.ctBGMフェードイン用.n現在の値;
                    }

                    this.sound.t再生を開始する(true);
                    if (this.long再生位置 == -1)
                    {
                        this.long再生開始時のシステム時刻 = CSound管理.rc演奏用タイマ.nシステム時刻ms;
                        this.long再生位置         = cスコア.譜面情報.nデモBGMオフセット;
                        this.sound.t再生位置を変更する(cスコア.譜面情報.nデモBGMオフセット);
                        this.long再生位置 = CSound管理.rc演奏用タイマ.nシステム時刻ms - this.long再生開始時のシステム時刻;
                    }

                    this.str現在のファイル名 = strPreviewFilename;
                    this.tBGMフェードアウト開始();
                    Trace.TraceInformation("プレビューサウンドを生成しました。({0})", strPreviewFilename);
                }
                catch (Exception e)
                {
                    Trace.TraceError(e.ToString());
                    Trace.TraceError("プレビューサウンドの生成に失敗しました。({0})", strPreviewFilename);
                    if (this.sound != null)
                    {
                        this.sound.Dispose();
                    }
                    this.sound = null;
                }
            }
        }
Example #4
0
        private static void _Run(string[] args)
        {
            Application.DoEvents();

            try
            {
                // Create data folder
                Directory.CreateDirectory(CSettings.DataFolder);

                // Init Log
                CLog.Init();

                if (!CProgrammHelper.CheckRequirements())
                {
                    return;
                }
                CProgrammHelper.Init();

                CLog.StartBenchmark("Init Program");
                CMain.Init();
                Application.DoEvents();

                // Init Language
                CLog.StartBenchmark("Init Language");
                if (!CLanguage.Init())
                {
                    throw new CLoadingException("Language");
                }
                CLog.StopBenchmark("Init Language");

                Application.DoEvents();

                // load config
                CLog.StartBenchmark("Init Config");
                CConfig.LoadCommandLineParams(args);
                CConfig.UseCommandLineParamsBefore();
                CConfig.Init();
                CConfig.UseCommandLineParamsAfter();
                CLog.StopBenchmark("Init Config");

                // Create folders
                CSettings.CreateFolders();

                _SplashScreen = new CSplashScreen();
                Application.DoEvents();

                // Init Draw
                CLog.StartBenchmark("Init Draw");
                if (!CDraw.Init())
                {
                    throw new CLoadingException("drawing");
                }
                CLog.StopBenchmark("Init Draw");

                Application.DoEvents();

                // Init Playback
                CLog.StartBenchmark("Init Playback");
                if (!CSound.Init())
                {
                    throw new CLoadingException("playback");
                }
                CLog.StopBenchmark("Init Playback");

                Application.DoEvents();

                // Init Record
                CLog.StartBenchmark("Init Record");
                if (!CRecord.Init())
                {
                    throw new CLoadingException("record");
                }
                CLog.StopBenchmark("Init Record");

                Application.DoEvents();

                // Init VideoDecoder
                CLog.StartBenchmark("Init Videodecoder");
                if (!CVideo.Init())
                {
                    throw new CLoadingException("video");
                }
                CLog.StopBenchmark("Init Videodecoder");

                Application.DoEvents();

                // Init Database
                CLog.StartBenchmark("Init Database");
                if (!CDataBase.Init())
                {
                    throw new CLoadingException("database");
                }
                CLog.StopBenchmark("Init Database");

                Application.DoEvents();

                //Init Webcam
                CLog.StartBenchmark("Init Webcam");
                if (!CWebcam.Init())
                {
                    throw new CLoadingException("webcam");
                }
                CLog.StopBenchmark("Init Webcam");

                Application.DoEvents();

                // Init Background Music
                CLog.StartBenchmark("Init Background Music");
                CBackgroundMusic.Init();
                CLog.StopBenchmark("Init Background Music");

                Application.DoEvents();

                // Init Profiles
                CLog.StartBenchmark("Init Profiles");
                CProfiles.Init();
                CLog.StopBenchmark("Init Profiles");

                Application.DoEvents();

                // Init Fonts
                CLog.StartBenchmark("Init Fonts");
                if (!CFonts.Init())
                {
                    throw new CLoadingException("fonts");
                }
                CLog.StopBenchmark("Init Fonts");

                Application.DoEvents();

                // Theme System
                CLog.StartBenchmark("Init Theme");
                if (!CThemes.Init())
                {
                    throw new CLoadingException("theme");
                }
                CLog.StopBenchmark("Init Theme");

                CLog.StartBenchmark("Load Theme");
                CThemes.Load();
                CLog.StopBenchmark("Load Theme");

                Application.DoEvents();

                // Load Cover
                CLog.StartBenchmark("Init Cover");
                if (!CCover.Init())
                {
                    throw new CLoadingException("covertheme");
                }
                CLog.StopBenchmark("Init Cover");

                Application.DoEvents();

                // Init Screens
                CLog.StartBenchmark("Init Screens");
                CGraphics.Init();
                CLog.StopBenchmark("Init Screens");

                Application.DoEvents();

                // Init Server
                CLog.StartBenchmark("Init Server");
                CVocaluxeServer.Init();
                CLog.StopBenchmark("Init Server");

                Application.DoEvents();

                // Init Input
                CLog.StartBenchmark("Init Input");
                CController.Init();
                CController.Connect();
                CLog.StopBenchmark("Init Input");

                Application.DoEvents();

                // Init Game;
                CLog.StartBenchmark("Init Game");
                CGame.Init();
                CProfiles.Update();
                CConfig.UsePlayers();
                CLog.StopBenchmark("Init Game");

                Application.DoEvents();

                // Init Party Modes;
                CLog.StartBenchmark("Init Party Modes");
                if (!CParty.Init())
                {
                    throw new CLoadingException("Party Modes");
                }
                CLog.StopBenchmark("Init Party Modes");

                Application.DoEvents();
                //Only reasonable point to call GC.Collect() because initialization may cause lots of garbage
                //Rely on GC doing its job afterwards and call Dispose methods where appropriate
                GC.Collect();
                CLog.StopBenchmark("Init Program");
            }
            catch (Exception e)
            {
                MessageBox.Show("Error on start up: " + e.Message);
                CLog.LogError("Error on start up: " + e);
                if (_SplashScreen != null)
                {
                    _SplashScreen.Close();
                }
                _CloseProgram();
                return;
            }
            Application.DoEvents();

            // Start Main Loop
            if (_SplashScreen != null)
            {
                _SplashScreen.Close();
            }

            CDraw.MainLoop();
        }