/// <summary> /// Updates the states of mode selection arrows depending on the current mode selection. /// </summary> private void updateModeSelectionArrows(bool isNewDifficulty = true) { bool hasPrevious = false; bool hasNext = false; string text = null; velocity = 0; switch (Player.Difficulty) { case Difficulty.Easy: hasNext = true; difficultySelectOffset = mode_button_width; text = LocalisationManager.GetString(OsuString.YouCantFail); background.FadeColour(new Color4(110, 110, 110, 255), 500); break; case Difficulty.Normal: hasPrevious = true; hasNext = true; difficultySelectOffset = 0; text = LocalisationManager.GetString(OsuString.DynamicStreamSwitching); background.FadeColour(new Color4(70, 70, 70, 255), 500); break; case Difficulty.Expert: hasPrevious = true; difficultySelectOffset = -mode_button_width; text = LocalisationManager.GetString(OsuString.NotForTheFaintHearted); background.FadeColour(new Color4(30, 30, 30, 255), 500); break; } s_ModeArrowLeft.Colour = hasPrevious ? Color4.White : Color4.DarkGray; s_ModeArrowRight.Colour = hasNext ? Color4.White : Color4.DarkGray; if (isNewDifficulty || bmi == null) { if (s_ModeDescriptionText.Text != text) { s_ModeDescriptionText.MoveTo(new Vector2(-20, s_ModeDescriptionText.Position.Y), 100, EasingTypes.Out); s_ModeDescriptionText.FadeOut(100); } GameBase.Scheduler.Add(delegate { //could have hit the back button really fast. if (State == SelectState.DifficultySelect) { if (s_ModeDescriptionText.Text != text) { s_ModeDescriptionText.Text = text; s_ModeDescriptionText.Position = new Vector2(20, s_ModeDescriptionText.Position.Y); s_ModeDescriptionText.MoveTo(new Vector2(0, s_ModeDescriptionText.Position.Y), 100, EasingTypes.In); s_ModeDescriptionText.FadeInFromZero(300); } bmi = BeatmapDatabase.GetDifficultyInfo(Player.Beatmap, Player.Difficulty); s_ScoreInfo.Transform(new TransformationBounce(Clock.ModeTime, Clock.ModeTime + 200, 1, 0.05f, 2)); s_ScoreInfo.Text = LocalisationManager.GetString(OsuString.PlayCount) + " " + bmi.Playcount.ToString().PadLeft(3, '0') + '\n' + LocalisationManager.GetString(OsuString.HighScore) + " "; if (bmi.HighScore == null) { s_ScoreInfo.Text += @"000000"; s_ScoreRank.Texture = null; } else { s_ScoreInfo.Text += bmi.HighScore.totalScore.ToString().PadLeft(6, '0'); s_ScoreRank.Texture = bmi.HighScore.RankingTextureSmall; } if (s_ScoreRank.Texture != null) { s_ScoreRank.AdditiveFlash(500, 0.5f); s_ScoreInfo.MoveTo(new Vector2(GameBase.SuperWidePadding + 40, 64), 200, EasingTypes.In); } else { s_ScoreInfo.MoveTo(new Vector2(GameBase.SuperWidePadding, 64), 200, EasingTypes.In); } } }, 100); } }
private void GameWindowDesktop_KeyPress(object sender, KeyPressEventArgs e) { switch (e.KeyChar) { case 'a': Player.Autoplay = !Player.Autoplay; break; case 'r': Director.ChangeMode(Director.CurrentOsuMode); break; case 'd': TextureManager.PurgeUnusedTexture(); break; case 's': TextureManager.ReloadAll(); break; case 'z': TextureManager.DisposeAll(); break; case 'o': Director.ChangeMode(OsuMode.Options); break; case 'v': Director.ChangeMode(OsuMode.VideoPreview, new FadeTransition(1000, 1500)); return; case 'e': DifficultyScoreInfo bmi = BeatmapDatabase.GetDifficultyInfo(Player.Beatmap, Difficulty.Normal); if (bmi == null) { break; } if (bmi.HighScore == null) { GameBase.Notify("Unlocked expert"); bmi.HighScore = new Score(); bmi.HighScore.comboBonusScore = 1000000; } break; case 'k': Director.ChangeMode(OsuMode.PositioningTest); break; case 'h': if (ClientSize.Width == 960) { ClientSize = new Size(480, 320); } else { ClientSize = new Size(960, 640); } break; case 'x': if (ClientSize.Width == 1218) { ClientSize = new Size(2436, 1125); } else { ClientSize = new Size(1218, 562); } break; case 'i': ClientSize = new Size(1024, 768); break; case '5': ClientSize = new Size(1136, 640); break; case '1': ClientSize = new Size(896, 414); break; case '2': ClientSize = new Size(896 * 2, 414 * 2); break; case '3': ClientSize = new Size(2560, 1182); break; case 'p': { if (Director.CurrentMode is Player) { Player p = Director.CurrentMode as Player; if (!p.IsPaused) { p.Pause(); } } else { Director.ChangeMode(OsuMode.SongSelect); } } break; case 'j': { if (Director.CurrentMode is Player p) { Results.RankableScore = p.CurrentScore; Director.ChangeMode(OsuMode.Results, new ResultTransition()); } } break; } }
public override void Initialize() { background = new pSprite(TextureManager.Load(OsuTexture.songselect_background), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Mode, Vector2.Zero, 0, true, new Color4(56, 56, 56, 255)); background.Scale.X = background.DrawWidth / GameBase.BaseSize.X; background.AlphaBlend = false; spriteManager.Add(background); rankingBackground = new pSprite(TextureManager.Load(OsuTexture.ranking_background), FieldTypes.StandardSnapCentreLeft, OriginTypes.CentreLeft, ClockTypes.Mode, Vector2.Zero, 0.4f, true, Color4.White); rankingBackground.Position = new Vector2(5, -20); rankingBackground.ScaleScalar = 0.85f; layer2.Add(rankingBackground); pText artist = new pText(Player.Beatmap.Artist, 30, new Vector2(10, fill_height + 5), 0.5f, true, Color4.OrangeRed) { TextShadow = true }; layer1.Add(artist); pText title = new pText(Player.Beatmap.Title, 30, new Vector2(16 + artist.MeasureText().X / GameBase.BaseToNativeRatioAligned, fill_height + 5), 0.5f, true, Color4.White) { TextShadow = true }; layer1.Add(title); pTexture modeTex; switch (Player.Difficulty) { case Difficulty.Easy: modeTex = TextureManager.Load(OsuTexture.songselect_mode_easy); break; case Difficulty.Expert: modeTex = TextureManager.Load(OsuTexture.songselect_mode_expert); break; default: modeTex = TextureManager.Load(OsuTexture.songselect_mode_stream); break; } modeGraphic = new pSprite(modeTex, FieldTypes.StandardSnapRight, OriginTypes.TopRight, ClockTypes.Mode, new Vector2(5, 7), 0.45f, true, Color4.White) { ScaleScalar = 0.5f }; layer1.Add(modeGraphic); rankGraphic = new pSprite(RankableScore.RankingTexture, FieldTypes.StandardSnapBottomRight, OriginTypes.Centre, ClockTypes.Mode, new Vector2(120, 180), 0.46f, true, Color4.White) { Alpha = 0 }; layer1.Add(rankGraphic); initializeTransition(); //Scoring { float v_offset = -165; pText heading = new pText(LocalisationManager.GetString(OsuString.Score), 28, new Vector2(240, v_offset), 0.5f, true, Color4.White) { Origin = OriginTypes.TopLeft, Field = FieldTypes.StandardSnapCentreLeft, Bold = true }; resultSprites.Add(heading); v_offset += 30; pSpriteText count = new pSpriteText("000,000", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.TopRight, ClockTypes.Mode, new Vector2(445, v_offset), 0.9f, true, new Color4(255, 166, 0, 255)); count.TextConstantSpacing = true; countTotalScore = count; resultSprites.Add(count); v_offset += 40; //Spin Bonus heading = new pText(LocalisationManager.GetString(OsuString.Hit), 20, new Vector2(240, v_offset), 0.5f, true, Color4.Gray) { Origin = OriginTypes.TopLeft, Field = FieldTypes.StandardSnapCentreLeft, Bold = true }; resultSprites.Add(heading); count = new pSpriteText("000000", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.TopRight, ClockTypes.Mode, new Vector2(445, v_offset), 0.9f, true, new Color4(255, 166, 0, 255)); count.TextConstantSpacing = true; count.ZeroAlpha = 0.5f; count.ScaleScalar = 0.7f; resultSprites.Add(count); countScoreHit = count; v_offset += 25; heading = new pText(LocalisationManager.GetString(OsuString.Combo), 20, new Vector2(240, v_offset), 0.5f, true, Color4.Gray) { Origin = OriginTypes.TopLeft, Field = FieldTypes.StandardSnapCentreLeft, Bold = true }; resultSprites.Add(heading); count = new pSpriteText("000000", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.TopRight, ClockTypes.Mode, new Vector2(445, v_offset), 0.9f, true, new Color4(255, 166, 0, 255)); count.TextConstantSpacing = true; count.ZeroAlpha = 0.5f; count.ScaleScalar = 0.7f; resultSprites.Add(count); countScoreCombo = count; v_offset += 25; heading = new pText(LocalisationManager.GetString(OsuString.Accuracy), 20, new Vector2(240, v_offset), 0.5f, true, Color4.Gray) { Origin = OriginTypes.TopLeft, Field = FieldTypes.StandardSnapCentreLeft, Bold = true }; resultSprites.Add(heading); count = new pSpriteText("000000", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.TopRight, ClockTypes.Mode, new Vector2(445, v_offset), 0.9f, true, new Color4(255, 166, 0, 255)); count.TextConstantSpacing = true; count.ZeroAlpha = 0.5f; count.ScaleScalar = 0.7f; resultSprites.Add(count); countScoreAccuracy = count; v_offset += 25; heading = new pText(LocalisationManager.GetString(OsuString.Spin), 20, new Vector2(240, v_offset), 0.5f, true, Color4.Gray) { Origin = OriginTypes.TopLeft, Field = FieldTypes.StandardSnapCentreLeft, Bold = true }; resultSprites.Add(heading); count = new pSpriteText("000000", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.TopRight, ClockTypes.Mode, new Vector2(445, v_offset), 0.9f, true, new Color4(255, 166, 0, 255)); count.TextConstantSpacing = true; count.ZeroAlpha = 0.5f; count.ScaleScalar = 0.7f; resultSprites.Add(count); countScoreSpin = count; v_offset += 30; heading = new pText(LocalisationManager.GetString(OsuString.Accuracy), 28, new Vector2(240, v_offset), 0.5f, true, Color4.White) { Origin = OriginTypes.TopLeft, Field = FieldTypes.StandardSnapCentreLeft, Bold = true }; resultSprites.Add(heading); v_offset += 34; count = new pSpriteText((RankableScore.accuracy * 100).ToString("00.00", GameBase.nfi) + "%", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.TopRight, ClockTypes.Mode, new Vector2(445, v_offset), 0.9f, true, new Color4(0, 180, 227, 255)); count.ScaleScalar = 0.7f; resultSprites.Add(count); v_offset += 20; heading = new pText(LocalisationManager.GetString(OsuString.MaxCombo), 28, new Vector2(240, v_offset), 0.5f, true, Color4.White) { Origin = OriginTypes.TopLeft, Field = FieldTypes.StandardSnapCentreLeft, Bold = true }; resultSprites.Add(heading); v_offset += 34; count = new pSpriteText(RankableScore.maxCombo.ToString("#,0", GameBase.nfi) + "x", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.TopRight, ClockTypes.Mode, new Vector2(445, v_offset), 0.9f, true, new Color4(0, 180, 227, 255)); count.ScaleScalar = 0.7f; resultSprites.Add(count); } { Vector2 pos = new Vector2(60, -130); Vector2 textOffset = new Vector2(150, 0); float spacing = 65; pSprite hitExplosion = new pSprite(TextureManager.Load(OsuTexture.hit300), pos) { Field = FieldTypes.StandardSnapCentreLeft, Origin = OriginTypes.Centre, ScaleScalar = 0.5f, DrawDepth = 0.9f }; resultSprites.Add(hitExplosion); count300 = new pSpriteText("0x", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.CentreRight, ClockTypes.Mode, pos + textOffset, 0.9f, true, Color4.White) { SpacingOverlap = 3, TextConstantSpacing = true }; resultSprites.Add(count300); pos.Y += spacing; hitExplosion = new pSprite(TextureManager.Load(OsuTexture.hit100), pos) { Field = FieldTypes.StandardSnapCentreLeft, Origin = OriginTypes.Centre, ScaleScalar = 0.5f, DrawDepth = 0.9f }; resultSprites.Add(hitExplosion); count100 = new pSpriteText("0x", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.CentreRight, ClockTypes.Mode, pos + textOffset, 0.9f, true, Color4.White) { SpacingOverlap = 3, TextConstantSpacing = true }; resultSprites.Add(count100); pos.Y += spacing; hitExplosion = new pSprite(TextureManager.Load(OsuTexture.hit50), pos) { Field = FieldTypes.StandardSnapCentreLeft, Origin = OriginTypes.Centre, ScaleScalar = 0.5f, DrawDepth = 0.9f }; resultSprites.Add(hitExplosion); count50 = new pSpriteText("0x", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.CentreRight, ClockTypes.Mode, pos + textOffset, 0.9f, true, Color4.White) { SpacingOverlap = 3, TextConstantSpacing = true }; resultSprites.Add(count50); pos.Y += spacing; hitExplosion = new pSprite(TextureManager.Load(OsuTexture.hit0), pos) { Field = FieldTypes.StandardSnapCentreLeft, Origin = OriginTypes.Centre, ScaleScalar = 0.5f, DrawDepth = 0.9f }; resultSprites.Add(hitExplosion); count0 = new pSpriteText("0x", "score", 0, FieldTypes.StandardSnapCentreLeft, OriginTypes.CentreRight, ClockTypes.Mode, pos + textOffset, 0.9f, true, Color4.White) { SpacingOverlap = 3, TextConstantSpacing = true }; resultSprites.Add(count0); } if (Director.LastOsuMode == OsuMode.SongSelect) { cameFromSongSelect = true; } layer2.Add(resultSprites); s_ButtonBack = new BackButton(returnToSelect, false); s_ButtonBack.Alpha = 0; topMostLayer.Add(s_ButtonBack); s_Footer = new pSprite(TextureManager.Load(OsuTexture.ranking_footer), FieldTypes.StandardSnapBottomRight, OriginTypes.BottomRight, ClockTypes.Mode, new Vector2(0, -100), 0.98f, true, Color4.White); s_Footer.Alpha = 0; s_Footer.OnClick += delegate { Director.ChangeMode(OsuMode.Play); AudioEngine.PlaySample(OsuSamples.MenuHit); }; topMostLayer.Add(s_Footer); if (!cameFromSongSelect) { InitializeBgm(); //this is a bit of cheating to ensure that getting 100% will always result in 1mil. there are some race conditions with multitouch that may allow //for ever-so-slightly lower max scores, but this would piss people off. if (RankableScore.accuracy == 1 && RankableScore.totalScore - RankableScore.spinnerBonusScore != Score.MAX_SCORE) { RankableScore.comboBonusScore = Score.MAX_SCORE - RankableScore.accuracyBonusScore - RankableScore.hitScore; } DifficultyScoreInfo bmi = BeatmapDatabase.GetDifficultyInfo(Player.Beatmap, Player.Difficulty); if (bmi.HighScore == null || RankableScore.totalScore > bmi.HighScore.totalScore) { if (bmi.difficulty == Difficulty.Normal && RankableScore.Ranking >= Rank.A && (bmi.HighScore == null || bmi.HighScore.Ranking < Rank.A)) { unlockedExpert = true; } isPersonalBest = true; bmi.HighScore = RankableScore; BeatmapDatabase.Write(); } else if (bmi.HighScore != null && RankableScore.Ranking > bmi.HighScore.Ranking) { bmi.HighScore.Ranking = RankableScore.Ranking; } //Average Timing avg = (float)RankableScore.hitOffsetMilliseconds / Math.Max(1, RankableScore.hitOffsetCount); pText heading = new pText(LocalisationManager.GetString(OsuString.AvgTiming) + Math.Round(Math.Abs(avg), 1) + (RankableScore.hitOffsetMilliseconds > 0 ? "ms late" : "ms early"), 16, new Vector2(0, 20), 0.5f, true, Color4.White) { Field = FieldTypes.StandardSnapBottomCentre, Origin = OriginTypes.BottomCentre }; layer1.Add(heading); doSubmission(); } else { if (!string.IsNullOrEmpty(RankableScore.Username)) { pText playerName = new pText("Played by " + RankableScore.Username, 30, new Vector2(10, 10), 0.5f, true, new Color4(255, 234, 0, 255)) { TextShadow = true, Field = FieldTypes.StandardSnapBottomRight, Origin = OriginTypes.BottomRight }; s_Footer.Bypass = true; //don't show footer. we need this room! layer1.Add(playerName); } //displaying a previous high score (or online high score) finishDisplaying(); } Director.OnTransitionEnded += Director_OnTransitionEnded; InputManager.OnMove += HandleInputManagerOnMove; }