private void tsmiCmsRemoveHighlightedMods_Click(object sender, EventArgs e)
 {
     if (HasSelectedNode)
     {
         ModSelectionController.RemoveMod(SelectedMods.ToArray());
     }
 }
 private void tsmiCmsCheckHighlightedModsForUpdates_Click(object sender, EventArgs e)
 {
     if (HasSelectedNode)
     {
         ModSelectionController.CheckForModUpdatesAsync(SelectedMods.ToArray());
     }
 }
示例#3
0
        private void load()
        {
            dependencies.CacheAs(this);

            dependencies.Cache(SentryLogger);

            dependencies.Cache(osuLogo = new OsuLogo {
                Alpha = 0
            });

            // bind config int to database RulesetInfo
            configRuleset = LocalConfig.GetBindable <int>(OsuSetting.Ruleset);

            var preferredRuleset = RulesetStore.GetRuleset(configRuleset.Value);

            try
            {
                Ruleset.Value = preferredRuleset ?? RulesetStore.AvailableRulesets.First();
            }
            catch (Exception e)
            {
                // on startup, a ruleset may be selected which has compatibility issues.
                Logger.Error(e, $@"Failed to switch to preferred ruleset {preferredRuleset}.");
                Ruleset.Value = RulesetStore.AvailableRulesets.First();
            }

            Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0;

            // bind config int to database SkinInfo
            configSkin = LocalConfig.GetBindable <int>(OsuSetting.Skin);
            SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID;
            configSkin.ValueChanged += skinId =>
            {
                var skinInfo = SkinManager.Query(s => s.ID == skinId.NewValue);

                if (skinInfo == null)
                {
                    switch (skinId.NewValue)
                    {
                    case -1:
                        skinInfo = DefaultLegacySkin.Info;
                        break;

                    default:
                        skinInfo = SkinInfo.Default;
                        break;
                    }
                }

                SkinManager.CurrentSkinInfo.Value = skinInfo;
            };
            configSkin.TriggerChange();

            IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);

            Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);

            SelectedMods.BindValueChanged(modsChanged);
            Beatmap.BindValueChanged(beatmapChanged, true);
        }
 private void tsmiUpdateHiglightedMods_Click(object sender, EventArgs e)
 {
     if (HasSelectedNode)
     {
         ModSelectionController.UpdateOutdatedModsAsync(SelectedMods.ToArray());
     }
 }
示例#5
0
文件: OsuGame.cs 项目: moccy/osu
        private void load()
        {
            if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild)
            {
                Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
                Environment.Exit(0);
            }

            if (args?.Length > 0)
            {
                var paths = args.Where(a => !a.StartsWith('-')).ToArray();
                if (paths.Length > 0)
                    Task.Run(() => Import(paths));
            }

            dependencies.CacheAs(this);

            dependencies.Cache(SentryLogger);

            dependencies.Cache(osuLogo = new OsuLogo { Alpha = 0 });

            // bind config int to database RulesetInfo
            configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
            Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
            Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0;

            // bind config int to database SkinInfo
            configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
            SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID;
            configSkin.ValueChanged += skinId =>
            {
                var skinInfo = SkinManager.Query(s => s.ID == skinId.NewValue);

                if (skinInfo == null)
                {
                    switch (skinId.NewValue)
                    {
                        case -1:
                            skinInfo = DefaultLegacySkin.Info;
                            break;

                        default:
                            skinInfo = SkinInfo.Default;
                            break;
                    }
                }

                SkinManager.CurrentSkinInfo.Value = skinInfo;
            };
            configSkin.TriggerChange();

            IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);

            Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);

            SelectedMods.BindValueChanged(modsChanged);
            Beatmap.BindValueChanged(beatmapChanged, true);
        }
示例#6
0
        public override void SetUpSteps()
        {
            base.SetUpSteps();

            AddStep("reset", () =>
            {
                Ruleset.Value = new OsuRuleset().RulesetInfo;
                Beatmap.SetDefault();
                SelectedMods.SetDefault();
            });

            AddStep("create song select", () => LoadScreen(songSelect = new TestMultiplayerMatchSongSelect(SelectedRoom.Value)));
            AddUntilStep("wait for present", () => songSelect.IsCurrentScreen() && songSelect.BeatmapSetsLoaded);
        }
        public override void SetUpSteps()
        {
            base.SetUpSteps();

            AddStep("reset defaults", () =>
            {
                Ruleset.Value = new OsuRuleset().RulesetInfo;

                Beatmap.SetDefault();
                SelectedMods.SetDefault();

                songSelect = null;
            });

            AddStep("delete all beatmaps", () => manager?.Delete());
        }
示例#8
0
        protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
        {
            var host = parent.Get <GameHost>();

            headlessHostStorage = (host as HeadlessGameHost)?.Storage;

            Resources = parent.Get <OsuGameBase>().Resources;

            realm = new Lazy <RealmAccess>(() => new RealmAccess(LocalStorage, OsuGameBase.CLIENT_DATABASE_FILENAME, host.UpdateThread));

            RecycleLocalStorage(false);

            var baseDependencies = base.CreateChildDependencies(parent);

            // to isolate ruleset configs in tests from the actual database and avoid state pollution problems,
            // as well as problems due to the implementation details of the "real" implementation (the configs only being available at `LoadComplete()`),
            // cache a test implementation of the ruleset config cache over the "real" one.
            var isolatedBaseDependencies = new DependencyContainer(baseDependencies);

            isolatedBaseDependencies.CacheAs(RulesetConfigs = new TestRulesetConfigCache());
            baseDependencies = isolatedBaseDependencies;

            var providedRuleset = CreateRuleset();

            if (providedRuleset != null)
            {
                isolatedBaseDependencies = rulesetDependencies = new DrawableRulesetDependencies(providedRuleset, baseDependencies);
            }

            Dependencies = isolatedBaseDependencies;

            Beatmap.Default = parent.Get <Bindable <WorkingBeatmap> >().Default;
            Beatmap.SetDefault();

            Ruleset.Value = CreateRuleset()?.RulesetInfo ?? parent.Get <RulesetStore>().AvailableRulesets.First();

            SelectedMods.SetDefault();

            if (!UseOnlineAPI)
            {
                dummyAPI = new DummyAPIAccess();
                Dependencies.CacheAs <IAPIProvider>(dummyAPI);
                base.Content.Add(dummyAPI);
            }

            return(Dependencies);
        }
示例#9
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            var parentBeatmap = Parent.Dependencies.Get <Bindable <WorkingBeatmap> >();

            parentBeatmap.Value = Beatmap.Value;
            Beatmap.BindTo(parentBeatmap);

            var parentRuleset = Parent.Dependencies.Get <Bindable <RulesetInfo> >();

            parentRuleset.Value = Ruleset.Value;
            Ruleset.BindTo(parentRuleset);

            var parentMods = Parent.Dependencies.Get <Bindable <IReadOnlyList <Mod> > >();

            parentMods.Value = SelectedMods.Value;
            SelectedMods.BindTo(parentMods);
        }
示例#10
0
        public void TestCustomisationToggleState()
        {
            createScreen();
            assertCustomisationToggleState(disabled: true, active: false);

            AddStep("select customisable mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime() });
            assertCustomisationToggleState(disabled: false, active: false);

            AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() });
            assertCustomisationToggleState(disabled: false, active: true);

            AddStep("dismiss mod customisation via toggle", () =>
            {
                InputManager.MoveMouseTo(modSelectOverlay.ChildrenOfType <ShearedToggleButton>().Single());
                InputManager.Click(MouseButton.Left);
            });
            assertCustomisationToggleState(disabled: false, active: false);

            AddStep("reset mods", () => SelectedMods.SetDefault());
            AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() });
            assertCustomisationToggleState(disabled: false, active: true);

            AddStep("dismiss mod customisation via keyboard", () => InputManager.Key(Key.Escape));
            assertCustomisationToggleState(disabled: false, active: false);

            AddStep("append another mod not requiring config", () => SelectedMods.Value = SelectedMods.Value.Append(new OsuModFlashlight()).ToArray());
            assertCustomisationToggleState(disabled: false, active: false);

            AddStep("select mod without configuration", () => SelectedMods.Value = new[] { new OsuModAutoplay() });
            assertCustomisationToggleState(disabled: true, active: false);

            AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() });
            assertCustomisationToggleState(disabled: false, active: true);

            AddStep("select mod without configuration", () => SelectedMods.Value = new[] { new OsuModAutoplay() });
            assertCustomisationToggleState(disabled: true, active: false); // config was dismissed without explicit user action.
        }
        /// <summary>
        /// Sets the conflict result.
        /// </summary>
        /// <param name="conflictResult">The conflict result.</param>
        /// <param name="activeMods">The active mods.</param>
        /// <param name="collectionName">Name of the collection.</param>
        public virtual void SetConflictResult(IConflictResult conflictResult, IReadOnlyList <string> activeMods, string collectionName)
        {
            async Task valuesSet()
            {
                await Task.Delay(50);

                settingValues = false;
            }

            this.collectionName = collectionName;
            ConflictResult      = conflictResult;
            previousIgnoredPath = conflictResult?.IgnoredPaths ?? string.Empty;
            isOpen?.Dispose();
            isOpen = this.WhenAnyValue(p => p.IsOpen).Where(p => p).Subscribe(s =>
            {
                settingValues = true;
                Mods.Clear();
                SelectedMods.Clear();
                Mods.AddRange(activeMods.Select(p => new Mod()
                {
                    Name = p
                }));
                var ignoredMods = modPatchCollectionService.GetIgnoredMods(ConflictResult).Select(p => new Mod()
                {
                    Name = p
                }).ToList();
                var selectedMods = Mods.ToList().Except(ignoredMods);
                SelectedMods.AddRange(selectedMods);
                shouldToggleGameMods       = false;
                previousIgnoreGameMods     = IgnoreGameMods = modPatchCollectionService.ShouldIgnoreGameMods(conflictResult).GetValueOrDefault();
                previousShowSelfConflicts  = ShowSelfConflicts = modPatchCollectionService.ShouldShowSelfConflicts(conflictResult).GetValueOrDefault();
                previousShowResetConflicts = ShowResetConflicts = modPatchCollectionService.ShouldShowResetConflicts(conflictResult).GetValueOrDefault();
                ResetView = false;
                ResetView = true;
                valuesSet().ConfigureAwait(false);
            }).DisposeWith(Disposables);
        }
 protected override void LoadComplete()
 {
     base.LoadComplete();
     SelectedMods.BindValueChanged(_ => updateMods());
 }
 private void tsmiCmsRefreshCheckedStateForHighlightedMods_Click(object sender, EventArgs e)
 {
     ModSelectionController.RefreshCheckedStateOfModsAsync(SelectedMods.ToArray());
 }
示例#14
0
 public void SetUpSteps()
 {
     AddStep("clear contents", Clear);
     AddStep("reset ruleset", () => Ruleset.Value = rulesetStore.GetRuleset(0));
     AddStep("reset mods", () => SelectedMods.SetDefault());
 }
 private void btnProceedHighlighted_Click(object sender, EventArgs e)
 {
     ModSelectionController.ProcessModsAsync(SelectedMods.ToArray());
 }
示例#16
0
        /// <summary>
        /// Called when [activated].
        /// </summary>
        /// <param name="disposables">The disposables.</param>
        protected override void OnActivated(CompositeDisposable disposables)
        {
            ShowAdvancedFeatures = (gameService.GetSelected()?.AdvancedFeaturesSupported).GetValueOrDefault();

            var allowModSelectionEnabled = this.WhenAnyValue(v => v.AllowModSelection);

            RenameCommand = ReactiveCommand.Create(() =>
            {
                return(new CommandResult <ModifyAction>(ModifyAction.Rename, CommandState.Success));
            }, allowModSelectionEnabled).DisposeWith(disposables);

            DuplicateCommand = ReactiveCommand.CreateFromTask(async() =>
            {
                if (ActiveCollection != null)
                {
                    var copy = CopyCollection(ActiveCollection.Name);
                    if (modCollectionService.Save(copy))
                    {
                        var id = idGenerator.GetNextId();
                        await TriggerOverlayAsync(id, true, localizationManager.GetResource(LocalizationResources.Collection_Mods.Overlay_Duplicate_Message));
                        await Task.Run(async() =>
                        {
                            await modPatchCollectionService.CopyPatchCollectionAsync(ActiveCollection.Name, copy.Name).ConfigureAwait(false);
                        }).ConfigureAwait(false);
                        await TriggerOverlayAsync(id, false);
                        return(new CommandResult <ModifyAction>(ModifyAction.Duplicate, CommandState.Success));
                    }
                    else
                    {
                        return(new CommandResult <ModifyAction>(ModifyAction.Duplicate, CommandState.Failed));
                    }
                }
                return(new CommandResult <ModifyAction>(ModifyAction.Duplicate, CommandState.NotExecuted));
            }, allowModSelectionEnabled).DisposeWith(disposables);

            MergeOpenCommand = ReactiveCommand.Create(() =>
            {
                IsMergeOpen = true;
            }, allowModSelectionEnabled).DisposeWith(disposables);

            MergeCloseCommand = ReactiveCommand.Create(() =>
            {
                IsMergeOpen = false;
            }).DisposeWith(disposables);

            MergeAdvancedCommand = ReactiveCommand.CreateFromTask(async() =>
            {
                if (ActiveCollection != null && ActiveCollection.Mods?.Count() > 0)
                {
                    var copy = await GetMergedCollectionAsync();

                    var id = idGenerator.GetNextId();
                    await TriggerOverlayAsync(id, true, localizationManager.GetResource(LocalizationResources.App.WaitBackgroundOperationMessage));
                    await shutDownState.WaitUntilFreeAsync();

                    var savedCollection = modCollectionService.GetAll().FirstOrDefault(p => p.IsSelected);
                    while (savedCollection == null)
                    {
                        await Task.Delay(25);
                        savedCollection = modCollectionService.GetAll().FirstOrDefault(p => p.IsSelected);
                    }

                    SubscribeToProgressReports(id, disposables, MergeType.Advanced);

                    var mode = await modPatchCollectionService.GetPatchStateModeAsync(ActiveCollection.Name);
                    if (mode == PatchStateMode.None)
                    {
                        // fallback to default mod if no patch collection specified
                        mode = PatchStateMode.Default;
                    }

                    var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new
                    {
                        PercentDone = 0.ToLocalizedPercentage(),
                        Count       = 1,
                        TotalCount  = 4
                    });
                    var message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Advanced.Overlay_Loading_Definitions);
                    await TriggerOverlayAsync(id, true, message, overlayProgress);

                    modPatchCollectionService.ResetPatchStateCache();
                    var definitions = await Task.Run(async() =>
                    {
                        return(await modPatchCollectionService.GetModObjectsAsync(gameService.GetSelected(), SelectedMods, copy.Name).ConfigureAwait(false));
                    }).ConfigureAwait(false);

                    var conflicts = await Task.Run(() =>
                    {
                        if (definitions != null)
                        {
                            return(modPatchCollectionService.FindConflicts(definitions, SelectedMods.Select(p => p.Name).ToList(), mode));
                        }
                        return(null);
                    }).ConfigureAwait(false);

                    await modPatchCollectionService.CleanPatchCollectionAsync(copy.Name);

                    var mergeMod = await Task.Run(async() =>
                    {
                        return(await modMergeService.MergeCollectionByDefinitionsAsync(conflicts, SelectedMods.Select(p => p.Name).ToList(), copy.Name).ConfigureAwait(false));
                    }).ConfigureAwait(false);
                    copy.Mods = new List <string>()
                    {
                        mergeMod.DescriptorFile
                    };

                    await TriggerOverlayAsync(id, false);

                    definitionAnalyzeLoadHandler?.Dispose();
                    definitionLoadHandler?.Dispose();
                    definitionMergeProgressHandler?.Dispose();

                    modCollectionService.Delete(copy.Name);
                    modPatchCollectionService.InvalidatePatchModState(copy.Name);
                    if (modCollectionService.Save(copy))
                    {
                        return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.Success));
                    }
                    else
                    {
                        return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.Failed));
                    }
                }
                return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.NotExecuted));
            }, allowModSelectionEnabled).DisposeWith(disposables);

            MergeBasicCommand = ReactiveCommand.CreateFromTask(async() =>
            {
                if (ActiveCollection != null && ActiveCollection.Mods?.Count() > 0)
                {
                    var copy = await GetMergedCollectionAsync();
                    var id   = idGenerator.GetNextId();

                    await TriggerOverlayAsync(id, true, localizationManager.GetResource(LocalizationResources.App.WaitBackgroundOperationMessage));
                    await shutDownState.WaitUntilFreeAsync();

                    var savedCollection = modCollectionService.GetAll().FirstOrDefault(p => p.IsSelected);
                    while (savedCollection == null)
                    {
                        await Task.Delay(25);
                        savedCollection = modCollectionService.GetAll().FirstOrDefault(p => p.IsSelected);
                    }

                    SubscribeToProgressReports(id, disposables, MergeType.Basic);

                    var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new
                    {
                        PercentDone = 0.ToLocalizedPercentage(),
                        Count       = 1,
                        TotalCount  = 2
                    });
                    var message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Basic.Overlay_Gathering_Mod_Info);
                    await TriggerOverlayAsync(id, true, message, overlayProgress);

                    await modPatchCollectionService.CleanPatchCollectionAsync(copy.Name);

                    var mergeMod = await Task.Run(async() =>
                    {
                        return(await modMergeService.MergeCollectionByFilesAsync(copy.Name));
                    }).ConfigureAwait(false);
                    copy.Mods = new List <string>()
                    {
                        mergeMod.DescriptorFile
                    };

                    await TriggerOverlayAsync(id, false);
                    fileMergeProgressHandler?.Dispose();

                    modCollectionService.Delete(copy.Name);
                    modPatchCollectionService.InvalidatePatchModState(copy.Name);
                    if (modCollectionService.Save(copy))
                    {
                        return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.Success));
                    }
                    else
                    {
                        return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.Failed));
                    }
                }
                return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.NotExecuted));
            }, allowModSelectionEnabled).DisposeWith(disposables);

            MergeCompressCommand = ReactiveCommand.CreateFromTask(async() =>
            {
                if (ActiveCollection != null && ActiveCollection.Mods?.Count() > 0)
                {
                    var copy = await GetMergedCollectionAsync();
                    var id   = idGenerator.GetNextId();

                    await TriggerOverlayAsync(id, true, localizationManager.GetResource(LocalizationResources.App.WaitBackgroundOperationMessage));
                    await shutDownState.WaitUntilFreeAsync();

                    var savedCollection = modCollectionService.GetAll().FirstOrDefault(p => p.IsSelected);
                    while (savedCollection == null)
                    {
                        await Task.Delay(25);
                        savedCollection = modCollectionService.GetAll().FirstOrDefault(p => p.IsSelected);
                    }

                    SubscribeToProgressReports(id, disposables, MergeType.Compress);

                    var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new
                    {
                        PercentDone = 0.ToLocalizedPercentage(),
                        Count       = 1,
                        TotalCount  = 2
                    });
                    var message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Compress.Overlay_Gathering_Mod_Info);
                    await TriggerOverlayAsync(id, true, message, overlayProgress);

                    await modPatchCollectionService.CleanPatchCollectionAsync(copy.Name);

                    var mergeMods = await Task.Run(async() =>
                    {
                        return(await modMergeService.MergeCompressCollectionAsync(copy.Name, Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.MergeCompressModPrefix), new
                        {
                            Name = copy.Name.Replace($"{localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.MergedCollectionPrefix)} ", string.Empty)
                        })));
                    }).ConfigureAwait(false);
                    copy.Mods = mergeMods.Select(p => p.DescriptorFile).ToList();

                    await TriggerOverlayAsync(id, false);
                    fileMergeProgressHandler?.Dispose();

                    modCollectionService.Delete(copy.Name);
                    modPatchCollectionService.InvalidatePatchModState(copy.Name);
                    await modService.InstallModsAsync(null);
                    if (modCollectionService.Save(copy))
                    {
                        return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.Success));
                    }
                    else
                    {
                        return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.Failed));
                    }
                }
                return(new CommandResult <ModifyAction>(ModifyAction.Merge, CommandState.NotExecuted));
            }, allowModSelectionEnabled).DisposeWith(disposables);

            base.OnActivated(disposables);
        }
示例#17
0
 private void CommitMods()
 {
     SelectedMods.ReplaceAll(ModListBox.SelectedItems.Cast <Mod>());
     DialogResult = true;
     Close();
 }
示例#18
0
文件: OsuGame.cs 项目: bdach/osu
        private void load()
        {
            dependencies.CacheAs(this);

            dependencies.Cache(SentryLogger);

            dependencies.Cache(osuLogo = new OsuLogo {
                Alpha = 0
            });

            // bind config int to database RulesetInfo
            configRuleset = LocalConfig.GetBindable <string>(OsuSetting.Ruleset);
            uiScale       = LocalConfig.GetBindable <float>(OsuSetting.UIScale);

            var preferredRuleset = int.TryParse(configRuleset.Value, out int rulesetId)
                                   // int parsing can be removed 20220522
                ? RulesetStore.GetRuleset(rulesetId)
                : RulesetStore.GetRuleset(configRuleset.Value);

            try
            {
                Ruleset.Value = preferredRuleset ?? RulesetStore.AvailableRulesets.First();
            }
            catch (Exception e)
            {
                // on startup, a ruleset may be selected which has compatibility issues.
                Logger.Error(e, $@"Failed to switch to preferred ruleset {preferredRuleset}.");
                Ruleset.Value = RulesetStore.AvailableRulesets.First();
            }

            Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ShortName;

            // bind config int to database SkinInfo
            configSkin = LocalConfig.GetBindable <string>(OsuSetting.Skin);
            SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID.ToString();
            configSkin.ValueChanged += skinId =>
            {
                ILive <SkinInfo> skinInfo = null;

                if (Guid.TryParse(skinId.NewValue, out var guid))
                {
                    skinInfo = SkinManager.Query(s => s.ID == guid);
                }

                if (skinInfo == null)
                {
                    if (guid == SkinInfo.CLASSIC_SKIN)
                    {
                        skinInfo = DefaultLegacySkin.CreateInfo().ToLive();
                    }
                }

                SkinManager.CurrentSkinInfo.Value = skinInfo ?? DefaultSkin.CreateInfo().ToLive();
            };
            configSkin.TriggerChange();

            IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);

            Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);

            SelectedMods.BindValueChanged(modsChanged);
            Beatmap.BindValueChanged(beatmapChanged, true);
        }
示例#19
0
 public void SetUpSteps()
 {
     AddStep("reset mods", () => SelectedMods.SetDefault());
 }