private void fadeInThumbnail() { if (previewThumbnail.Texture == null) { return; } if (disallowAudioPreview || sampleTrack != null) { previewThumbnail.FadeTo(1, 400, EasingTypes.Out); previewThumbnail.ScaleTo(1.2f, 600, EasingTypes.OutElastic); } else { previewThumbnail.FadeTo(0.6f, 5000, EasingTypes.Out); previewThumbnail.ScaleTo(1.2f, 20000, EasingTypes.Out); } }
internal void SetStatus(bool status, Mods specificStatus = Mods.None, bool playSound = true) { Sprites.ForEach(s => { s.FadeOut(100); s.ScaleTo(1, 400, EasingTypes.OutElastic); s.RotateTo(0, 400, EasingTypes.OutElastic); }); Mods lastState = State; if (!status) { State = Mods.None; Sprites[0].FadeIn(100); } else { pSprite match = Sprites.Find(s => s.TagNumeric == (int)specificStatus); if (match == null || specificStatus == Mods.None) { match = Sprites[0]; } State = (Mods)match.TagNumeric; match.FadeIn(100); match.ScaleTo(1.2f, 400, EasingTypes.OutElastic); match.RotateTo(0.1f, 400, EasingTypes.OutElastic); } glow.FadeTo(State == Mods.None ? 0 : 0.2f, 100); if (lastState != State && playSound) { AudioEngine.Click(null, State != Mods.None ? @"check-on" : @"check-off"); } if (StateChanged != null) { StateChanged(this, null); } }
internal void Select() { background.FadeTo(1f, 500); }
private void updateBackground(AlignmentMode alignmentMode, BackgroundAdjustmentDelegate backgroundAdjustment, pTexture loadedTexture = null) { if (!showBackground) { return; } if (BackgroundSprite != null && GameBase.Time >= Menu.IntroLength) { BackgroundSprite.FadeTo(1, 100); } if (loadedTexture == null || loadedTexture.IsDisposed) { //we need to load a new texture. int updateCountAtStart = backgroundUpdateCount; GameBase.RunBackgroundThread(delegate { if (updateCountAtStart != backgroundUpdateCount) { return; } pTexture loaded = null; //load from beatmap if (BeatmapManager.Current != null && !string.IsNullOrEmpty(BeatmapManager.Current.BackgroundImage)) { switch (GameBase.Mode) { case OsuModes.Edit: case OsuModes.SelectEdit: case OsuModes.SelectMulti: case OsuModes.SelectPlay: case OsuModes.Play: case OsuModes.Rank: case OsuModes.RankingTagCoop: case OsuModes.RankingTeam: case OsuModes.RankingVs: loaded = TextureManager.Load(BeatmapManager.Current.BackgroundImage, SkinSource.Beatmap); if (loaded != null) { loaded.Disposable = true; } break; } } #if CHRISTMAS if (loaded == null) { const int available_xmas_backgrounds = 13; if (loadedBackgroundIndex < 0) { loadedBackgroundIndex = RNG.Next(1, available_xmas_backgrounds + 1); } else if (GameBase.Mode == OsuModes.Menu) { loadedBackgroundIndex = Math.Max(1, (loadedBackgroundIndex + 1) % (available_xmas_backgrounds + 1)); } loaded = TextureManager.Load(@"menu-background-xmas-" + loadedBackgroundIndex, SkinSource.Osu); } #endif //if we are a supporter, we can also check the skin for a custom menu-background. if (loaded == null && (BanchoClient.Permission & Permissions.Supporter) > 0 && !SkinManager.IsDefault) { loaded = TextureManager.Load(@"menu-background.jpg", SkinSource.Skin); } //if we still haven't found a texture, we can fall back to the default. if (loaded == null) { loaded = TextureManager.Load(@"menu-background", SkinSource.Osu); } //perform the final load. if (loaded != null) { GameBase.Scheduler.Add(delegate { if (updateCountAtStart != backgroundUpdateCount) { return; } updateBackground(alignmentMode, backgroundAdjustment, loaded); }); } }); } else { //we have finished loading a texture. BackgroundTexture = loadedTexture; loadedBackgroundMode = BanchoClient.Permission; bool isSameTexture = BackgroundSprite != null && BackgroundTexture == BackgroundSprite.Texture; if (isSameTexture && currentBackgroundAdjustment == null && backgroundAdjustment == null && currentAlignmentMode == alignmentMode) { return; } bool firstChange = BackgroundSprite == null; ClearBackground(false); BackgroundSprite = createBackgroundSprite(alignmentMode); if (GameBase.Time >= Menu.IntroLength) { BackgroundSprite.FadeInFromZero(50); } else { BackgroundSprite.Alpha = 0; } updateBackgroundAlignment(BackgroundSprite, alignmentMode, backgroundAdjustment); SpriteManager backgroundSpriteManager = (alignmentMode & AlignmentMode.Widescreen) != 0 ? spriteManagerBackWide : spriteManagerBack; backgroundSpriteManager.Add(BackgroundSprite); if (TrianglesBack != null) { if (SkinManager.Current.TriangleColours.Count != 0) { GameBase.Scheduler.Add(delegate { TrianglesBack.SetColours(SkinManager.Current.TriangleColours); }); } else { switch (BackgroundTexture.Source) { case SkinSource.Beatmap: TrianglesBack.SetColours(BeatmapManager.Current.GetFileStream(BeatmapManager.Current.BackgroundImage), finishedReadingColours); break; case SkinSource.Skin: Stream stream = new FileStream(BackgroundTexture.Filename, FileMode.Open, FileAccess.Read, FileShare.Read); TrianglesBack.SetColours(stream, finishedReadingColours); break; default: TrianglesBack.SetColours(null, finishedReadingColours); break; } } } if (OnBackgroundChanged != null) { OnBackgroundChanged(); } TrianglesBack.VelocityCurrent = firstChange ? 150 : 50; } }