public override void Initialize() { s_Header = new pSprite(TextureManager.Load(OsuTexture.options_header), new Vector2(0, 0)); s_Header.OnClick += delegate { }; topMostSpriteManager.Add(s_Header); pDrawable 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.AlphaBlend = false; spriteManager.Add(background); s_ButtonBack = new BackButton(delegate { Director.ChangeMode(OsuMode.MainMenu); }, Director.LastOsuMode == OsuMode.MainMenu); smd.AddNonDraggable(s_ButtonBack); if (MainMenu.MainMenu.InitializeBgm()) { AudioEngine.Music.Play(); } const int header_x_offset = 60; float button_x_offset = GameBase.BaseSize.X / 2; int vPos = 70; pText text = new pText(LocalisationManager.GetString(OsuString.About), 36, new Vector2(header_x_offset, vPos), 1, true, Color4.White) { Bold = true, TextShadow = true }; smd.Add(text); vPos += 90; pButton button = new pButton(LocalisationManager.GetString(OsuString.Credits), new Vector2(button_x_offset, vPos), new Vector2(280, 50), Color4.SkyBlue, delegate { Director.ChangeMode(OsuMode.Credits); }); smd.Add(button); vPos += 70; button = new pButton(LocalisationManager.GetString(OsuString.OnlineHelp), new Vector2(button_x_offset, vPos), new Vector2(280, 50), Color4.SkyBlue, delegate { GameBase.Instance.ShowWebView("https://www.osustream.com/help/", "Online Help"); }); smd.Add(button); vPos += 60; text = new pText(LocalisationManager.GetString(OsuString.DifficultySettings), 36, new Vector2(header_x_offset, vPos), 1, true, Color4.White) { Bold = true, TextShadow = true }; smd.Add(text); vPos += 90; buttonFingerGuides = new pButton(LocalisationManager.GetString(OsuString.UseFingerGuides), new Vector2(button_x_offset, vPos), new Vector2(280, 50), Color4.SkyBlue, delegate { DisplayFingerGuideDialog(); }); smd.Add(buttonFingerGuides); vPos += 70; buttonEasyMode = new pButton(LocalisationManager.GetString(OsuString.DefaultToEasyMode), new Vector2(button_x_offset, vPos), new Vector2(280, 50), Color4.SkyBlue, delegate { DisplayEasyModeDialog(); }); smd.Add(buttonEasyMode); vPos += 60; text = new pText(LocalisationManager.GetString(OsuString.Audio), 36, new Vector2(header_x_offset, vPos), 1, true, Color4.White) { Bold = true, TextShadow = true }; smd.Add(text); vPos += 80; soundEffectSlider = new SliderControl(LocalisationManager.GetString(OsuString.EffectVolume), AudioEngine.Effect.Volume, new Vector2(button_x_offset - 30, vPos), delegate(float v) { AudioEngine.Effect.Volume = v; if (Clock.ModeTime / 200 != lastEffectSound) { lastEffectSound = Clock.ModeTime / 200; switch (lastEffectSound % 4) { case 0: AudioEngine.PlaySample(OsuSamples.HitNormal); break; case 1: case 3: AudioEngine.PlaySample(OsuSamples.HitWhistle); break; case 2: AudioEngine.PlaySample(OsuSamples.HitFinish); break; } } }); smd.Add(soundEffectSlider); vPos += 60; soundEffectSlider = new SliderControl(LocalisationManager.GetString(OsuString.MusicVolume), AudioEngine.Music.MaxVolume, new Vector2(button_x_offset - 30, vPos), delegate(float v) { AudioEngine.Music.MaxVolume = v; }); smd.Add(soundEffectSlider); vPos += 60; const int offset_range = 32; universalOffsetSlider = new SliderControl(LocalisationManager.GetString(OsuString.UniversalOffset), (float)(Clock.USER_OFFSET + offset_range) / (offset_range * 2), new Vector2(button_x_offset - 30, vPos), delegate(float v) { GameBase.Config.SetValue("offset", (Clock.USER_OFFSET = (int)((v - 0.5f) * offset_range * 2))); if (universalOffsetSlider != null) //will be null on first run. { universalOffsetSlider.Text.Text = Clock.USER_OFFSET + "ms"; } }); smd.Add(universalOffsetSlider); vPos += 40; text = new pText(LocalisationManager.GetString(OsuString.UniversalOffsetDetails), 24, new Vector2(0, vPos), 1, true, Color4.LightGray) { TextShadow = true }; text.Field = FieldTypes.StandardSnapTopCentre; text.Origin = OriginTypes.TopCentre; text.TextAlignment = TextAlignment.Centre; text.MeasureText(); //force a measure as this is the last sprite to be added to the draggable area (need height to be precalculated) text.TextBounds.X = 600; smd.Add(text); vPos += (int)text.MeasureText().Y + 50; UpdateButtons(); vPos += 50; smd.ScrollTo(ScrollPosition); }
private void rankingReceived(string _result, Exception e) { rankingNetRequest = null; if (e != null || _result == null) { //error occurred GameBase.Notify(LocalisationManager.GetString(OsuString.InternetFailed), delegate { Ranking_Hide(); }); return; } try { rankingScores = new List <Score>(); foreach (string s in _result.Split('\n')) { if (s.Length == 0) { continue; } string[] split = s.Split('|'); int i = 0; Score score = new Score { Id = int.Parse(split[i++], GameBase.nfi), OnlineRank = int.Parse(split[i++], GameBase.nfi), Username = split[i++], hitScore = int.Parse(split[i++], GameBase.nfi), comboBonusScore = int.Parse(split[i++], GameBase.nfi), spinnerBonusScore = int.Parse(split[i++], GameBase.nfi), count300 = ushort.Parse(split[i++], GameBase.nfi), count100 = ushort.Parse(split[i++], GameBase.nfi), count50 = ushort.Parse(split[i++], GameBase.nfi), countMiss = ushort.Parse(split[i++], GameBase.nfi), maxCombo = ushort.Parse(split[i++], GameBase.nfi), date = UnixTimestamp.Parse(int.Parse(split[i++], GameBase.nfi)), guest = split[i++] == "1" }; rankingScores.Add(score); } var text = new pText("Leaderboards have been frozen. Thanks for participating!", 14, new Vector2(0, 25), Vector2.Zero, 1, true, Color4.White, true); text.Origin = OriginTypes.Centre; text.Field = FieldTypes.StandardSnapTopCentre; rankingSpriteManager.Add(text); int index = 0; foreach (Score score in rankingScores) { ScorePanel sp = new ScorePanel(score, onScoreClicked); sp.Sprites.ForEach(s => s.Position = new Vector2(0, 50 + (ScorePanel.PANEL_HEIGHT + 3) * index)); rankingSpriteManager.Add(sp); index++; } GameBase.ShowLoadingOverlay = false; rankingSpriteManager.FadeInFromZero(300); } catch { GameBase.Notify(LocalisationManager.GetString(OsuString.InternetFailed), delegate { Ranking_Hide(); }); } }