コード例 #1
0
        /// <summary>
        /// Initializes the current GameplayView with the provided beatmap.
        /// </summary>
        /// <param name="beatmap">The beatmap to play through</param>
        public void Init(Beatmap beatmap)
        {
            try
            {
                if (!beatmap.FullyLoaded)
                {
                    beatmap = BeatmapHelper.Load(beatmap.Path, beatmap.FileName);
                }

                // Reset in case it wasn't properly handled outside
                Reset();

                // Load values gained from config/user settings
                LoadConfig(beatmap);

                // Initialize default variables, parse beatmap
                InitializeVariables(beatmap);

                // Initialize Gameplay variables
                InitializeGameplay(beatmap);

                // Create columns and their hitobjects
                CreateColumns();

                // Sort the hitobjects according to their first appearance for optimizing update/draw
                SortHitObjects();

                if (AutoPlay)
                {
                    LoadAutoPlay();
                }

                // Once everything is loaded, initialize the view
                GetGameplayView().Init();

                // Start audio and gameplay
                StartGameplay();

                // Collect any excess memory to prevent GC from starting soon, avoiding freezes.
                // TODO: disable GC while in gameplay
                GC.Collect();

                Init();
            }
            catch
            {
                // Force quit
                EndGameplay();

                // Give warning
                PulsarcLogger.Warning($"There was an error attempting to load {beatmap.Title}, " +
                                      $"going back to Song Select!");

                // Remove Result Screen
                ScreenManager.RemoveScreen();
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes the current GameplayView with the provided beatmap.
        /// </summary>
        /// <param name="beatmap">The beatmap to play through</param>
        public void Init(Beatmap beatmap)
        {
            if (!beatmap.FullyLoaded)
            {
                beatmap = BeatmapHelper.Load(beatmap.Path, beatmap.FileName);
            }

            // Reset in case it wasn't properly handled outside
            Reset();

            // Load values gained from config/user settings
            LoadConfig();

            // Initialize default variables, parse beatmap
            InitializeVariables(beatmap);

            // Initialize Gameplay variables
            InitializeGameplay(beatmap);

            // Create columns and their hitobjects
            CreateColumns();

            // Sort the hitobjects according to their first appearance for optimizing update/draw
            SortHitObjects();

            if (AutoPlay)
            {
                LoadAutoPlay();
            }

            // Once everything is loaded, initialize the view
            GetGameplayView().Init();

            // Start audio and gameplay
            StartGameplay();

            // Collect any excess memory to prevent GC from starting soon, avoiding freezes.
            // TODO: disable GC while in gameplay
            GC.Collect();

            Init();
        }
コード例 #3
0
ファイル: BeatmapData.cs プロジェクト: PulsarcGame/Pulsarc
 /// <summary>
 /// Make a new BeatmapData out of a Beatmap by loading
 /// the Beatmap from the provided path.
 /// </summary>
 /// <param name="path">Path to the Beatmap folder.</param>
 /// <param name="file">File name of the .psc Beatmap.</param>
 public BeatmapData(string path, string file) : this(BeatmapHelper.Load(path, file))
 {
 }
コード例 #4
0
 /// <summary>
 /// Legacy.
 /// Initialize this gameplay view by using the folder location and
 /// difficulty name to find the beatmap.
 /// </summary>
 /// <param name="folder">Beatmap folder name.</param>
 /// <param name="diff">Difficulty name for the beatmap.</param>
 public void Init(string folder, string diff)
 => Init(BeatmapHelper.Load("Songs/" + folder, diff + ".psc"));