private void Show() { if (!GameBase.HasLogin) { return; } if (lastShow >= 0) { if (count < 5) { coinsBuyButton.FadeIn(300); } lastShow = GameBase.Time; return; } GameBase.Scheduler.AddDelayed(delegate { lastShow = GameBase.Time; spriteManager.SpriteList.ForEach(s => { s.MoveToRelative(new Vector2(0, 35), 500, EasingTypes.Out); }); coinsBg.FadeIn(300); GameBase.Scheduler.AddDelayed(delegate { coinsFg.FadeIn(300); coinsCount.FadeIn(300); if (count < 5) { coinsBuyButton.FadeIn(300); } }, 300); }, 500); }
private void ExecuteSearch(bool newSearch) { if (searching) { return; } if (newSearch) { pageOffset = 0; canLoadMore = false; } searching = true; pWebRequest req = new pWebRequest(string.Format(Urls.DIRECT_SEARCH, ConfigManager.sUsername, ConfigManager.sPassword, (int)displayModeDropdown.SelectedObject, GeneralHelper.UrlEncodeParam(lastSearch), (int)displayOsuModeDropdown.SelectedObject, pageOffset)); req.Finished += req_onFinish; req.Perform(); searchInfo.Text = newSearch ? "Searching..." : "Loading..."; if (newSearch) { loadingText.FadeIn(200); Beatmaps.ForEach(b => b.Dim()); } }
internal void SetVolume(int val) { if (val == volume.Value) { return; } Visible = true; int volumeBefore = volume.Value; volume.Value = val; if (volume.Value == 100) { backgroundMax.Bypass = false; backgroundMax.FadeIn(150); } else { backgroundMax.FadeOut(150); } AudioEngine.Click(null, @"sliderbar", 1.1f - (0.5f - (volume.Value / 100f)) * 0.15f * (volume.Value != volumeBefore ? 1 : 4)); return; }
private void updateDroppedFrames() { double droppedFrames = droppedFramesLast; const int fade_time = 800; if (newDroppedFrame) { droppedFrames = Math.Min(dropped_frames_to_display, Math.Ceiling(droppedFrames + 1)); newDroppedFrame = false; } else { droppedFrames = Math.Max(0, droppedFrames - GameBase.ElapsedMilliseconds / fade_time); } int lastCeil = (int)Math.Ceiling(droppedFramesLast); int ceil = (int)Math.Ceiling(droppedFrames); if (ceil < lastCeil) { for (int i = ceil; i < dropped_frames_to_display; i++) { droppedFrameSprites[ceil].FadeOut(200, EasingTypes.None, (int)(ceil * (fade_time * 0.4))); } } else if (ceil > lastCeil) { pSprite s = droppedFrameSprites[ceil - 1]; s.FadeIn(40); } droppedFramesLast = droppedFrames; }
private void UpdateDimming() { if (!GameBase.SixtyFramesPerSecondFrame) { return; } if (currentDim > DimMaximum + float.Epsilon) { currentDim -= (currentDim - DimMaximum) / adjust_rate; } else if (!BreakMode && currentDim < DimMaximum) { currentDim += (DimMaximum - currentDim) / adjust_rate; if (GameBase.Mode == OsuModes.Play && breakTop.TagNumeric == 1) { if (BeatmapManager.Current.LetterboxInBreaks) { breakTop.FadeOut(200); breakBottom.FadeOut(200); } } breakTop.TagNumeric = 0; } else if (BreakMode && (currentDim != DimMinimum || breakTop.TagNumeric == 0)) { if (currentDim > DimMinimum) { currentDim -= (currentDim - DimMinimum) / adjust_rate; } else { currentDim += (DimMinimum - currentDim) / adjust_rate; } if (GameBase.Mode == OsuModes.Play && breakTop.TagNumeric == 0 && !afterGameplay && !beforeGameplay) { if (BeatmapManager.Current.LetterboxInBreaks) { breakTop.FadeIn(200); breakBottom.FadeIn(200); } } breakTop.TagNumeric = 1; } float blackness = currentDim / 100f; spriteManagerBGWide.Blackness = blackness; spriteManagerBG.Blackness = blackness; spriteManagerFG.Blackness = blackness; spriteManagerMasking.Blackness = blackness; GameBase.TransitionManager.BackgroundAlpha = (1 - blackness) * VideoEfficiency; }
internal void ShowRankings() { foreach (pDrawable p in rankSprites) { p.FadeIn(200); } s_StarBg.FadeIn(200); s_Star.FadeIn(200); }
internal virtual void SlideIn() { s_barFill.FadeIn(500); s_barBg.FadeIn(500); s_kiIcon.FadeIn(500); s_barFill.MoveTo(s_barFill.InitialPosition, 500); s_barBg.MoveTo(s_barBg.InitialPosition, 500); s_kiIcon.Transformations.Add(new Transformation(TransformationType.Scale, 1.6f, 1, GameBase.Time, GameBase.Time + 500)); }
public void Show() { Visible = true; if (Sprites != null) { spriteBackground.FadeIn(200); spriteForeground.FadeIn(200); spriteInfo.FadeIn(200); spriteName.FadeIn(200); spriteAvatar.FadeIn(200); } }
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); } }
public void Draw(GameTime gameTime) { if (Visible) { GameBase.primitiveBatch.Begin(PrimitiveType.LineList); GameBase.primitiveBatch.AddVertex( GameBase.WindowRatioApply(position), lineColour); GameBase.primitiveBatch.AddVertex( GameBase.WindowRatioApply(position + new Vector2(length, 0)), lineColour); GameBase.primitiveBatch.End(); } if (Visible && !seekbar1.IsVisible) { seekbar1.FadeIn(200); } else if (!Visible && seekbar1.IsVisible) { seekbar1.FadeOut(200); } }
private void s_Hover(object sender, EventArgs e) { pSprite p = sender as pSprite; if (currentTier != (Tiers)p.TagNumeric) { return; } if (p.Tag != null) { pSprite p2 = ((pSprite)p.Tag); p2.Transformations.Clear(); p2.Transformations.AddRange(p.Transformations); p2.FadeIn(150); } if (Game.IsActive) { AudioEngine.PlaySample(AudioEngine.s_MenuClick); } }
internal override void OnKiaiToggle(bool active) { if (active) { s_KiaiGlow.Transformations.Clear(); s_KiaiGlow.FadeIn(100); s_KiaiGlow.Transformations.Add(new Transformation(TransformationType.Scale, 0.1f, 0.7f, GameBase.Time, GameBase.Time + 120, EasingTypes.Out)); s_BarRight_Kiai.FadeIn(150); mascot.SetState(TaikoMascotStates.Kiai, false); } else { s_KiaiGlow.Transformations.Clear(); s_KiaiGlow.FadeOut(600); s_BarRight_Kiai.FadeOut(150); mascot.SetState(TaikoMascotStates.Idle, false); } base.OnKiaiToggle(active); }
internal virtual void UpdateSprites(TreeItemState lastState, bool instant) { //handle hiding if (state <= TreeItemState.Hidden) { if (SpriteCollection[0].Alpha != 0) { SpriteCollection.ForEach(p => p.FadeOut(instant ? 0 : 200)); } } else if (lastState <= TreeItemState.Hidden) { int showCount = state >= TreeItemState.ExtrasVisible ? SpriteCollection.Count : AlwaysVisibleSprites; for (int i = 0; i < showCount; i++) { SpriteCollection[i].FadeInFromZero(instant ? 0 : 200); } } UpdateHorizontalLayout(); //handle stars if ((state >= TreeItemState.ExtrasVisible && lastState < TreeItemState.ExtrasVisible) || (state < TreeItemState.ExtrasVisible && lastState >= TreeItemState.ExtrasVisible)) { float yPadding = OldLayout ? -3 : 0; float thumbPadding = shouldShowThumbnail ? 75 : 5; if (state >= TreeItemState.ExtrasVisible) { starSpritesBeginIndex = SpriteCollection.Count; blackStarSpritesBeginIndex = blackSprites.Count; Color backgroundStarColour = new Color(255, 255, 255, 30); for (int i = 0; i < AMOUNT_STARS; ++i) { pSprite star = new pSprite(s_star, Fields.TopLeft, Origins.Centre, Clocks.Game, Vector2.Zero, textTitle.Depth, true, backgroundStarColour, Beatmap) { VectorScale = new Vector2(star_scale, star_scale), Tag = new Vector2(leftPadding + thumbPadding + (i + 0.5f) * (s_star.DisplayWidth * 0.625f) * star_scale, yPadding + 18), Additive = true, Alpha = 0 }; if (!OldLayout) { star.Scale = 0.35f; } SpriteCollection.Add(star); } for (int i = 0; i < AMOUNT_STARS; ++i) { pSprite star = new pSprite(s_star, Fields.TopLeft, Origins.Centre, Clocks.Game, Vector2.Zero, textTitle.Depth + DEPTH_INCREASE_STEP, true, Color.White, Beatmap) { VectorScale = new Vector2(star_scale, star_scale), Tag = new Vector2(leftPadding + thumbPadding + (i + 0.5f) * (s_star.DisplayWidth * 0.625f) * star_scale, yPadding + 18), }; if (OldLayout) { star.DrawWidth = -(int)(star.Width * i); } else { star.Scale = 0; } SpriteCollection.Add(star); blackSprites.Add(star); } for (int i = 0; i < SpriteCollection.Count; i++) { pSprite p = SpriteCollection[i] as pSprite; if (i >= AlwaysVisibleSprites && (i < starSpritesBeginIndex || i >= starSpritesBeginIndex + AMOUNT_STARS)) { // We don't want our background sprites to fade in yet p.FadeIn(instant ? 0 : 300); } } UpdateStarDifficultyDisplay(instant); } else { for (int i = 0; i < SpriteCollection.Count; i++) { pSprite p = SpriteCollection[i] as pSprite; if (i >= AlwaysVisibleSprites) { p.FadeOut(instant ? 0 : 300); } } int starSpritesEndIndex = starSpritesBeginIndex + AMOUNT_STARS * 2; for (int i = starSpritesBeginIndex; i < starSpritesEndIndex; ++i) { SpriteCollection[i].AlwaysDraw = false; } SpriteCollection.RemoveRange(starSpritesBeginIndex, AMOUNT_STARS * 2); blackSprites.RemoveRange(blackStarSpritesBeginIndex, AMOUNT_STARS); currentlyVisibleStars = -1; } } //handle expanded state changes. if ((state >= TreeItemState.Expanded && lastState < TreeItemState.Expanded) || (state < TreeItemState.Expanded && lastState >= TreeItemState.Expanded)) { if (state >= TreeItemState.Expanded) { if (thumbnail != null) { thumbnail.Additive = false; thumbnail.FadeInFromZero(instant ? 0 : 1000); thumbnail.TimeBeforeLoad = 100; thumbnail.FadeColour(new Color(255, 255, 255, 255), instant ? 0 : 300); } } else { if (thumbnail != null) { thumbnail.Additive = true; thumbnail.TimeBeforeLoad = 500; thumbnail.FadeColour(new Color(50, 50, 50, 255), instant ? 0 : 300); } } UpdateHorizontalLayout(); } UpdateUnselectedColour(instant ? 0 : 300); //handle active state changes. if (state == TreeItemState.Active) { blackSprites.ForEach(t => { t.InitialColour = BeatmapTreeItem.colourTextActive; }); } else { blackSprites.ForEach(t => { Color c; if (state <= TreeItemState.ExtrasVisible) { c = colourTextInactive; } else { if (t == textArtist || t == textTitle) { c = colourTextInactiveFaded; } else { c = colourTextInactive; } } t.InitialColour = c; }); } }
private void loadBackground(string name) { pVideo newVideo; if (modeBackgroundVideos.TryGetValue(name, out newVideo)) { if (newVideo == activeBackgroundVideo || newVideo == pendingBackgroundVideo) { return; } if (activeBackgroundVideo != null) { newVideo.StartTime = activeBackgroundVideo.StartTime; newVideo.EndTime = newVideo.StartTime + newVideo.video.length; } if (name == backgroundNames[0] && defaultBackgroundVideo == null) { activeBackgroundVideo = newVideo; defaultBackgroundVideo = activeBackgroundVideo; defaultBackgroundVideo.Alpha = 1f; } else { pendingBackgroundVideo = newVideo; pendingBackgroundVideo.SeekToCurrent(true); } } else { pSprite newSprite; if (!modeBackgroundSprites.TryGetValue(name, out newSprite)) { newSprite = defaultBackgroundSprite; } if (name == backgroundNames[0] && defaultBackgroundSprite == null) { defaultBackgroundSprite = newSprite; } if (newSprite == activeBackgroundSprite) { return; } if (activeBackgroundVideo != null && activeBackgroundVideo != defaultBackgroundVideo) { activeBackgroundVideo.FadeOut(500); } activeBackgroundVideo = null; if (activeBackgroundSprite != null && activeBackgroundSprite != defaultBackgroundSprite) { activeBackgroundSprite.FadeOut(500); } activeBackgroundSprite = newSprite; if (activeBackgroundSprite == defaultBackgroundSprite) { activeBackgroundSprite.Alpha = 1f; } activeBackgroundSprite.FadeIn(500); } }
internal BeatmapPanel(Beatmap beatmap, EventHandler action, int index) { base_depth += 0.001f * index; s_BackingPlate = new pSprite(TextureManager.Load(OsuTexture.songselect_panel), Vector2.Zero) { DrawDepth = base_depth, Colour = new Color4(255, 255, 255, 170), Tag = this }; Sprites.Add(s_BackingPlate); Beatmap = beatmap; if (action != null) { s_BackingPlate.OnClick += action; } s_BackingPlate.HandleClickOnUp = true; s_BackingPlate.OnHover += delegate { s_BackingPlate.FadeOut(100, 0.01f); s_BackingPlate2.FadeColour(BACKGROUND_COLOUR, 80); }; s_BackingPlate.OnHoverLost += delegate { s_BackingPlate.FadeIn(60); s_BackingPlate2.FadeColour(Color4.Transparent, 100); }; s_Text = new pText(string.Empty, 26, Vector2.Zero, Vector2.Zero, 0.5f, true, Color4.White, false); s_Text.Bold = true; s_Text.Offset = new Vector2(130, 0); Sprites.Add(s_Text); s_TextArtist = new pText(string.Empty, 26, Vector2.Zero, Vector2.Zero, 0.51f, true, Color4.OrangeRed, false); s_TextArtist.Offset = new Vector2(130, 29); Sprites.Add(s_TextArtist); #if !DIST && !iOS pText s_TextCreator = new pText(string.Empty, 14, Vector2.Zero, Vector2.Zero, 0.52f, true, BACKGROUND_COLOUR, false); s_TextCreator.Origin = OriginTypes.TopRight; s_TextCreator.Field = FieldTypes.StandardSnapRight; //Sprites.Add(s_TextCreator); #endif pTexture thumb = null; float starCount = 0; if (beatmap != null) { try { s_Text.Text = beatmap.Title; s_TextArtist.Text = beatmap.Artist; #if !DIST && !iOS if (s_TextCreator != null) { s_TextCreator.Text = beatmap.Creator; } #endif starCount = beatmap.DifficultyStars / 2f; } catch { //could fail due to corrupt package. } } else { thumb = TextureManager.Load(OsuTexture.songselect_thumb_dl); } if (thumb != null) { s_Thumbnail = new pSprite(thumb, Vector2.Zero) { DrawDepth = base_depth + 0.02f } } ; else { s_Thumbnail = new pSpriteDynamic { LoadDelegate = GetThumbnail, DrawDepth = 0.49f } }; s_Thumbnail.AlphaBlend = false; s_Thumbnail.Offset = new Vector2(38.5f, 3.8f); Sprites.Add(s_Thumbnail); s_BackingPlate2 = new pSprite(TextureManager.Load(OsuTexture.songselect_panel_selected), Vector2.Zero) { DrawDepth = base_depth + 0.01f, Colour = new Color4(255, 255, 255, 0) }; Sprites.Add(s_BackingPlate2); if (beatmap != null) { #if oldstars for (int i = 0; i < 0; i++) { Color4 col; switch (i) { default: case 0: col = new Color4(180, 255, 0, 255); break; case 1: col = new Color4(230, 255, 0, 255); break; case 2: col = new Color4(255, 198, 0, 255); break; case 3: col = new Color4(255, 126, 0, 255); break; case 4: col = new Color4(255, 12, 0, 255); break; } s_Star = new pSprite(TextureManager.Load(OsuTexture.songselect_star), Vector2.Zero) { Origin = OriginTypes.BottomLeft, Field = FieldTypes.StandardSnapRight, ScaleScalar = 0.5f, DrawDepth = base_depth + 0.06f + i * 0.001f, Colour = col, Offset = new Vector2(124 - i * 18, PANEL_HEIGHT) }; Sprites.Add(s_Star); } if (starCount % 1 != 0) { s_Star.Texture = TextureManager.Load(OsuTexture.songselect_star_half); } #else s_StarBg = new pSprite(TextureManager.Load(OsuTexture.difficulty_bar_bg), Vector2.Zero) { Origin = OriginTypes.BottomLeft, Field = FieldTypes.StandardSnapRight, DrawDepth = base_depth + 0.06f, Offset = new Vector2(179 + GameBase.SuperWidePadding, PANEL_HEIGHT) }; Sprites.Add(s_StarBg); s_Star = new pSprite(TextureManager.Load(OsuTexture.difficulty_bar_colour), Vector2.Zero) { Origin = OriginTypes.BottomLeft, Field = FieldTypes.StandardSnapRight, DrawDepth = base_depth + 0.07f, Offset = new Vector2(179 + GameBase.SuperWidePadding, PANEL_HEIGHT) }; if (starCount == 0) { //always use zero-width for no stars (even though this should not ever happen) to avoid single-pixel glitching. s_Star.DrawWidth = 0; } else if (starCount < 5) { const int border = 2; s_Star.DrawWidth = (int)((s_Star.DrawWidth - border * 2) * starCount / 5f) + border; } Sprites.Add(s_Star); #endif foreach (DifficultyScoreInfo diffInfo in Beatmap.BeatmapInfo.DifficultyScores.Values) { if (diffInfo.HighScore != null) { int offset = 0; switch (diffInfo.difficulty) { case Difficulty.Easy: offset = 90; break; case Difficulty.Normal: offset = 50; break; case Difficulty.Expert: offset = 10; break; } pSprite rankingSprite = new pSprite(diffInfo.HighScore.RankingTextureTiny, Vector2.Zero) { Origin = OriginTypes.TopRight, Field = FieldTypes.StandardSnapRight, DrawDepth = base_depth + 0.08f, Offset = new Vector2(offset, 2) }; Sprites.Add(rankingSprite); rankSprites.Add(rankingSprite); } } } }
private void Director_OnTransitionEnded() { //hit -> combo -> accuracy -> spin int time = cameFromSongSelect ? 0 : 500; int increment = cameFromSongSelect ? 0 : 500; GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankingBam); countScoreHit.ShowInt(RankableScore.hitScore, 6); countScoreHit.AdditiveFlash(500, 1); addedScore += RankableScore.hitScore; countTotalScore.ShowInt(addedScore, 6, true); countTotalScore.FlashColour(Color4.White, 1000); }, time); time += increment; GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankingBam); countScoreCombo.ShowInt(RankableScore.comboBonusScore, 6); countScoreCombo.AdditiveFlash(500, 1); addedScore += RankableScore.comboBonusScore; countTotalScore.ShowInt(addedScore, 6, true); countTotalScore.FlashColour(Color4.White, 1000); }, time); time += increment; GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankingBam); countScoreAccuracy.ShowInt(RankableScore.accuracyBonusScore, 6); countScoreAccuracy.AdditiveFlash(500, 1); addedScore += RankableScore.accuracyBonusScore; countTotalScore.ShowInt(addedScore, 6, true); countTotalScore.FlashColour(Color4.White, 1000); }, time); time += increment; GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankingBam); countScoreSpin.ShowInt(RankableScore.spinnerBonusScore, 6); countScoreSpin.AdditiveFlash(500, 1); addedScore += RankableScore.spinnerBonusScore; countTotalScore.ShowInt(addedScore, 6, true); countTotalScore.FlashColour(Color4.White, 1000); }, time); time += increment; GameBase.Scheduler.Add(delegate { if (RankableScore.Ranking == Rank.D) { AudioEngine.PlaySample(OsuSamples.RankFail); rankGraphic.FadeIn(2000); rankGraphic.ScaleScalar = 0.7f; rankGraphic.ScaleTo(1, 1400, EasingTypes.In); GameBase.Scheduler.Add(delegate { int interval = 100; rankGraphic.Transform(new TransformationF(TransformationType.Rotation, 0, 0.3f, Clock.Time, Clock.Time + interval)); rankGraphic.Transform(new TransformationF(TransformationType.Rotation, 0.3f, -0.3f, Clock.Time + interval, Clock.Time + interval * 3)); rankGraphic.Transform(new TransformationF(TransformationType.Rotation, -0.3f, 0, Clock.Time + interval * 3, Clock.Time + interval * 4)); }, 1550); } else { AudioEngine.PlaySample(OsuSamples.RankPass); rankGraphic.FadeIn(4000); GameBase.Scheduler.Add(delegate { rankGraphic.Transformations.Clear(); rankGraphic.Alpha = 1; rankGraphic.AdditiveFlash(1500, 1); }, 1400); } }, time); time += increment + 1200; if (isPersonalBest) { GameBase.Scheduler.Add(delegate { pSprite personalBest = new pSprite(TextureManager.Load(OsuTexture.personalbest), FieldTypes.StandardSnapBottomRight, OriginTypes.Centre, ClockTypes.Mode, new Vector2(80, 250), 1, true, Color4.White); personalBest.FadeInFromZero(250); personalBest.ScaleScalar = 1.6f; personalBest.RotateTo(0.2f, 250); personalBest.ScaleTo(1, 250, EasingTypes.Out); GameBase.Scheduler.Add(delegate { personalBest.AdditiveFlash(1000, 1).ScaleTo(1.05f, 1000); }, 250); layer1.Add(personalBest); }, time); } time += increment; if (!cameFromSongSelect) { GameBase.Scheduler.Add(finishDisplaying, time); } }