Esempio n. 1
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public override void OnFirstUpdate()
        {
            MapLoadingScreen.AddModsFromIdentifiers(OnlineManager.GetSelfActivatedMods());

            if (PlayTrackOnFirstUpdate)
            {
                var view = (MultiplayerScreenView)View;
                view.Map.UpdateContent();
            }

            base.OnFirstUpdate();
        }
        /// <summary>
        ///     Loads the currently selected map asynchronously.
        /// </summary>
        private void ParseAndLoadMap()
        {
            // Throw an exception if there is no selected map.
            if (MapManager.Selected.Value == null)
            {
                throw new Exception("No selected map, we should not be on this screen!");
            }

            MapManager.Selected.Value.Qua = MapManager.Selected.Value.LoadQua();

            if (Replay != null)
            {
                AddModsFromIdentifiers(Replay.Mods);
            }

            if (OnlineManager.CurrentGame != null)
            {
                AddModsFromIdentifiers(OnlineManager.GetSelfActivatedMods());
            }

            MapManager.Selected.Value.Qua.ApplyMods(ModManager.Mods);

            // Generate seed and randomize lanes if Randomize modifier is active.
            if (ModManager.IsActivated(ModIdentifier.Randomize))
            {
                int seed;

                // If loading from a replay.
                if (Replay != null)
                {
                    seed = Replay.RandomizeModifierSeed;
                }
                // If loading gameplay.
                else
                {
                    var randomizeModifier = (ModRandomize)ModManager.CurrentModifiersList.Find(x => x.ModIdentifier.Equals(ModIdentifier.Randomize));
                    randomizeModifier.GenerateSeed();
                    seed = randomizeModifier.Seed;
                }

                MapManager.Selected.Value.Qua.RandomizeLanes(seed);
            }

            // Asynchronously write to a file for livestreamers the difficulty rating
            using (var writer = File.CreateText(ConfigManager.DataDirectory + "/temp/Now Playing/difficulty.txt"))
                writer.Write($"{MapManager.Selected.Value.DifficultyFromMods(ModManager.Mods):0.00}");

            using (var writer = File.CreateText(ConfigManager.DataDirectory + "/temp/Now Playing/map.txt"))
                writer.Write($"{MapManager.Selected.Value.Qua.Artist} - {MapManager.Selected.Value.Qua.Title} [{MapManager.Selected.Value.Qua.DifficultyName}] ");
        }