示例#1
0
        void Awake()
        {
            isSetGuiStyle = false;
            rectWindow    = new Rect(0.0f, 0.0f, Screen.width, Screen.height);

            Unity.Function.Graphic.Gui.camera = GetComponent <Camera>();
            GameObject obj = GameObject.Find("GuiStyleSet");

            GuiStyleSet.Reset(obj);

            AudioSettings.outputSampleRate = 44100;
            sampleRate = AudioSettings.outputSampleRate;

            windowLoopPlayer = new LoopPlayer(new DirectoryInfo(Application.streamingAssetsPath + "/Sound/Music"));

            soundBuffer = new Dictionary <int, float[]>();

            guiStyleDictionary = new Dictionary <string, GUIStyle>();

            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.verticalbar.name, GuiStyleSet.StyleScrollbar.verticalbar);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.verticalbarThumb.name, GuiStyleSet.StyleScrollbar.verticalbarThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.verticalbarUpButton.name, GuiStyleSet.StyleScrollbar.verticalbarUpButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.verticalbarDownButton.name, GuiStyleSet.StyleScrollbar.verticalbarDownButton);

            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.horizontalbar.name, GuiStyleSet.StyleScrollbar.horizontalbar);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.horizontalbarThumb.name, GuiStyleSet.StyleScrollbar.horizontalbarThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.horizontalbarLeftButton.name, GuiStyleSet.StyleScrollbar.horizontalbarLeftButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.horizontalbarRightButton.name, GuiStyleSet.StyleScrollbar.horizontalbarRightButton);

            guiStyleDictionary.Add(GuiStyleSet.StylePlayer.seekbar.name, GuiStyleSet.StylePlayer.seekbar);
            guiStyleDictionary.Add(GuiStyleSet.StylePlayer.seekbarThumb.name, GuiStyleSet.StylePlayer.seekbarThumb);
            guiStyleDictionary.Add(GuiStyleSet.StylePlayer.seekbarLeftButton.name, GuiStyleSet.StylePlayer.seekbarLeftButton);
            guiStyleDictionary.Add(GuiStyleSet.StylePlayer.seekbarRightButton.name, GuiStyleSet.StylePlayer.seekbarRightButton);

            guiStyleDictionary.Add(GuiStyleSet.StyleProgressbar.progressbar.name, GuiStyleSet.StyleProgressbar.progressbar);
            guiStyleDictionary.Add(GuiStyleSet.StyleProgressbar.progressbarThumb.name, GuiStyleSet.StyleProgressbar.progressbarThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleProgressbar.progressbarLeftButton.name, GuiStyleSet.StyleProgressbar.progressbarLeftButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleProgressbar.progressbarRightButton.name, GuiStyleSet.StyleProgressbar.progressbarRightButton);

            guiStyleDictionary.Add(GuiStyleSet.StyleTable.verticalbarHeader.name, GuiStyleSet.StyleTable.verticalbarHeader);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.verticalbarHeaderThumb.name, GuiStyleSet.StyleTable.verticalbarHeaderThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.verticalbarHeaderUpButton.name, GuiStyleSet.StyleTable.verticalbarHeaderUpButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.verticalbarHeaderDownButton.name, GuiStyleSet.StyleTable.verticalbarHeaderDownButton);

            guiStyleDictionary.Add(GuiStyleSet.StyleTable.horizontalbarHeader.name, GuiStyleSet.StyleTable.horizontalbarHeader);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.horizontalbarHeaderThumb.name, GuiStyleSet.StyleTable.horizontalbarHeaderThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.horizontalbarHeaderLeftButton.name, GuiStyleSet.StyleTable.horizontalbarHeaderLeftButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.horizontalbarHeaderRightButton.name, GuiStyleSet.StyleTable.horizontalbarHeaderRightButton);
        }
示例#2
0
        public static void Main(string[] argv)
        {
            //Test();
            Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory;

            //hook Ctrl-C action for console window.
            SetConsoleCtrlHandler(type => {
                Exit();
                return(true);
            }, false);

            //apply settings from file
            PlayerSetting.Init();

            //apply settings from commandline
            var args = ParseProgramCommands(argv, out var beatmap_folder);

            //apply features and settings from diff envs
            EnvironmentHelper.SetupEnvironment();

            //Update check and notify
            if (PlayerSetting.EnableUpdateCheck)
            {
                ProgramUpdater.UpdateCheck();
            }

            //clean temp folder if updated just now.
            ProgramUpdater.CleanTemp();

            PlayerSetting.PrintSettings();

            //init window
            StoryboardWindow window = new StoryboardWindow(PlayerSetting.Width, PlayerSetting.Height);

            Log.User($"Start to parse folder :{beatmap_folder}");

            if (Directory.Exists(beatmap_folder))
            {
                var info     = BeatmapFolderInfoEx.Parse(beatmap_folder, args);
                var instance = StoryboardInstance.Load(info);

                window.LoadStoryboardInstance(instance);

                var player = new MusicPlayer();
                player.Load(info.audio_file_path);
                MusicPlayerManager.ApplyPlayer(player);

                var auto_trigger = ToolManager.GetOrCreateTool <AutoTrigger>();
                auto_trigger.Load(info);
                auto_trigger.Trim();
            }
            else
            {
                Exit($"You have to select a beatmap folder which contains storyboard to play");
            }

            if (PlayerSetting.EncodingEnvironment)
            {
                //init encoding environment
                var                   encoding_opt    = new EncoderOption(args);
                EncodingKernel        encoding_kernel = new EncodingKernel(encoding_opt);
                EncodingProcessPlayer encoding_player = new EncodingProcessPlayer(MusicPlayerManager.ActivityPlayer.Length, encoding_opt.FPS);
                MusicPlayerManager.ActivityPlayer.Pause();
                MusicPlayerManager.ApplyPlayer(encoding_player);
                ToolManager.AddTool(encoding_kernel);
                encoding_kernel.Start();
            }

            #region Setup Loop Playback

            if ((PlayerSetting._LoopPlayStartTime != null || PlayerSetting._LoopPlayEndTime != null) && MusicPlayerManager.ActivityPlayer is MusicPlayer mp)
            {
                var len = mp.Length;

                LoopPlayer lp = new LoopPlayer(PlayerSetting._LoopPlayStartTime ?? 0, PlayerSetting._LoopPlayEndTime ?? len);

                Log.User($"Loop playback : {lp}");

                MusicPlayerManager.ApplyPlayer(lp);
            }

            #endregion

            MusicPlayerManager.ActivityPlayer.Volume = PlayerSetting.Volume;

            MusicPlayerManager.ActivityPlayer?.Play();

            window.Run();

            /*/ 不曾设想的操作.jpg
             * window.IsVisible = true;
             * window.RefreshResize();
             *
             * while (true)
             * {
             *  UpdateKernel.Update();
             *  RenderKernel.Draw();
             *  window.SwapBuffers();
             *  UpdateKernel.FrameRateLimit();
             *  Application.DoEvents();
             * }
             * /*/
        }
示例#3
0
        void Awake()
        {
            Unity.Function.Graphic.Gui.camera = GetComponent <Camera>();
            GameObject obj = GameObject.Find("GuiStyleSet");

            //GameObject obj = ( GameObject )Resources.Load( "Prefab/GuiStyleSet.prefab", typeof( GameObject ) );
            GuiStyleSet.Reset(obj);

            AudioSettings.outputSampleRate = 44100;
            sampleRate = AudioSettings.outputSampleRate;

            LoopPlayer lWindowLoopPlayer = new LoopPlayer(new DirectoryInfo(Application.streamingAssetsPath + "/Sound/Music/BgmInput"));
            LoopTool   lWindowLoopSearch = new LoopTool(new DirectoryInfo(Application.streamingAssetsPath + "/Sound/Music/BgmInput"), new DirectoryInfo(Application.streamingAssetsPath + "/Sound/Music/BgmOutput"));
            UiTest     lUiTest           = new UiTest();

            windowDictionary = new Dictionary <string, IView>();
            windowDictionary.Add("Loop Player", lWindowLoopPlayer);
            windowDictionary.Add("Loop Tool", lWindowLoopSearch);
            windowDictionary.Add("UI Test", lUiTest);

            captions      = new string[] { "Loop Player", "Loop Tool", "UI Test" };
            grid          = 1;
            windowCurrent = lWindowLoopSearch;

            foreach (KeyValuePair <string, IView> lKeyValuePair in windowDictionary)
            {
                lKeyValuePair.Value.Awake();
            }

            soundBuffer = new Dictionary <int, float[]>();

            isSetGuiStyle      = false;
            guiStyleDictionary = new Dictionary <string, GUIStyle>();

            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.verticalbar.name, GuiStyleSet.StyleScrollbar.verticalbar);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.verticalbarThumb.name, GuiStyleSet.StyleScrollbar.verticalbarThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.verticalbarUpButton.name, GuiStyleSet.StyleScrollbar.verticalbarUpButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.verticalbarDownButton.name, GuiStyleSet.StyleScrollbar.verticalbarDownButton);

            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.horizontalbar.name, GuiStyleSet.StyleScrollbar.horizontalbar);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.horizontalbarThumb.name, GuiStyleSet.StyleScrollbar.horizontalbarThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.horizontalbarLeftButton.name, GuiStyleSet.StyleScrollbar.horizontalbarLeftButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleScrollbar.horizontalbarRightButton.name, GuiStyleSet.StyleScrollbar.horizontalbarRightButton);

            guiStyleDictionary.Add(GuiStyleSet.StylePlayer.seekbar.name, GuiStyleSet.StylePlayer.seekbar);
            guiStyleDictionary.Add(GuiStyleSet.StylePlayer.seekbarThumb.name, GuiStyleSet.StylePlayer.seekbarThumb);
            guiStyleDictionary.Add(GuiStyleSet.StylePlayer.seekbarLeftButton.name, GuiStyleSet.StylePlayer.seekbarLeftButton);
            guiStyleDictionary.Add(GuiStyleSet.StylePlayer.seekbarRightButton.name, GuiStyleSet.StylePlayer.seekbarRightButton);

            guiStyleDictionary.Add(GuiStyleSet.StyleProgressbar.progressbar.name, GuiStyleSet.StyleProgressbar.progressbar);
            guiStyleDictionary.Add(GuiStyleSet.StyleProgressbar.progressbarThumb.name, GuiStyleSet.StyleProgressbar.progressbarThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleProgressbar.progressbarLeftButton.name, GuiStyleSet.StyleProgressbar.progressbarLeftButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleProgressbar.progressbarRightButton.name, GuiStyleSet.StyleProgressbar.progressbarRightButton);

            guiStyleDictionary.Add(GuiStyleSet.StyleTable.verticalbarHeader.name, GuiStyleSet.StyleTable.verticalbarHeader);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.verticalbarHeaderThumb.name, GuiStyleSet.StyleTable.verticalbarHeaderThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.verticalbarHeaderUpButton.name, GuiStyleSet.StyleTable.verticalbarHeaderUpButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.verticalbarHeaderDownButton.name, GuiStyleSet.StyleTable.verticalbarHeaderDownButton);

            guiStyleDictionary.Add(GuiStyleSet.StyleTable.horizontalbarHeader.name, GuiStyleSet.StyleTable.horizontalbarHeader);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.horizontalbarHeaderThumb.name, GuiStyleSet.StyleTable.horizontalbarHeaderThumb);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.horizontalbarHeaderLeftButton.name, GuiStyleSet.StyleTable.horizontalbarHeaderLeftButton);
            guiStyleDictionary.Add(GuiStyleSet.StyleTable.horizontalbarHeaderRightButton.name, GuiStyleSet.StyleTable.horizontalbarHeaderRightButton);
        }