private void halfticker_OnCheckChanged(object sender, bool state) { if (state) { tickonotherbeat.Show(); doubleticker.SetStatusQuietly(false); } else { tickonotherbeat.Hide(); } clearall = true; linecreated = false; stopticking = true; }
public override void Initialize() { KeyboardHandler.OnKeyRepeat += GameBase_OnKeyRepeat; InputManager.Bind(InputEventType.OnMouseWheelUp, onMouseWheelUp); InputManager.Bind(InputEventType.OnMouseWheelDown, onMouseWheelDown); spriteManager = new SpriteManager(true); backButton = new BackButton(delegate { GameBase.ChangeMode(GameBase.CallbackMode); }); spriteManager.Add(backButton.SpriteCollection); // instructions pText instructions = new pText(LocalisationManager.GetString(OsuString.OptionsOffsetWizard_Instructions), 16f, new Vector2(GameBase.WindowManager.WidthScaled / 2, 400), new Vector2(500, 0), 0.8f, true, Color.White, false); instructions.TextAlignment = TextAlignment.Centre; instructions.Origin = Origins.TopCentre; spriteManager.Add(instructions); // icon in middle middle = new pSprite(TextureManager.Load(@"options-offset-tick"), Fields.TopLeft, Origins.Centre, Clocks.Game, new Vector2(GameBase.WindowManager.WidthScaled / 2, 240), 0.8f, true, Color.White); middle.VectorScale = new Vector2(0.1f, 2); spriteManager.Add(middle); //offset text = new pText(LocalisationManager.GetString(OsuString.OptionsOffsetWizard_UniversalOffset), 30f, new Vector2(50, 20), 0.8f, true, Color.White); spriteManager.Add(text); text = new pText(ConfigManager.sOffset.ToString(), 30f, new Vector2(50 + text.MeasureText().X, 20), 0.8f, true, Color.YellowGreen); text.TextBold = true; spriteManager.Add(text); //ticking beat checkbox tickonotherbeat = new pCheckbox(LocalisationManager.GetString(OsuString.OptionsOffsetWizard_TickOther), new Vector2(50, 80), 0.8f, false); spriteManager.Add(tickonotherbeat.SpriteCollection); tickonotherbeat.OnCheckChanged += tickonotherbeat_OnCheckChanged; halfticker = new pCheckbox(LocalisationManager.GetString(OsuString.OptionsOffsetWizard_HalfTick), new Vector2(50, 60), 0.8f, false); spriteManager.Add(halfticker.SpriteCollection); halfticker.OnCheckChanged += halfticker_OnCheckChanged; doubleticker = new pCheckbox(LocalisationManager.GetString(OsuString.OptionsOffsetWizard_DoubleTick), new Vector2(150, 60), 0.8f, false); spriteManager.Add(doubleticker.SpriteCollection); doubleticker.OnCheckChanged += doubleticker_OnCheckChanged; tickonotherbeat.Hide(); //list for moving lines lines = new List <pSprite>(); if (AudioEngine.AudioTrack?.Preview ?? false) { AudioEngine.LoadAudio(BeatmapManager.Current, false, false); AudioEngine.ResetAudioTrack(); AudioEngine.Play(); } base.Initialize(); setupBeatmap(); }
public override void Initialize() { MatchSetup.Match = null; StreamingManager.StopSpectating(false); text_noMatchFound = LocalisationManager.GetString(OsuString.Lobby_NoMatch); text_loading = LocalisationManager.GetString(OsuString.General_Loading); spriteManager = new SpriteManager(true); spriteManagerFilters = new SpriteManager(true); //spriteManagerFilters.Alpha = 0; spriteManagerFilters.SetVisibleArea(new RectangleF(0, content_y - filters_height, 640, filters_height)); BanchoClient.OnConnect += BanchoClient_OnConnect; KeyboardHandler.OnKeyRepeat += KeyboardHandler_OnKeyRepeat; pText headerText = new pText(LocalisationManager.GetString(OsuString.Lobby_Header), 24, new Vector2(0, 0), 0.955F, true, new Color(255, 255, 255, 255)); spriteManager.Add(headerText); headerText2 = new pText(text_loading, 12, new Vector2(170, 8), 0.955F, true, new Color(255, 255, 255, 255)); spriteManager.Add(headerText2); //pSprite bgf = // new pSprite(TextureManager.Load(@"lobby-background"), Fields.TopLeft, Origins.TopLeft, // Clocks.Instance, Vector2.Zero, 0, true, Color.White); //spriteManager.Add(bgf); pSprite p = new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft, Clocks.Game, new Vector2(0, content_y - filters_height), 0.1f, true, new Color(0, 0, 0, 180)); p.Scale = 1.6f; p.VectorScale = new Vector2(GameBase.WindowManager.WidthScaled, content_height + filters_height + 30); spriteManager.Add(p); int button_height = content_y + content_height + 2; pButton pbut = new pButton(LocalisationManager.GetString(OsuString.Lobby_NewGame), new Vector2(GameBase.WindowManager.WidthScaled / 2 - 100, button_height), new Vector2(200, 25), 0.92f, new Color(99, 139, 228), OnCreateGame); spriteManager.Add(pbut.SpriteCollection); pbut = new pButton(LocalisationManager.GetString(OsuString.Lobby_QuickJoin), new Vector2(GameBase.WindowManager.WidthScaled / 2 + 110, button_height), new Vector2(200, 25), 0.92f, Color.YellowGreen, OnQuickJoin); spriteManager.Add(pbut.SpriteCollection); pbut = new pButton(LocalisationManager.GetString(OsuString.Lobby_BackToMenu), new Vector2(GameBase.WindowManager.WidthScaled / 2 - 310, button_height), new Vector2(200, 25), 0.92f, new Color(235, 160, 62), back_OnClick); spriteManager.Add(pbut.SpriteCollection); noMatches = new pText(text_loading, 18, new Vector2(GameBase.WindowManager.WidthScaled / 2, 180), new Vector2(400, 0), 1, true, Color.White, false); noMatches.TextBold = true; noMatches.Alpha = 0; noMatches.TextAlignment = TextAlignment.Centre; noMatches.Origin = Origins.Centre; spriteManager.Add(noMatches); sortingTabs = new pTabCollection(spriteManager, 6, new Vector2(50, 40), 0.98f, false, Color.Crimson); sortingTabs.Add(LocalisationManager.GetString(OsuString.Lobby_All), -1); sortingTabs.Add(OsuCommon.PlayModeString(PlayModes.Osu), (int)PlayModes.Osu); sortingTabs.Add(OsuCommon.PlayModeString(PlayModes.Taiko), (int)PlayModes.Taiko); sortingTabs.Add(OsuCommon.PlayModeString(PlayModes.CatchTheBeat), (int)PlayModes.CatchTheBeat); sortingTabs.Add(OsuCommon.PlayModeString(PlayModes.OsuMania), (int)PlayModes.OsuMania); sortingTabs.SetSelected(ConfigManager.sLobbyPlayMode.Value, true); sortingTabs.OnTabChanged += delegate { ConfigManager.sLobbyPlayMode.Value = (int)sortingTabs.SelectedTab.Tag; LobbyUpdatePending = true; }; checkExistingMaps = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_ExistMapOnly), 0.8f, new Vector2(5, 2), 1, ConfigManager.sLobbyShowExistingOnly); spriteManagerFilters.Add(checkExistingMaps.SpriteCollection); checkExistingMaps.OnCheckChanged += delegate(object sender, bool status) { ConfigManager.sLobbyShowExistingOnly.Value = status; LobbyUpdatePending = true; }; checkFriendsOnly = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_FriendOnly), 0.8f, new Vector2(5, 19), 1, ConfigManager.sLobbyShowFriendsOnly); spriteManagerFilters.Add(checkFriendsOnly.SpriteCollection); checkFriendsOnly.OnCheckChanged += delegate(object sender, bool status) { ConfigManager.sLobbyShowFriendsOnly.Value = status; LobbyUpdatePending = true; }; checkInProgress = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_InProgress), 0.8f, new Vector2(360, 19), 1, ConfigManager.sLobbyShowInProgress); spriteManagerFilters.Add(checkInProgress.SpriteCollection); checkInProgress.OnCheckChanged += delegate(object sender, bool status) { ConfigManager.sLobbyShowInProgress.Value = status; LobbyUpdatePending = true; }; checkShowFullGames = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_ShowFull), 0.8f, new Vector2(180, 2), 1, ConfigManager.sLobbyShowFull); spriteManagerFilters.Add(checkShowFullGames.SpriteCollection); checkShowFullGames.OnCheckChanged += delegate(object sender, bool status) { ConfigManager.sLobbyShowFull.Value = status; LobbyUpdatePending = true; }; checkShowPasswordedGames = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_ShowLocked), 0.8f, new Vector2(180, 19), 1, ConfigManager.sLobbyShowPassworded); spriteManagerFilters.Add(checkShowPasswordedGames.SpriteCollection); checkShowPasswordedGames.OnCheckChanged += delegate(object sender, bool status) { ConfigManager.sLobbyShowPassworded.Value = status; LobbyUpdatePending = true; }; pText pt = new pText(LocalisationManager.GetString(OsuString.Lobby_Search), 14, new Vector2(360, 2), 1, true, Color.White); spriteManagerFilters.Add(pt); filterTextBox = new pTextBox(string.Empty, 14, new Vector2(360 + pt.MeasureText().X, 2), 134, 1); filterTextBox.LengthLimit = 20; filterTextBox.OnChange += delegate { LobbyUpdatePending = true; if (filterTextBox.Text.Length > 0) { checkFriendsOnly.Hide(); checkShowFullGames.Hide(); checkShowPasswordedGames.Hide(); checkExistingMaps.Hide(); sortingTabs.SetSelected(-1, true); } else { checkFriendsOnly.Show(); checkShowFullGames.Show(); checkShowPasswordedGames.Show(); checkExistingMaps.Show(); sortingTabs.SetSelected(ConfigManager.sLobbyPlayMode.Value, true); } }; spriteManagerFilters.Add(filterTextBox.SpriteCollection); //buttonFilters = new pButton(LocalisationManager.GetString(OsuString.Lobby_Filters), new Vector2(390, 32), new Vector2(100, 20), 1, Color.YellowGreen, toggleFilters); //spriteManager.Add(buttonFilters.SpriteCollection); base.Initialize(); if (BeatmapManager.Current == null || string.IsNullOrEmpty(BeatmapManager.Current.ContainingFolder) || !BeatmapManager.Current.BeatmapPresent) { MusicControl.ChooseRandomSong(true); } JoinLobby(); LobbyUpdatePending = true; }
private void InitializeCommentSystem() { commentBackgroundTop = new pSprite(TextureManager.Load(@"commentbox", SkinSource.Osu), Fields.TopRight, Origins.TopRight, Clocks.Game, new Vector2(70, buttonComments.Position.Y - 24), 0.95f, true, Color.TransparentWhite, "play"); commentBackgroundTop.DrawHeight = 52; commentBoxSprites.Add(commentBackgroundTop); spriteManager.Add(commentBackgroundTop); commentBackgroundMiddle = new pSprite(TextureManager.Load(@"commentbox", SkinSource.Osu), Fields.TopRight, Origins.TopRight, Clocks.Game, new Vector2(70, buttonComments.Position.Y - 24), 0.95f, true, Color.TransparentWhite, "play"); commentBackgroundMiddle.DrawHeight = 1; commentBackgroundMiddle.DrawTop = 52; commentBackgroundMiddle.VectorScale = new Vector2(1, 0); commentBackgroundMiddle.Position.Y += 52 * 0.625f; commentBoxSprites.Add(commentBackgroundMiddle); spriteManager.Add(commentBackgroundMiddle); commentBackgroundBottom = new pSprite(TextureManager.Load(@"commentbox", SkinSource.Osu), Fields.TopRight, Origins.TopRight, Clocks.Game, new Vector2(70, buttonComments.Position.Y - 24 + 52 * 0.625f), 0.95f, true, Color.TransparentWhite, "play"); commentBackgroundBottom.DrawHeight = 49; commentBackgroundBottom.DrawTop = 53; commentBoxSprites.Add(commentBackgroundBottom); spriteManager.Add(commentBackgroundBottom); float width = commentBackgroundTop.DrawWidth * 0.625f; const int padding = 6; commentInputTextbox = new pTextBox(DEFAULT_MESSAGE, 12, new Vector2(commentBackgroundTop.CurrentPositionActual.X - width + padding, commentBackgroundTop.Position.Y + 17 + padding), width - padding * 4, 1); commentInputTextbox.BackgroundUnfocused = new Color(51, 197, 234, 150); commentInputTextbox.Box.Alpha = 0; commentInputTextbox.Box.BorderWidth = 0; commentInputTextbox.OnGotFocus += textBox_OnGotFocus; commentInputTextbox.CommitOnLeave = false; commentInputTextbox.OnCommit += textBox_OnCommit; commentInputTextbox.LengthLimit = 80; commentInputTextbox.OnChange += new pTextBox.OnCommitHandler(commentInputTextbox_OnChange); commentBoxSprites.AddRange(commentInputTextbox.SpriteCollection); spriteManager.Add(commentInputTextbox.SpriteCollection); cMap = new pCheckbox("Difficulty", 0.7f, new Vector2(commentBackgroundTop.CurrentPositionActual.X - 250, commentBackgroundTop.CurrentPositionActual.Y + 5), 1, false); spriteManager.Add(cMap.SpriteCollection); cMap.OnCheckChanged += new CheckboxCallbackDelegate(choice_OnCheckChanged); cMap.Hide(true); cMap.Tooltip = "Comment on this particular difficulty"; commentBoxSprites.AddRange(cMap.SpriteCollection); spriteManager.Add(cMap.SpriteCollection); cSong = new pCheckbox("Song", 0.7f, new Vector2(commentBackgroundTop.CurrentPositionActual.X - 170, commentBackgroundTop.CurrentPositionActual.Y + 5), 1, false); spriteManager.Add(cSong.SpriteCollection); cSong.OnCheckChanged += new CheckboxCallbackDelegate(choice_OnCheckChanged); cSong.Tooltip = "Comment on this collection of beatmaps or the song"; cSong.Hide(true); commentBoxSprites.AddRange(cSong.SpriteCollection); spriteManager.Add(cSong.SpriteCollection); cReplay = new pCheckbox("Player", 0.7f, new Vector2(commentBackgroundTop.CurrentPositionActual.X - 90, commentBackgroundTop.CurrentPositionActual.Y + 5), 1, false); spriteManager.Add(cReplay.SpriteCollection); cReplay.Tooltip = "Comment on the current replay (the specific person playing)"; cReplay.OnCheckChanged += new CheckboxCallbackDelegate(choice_OnCheckChanged); cReplay.Hide(true); if (InputManager.ReplayScore.IsOnline) { commentBoxSprites.AddRange(cReplay.SpriteCollection); spriteManager.Add(cReplay.SpriteCollection); } originalCheckboxPosition = new Vector2(commentBackgroundBottom.CurrentPositionActual.X - 250, commentBackgroundBottom.CurrentPositionActual.Y + 5); showCommentsCheckbox = new pCheckbox("Show Comments", 0.7f, originalCheckboxPosition, 1, ConfigManager.sShowReplayComments); spriteManager.Add(showCommentsCheckbox.SpriteCollection); showCommentsCheckbox.OnCheckChanged += showComments_OnCheckChanged; showCommentsCheckbox.Hide(true); commentBoxSprites.AddRange(showCommentsCheckbox.SpriteCollection); spriteManager.Add(showCommentsCheckbox.SpriteCollection); commentColourPicker = new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft, Clocks.Game, originalCheckboxPosition + new Vector2(124, 1), 0.96f, true, Color.TransparentWhite); commentColourPicker.Alpha = 0; commentColourPicker.VectorScale = new Vector2(20, 20); commentColourPicker.HandleInput = true; commentColourPicker.OnClick += (obj, ev) => { if (GameBase.IsFullscreen) { NotificationManager.ShowMessage("Exit fullscreen mode to use the colour pick feature.", Color.Red, 2000); return; } if (!Player.Paused && !InputManager.ReplayStreaming) { AudioEngine.TogglePause(); Player.Paused = true; commitStartTime = AudioEngine.Time; } ColorDialog cd = new ColorDialog(); if (cd.ShowDialog(GameBase.Form) == DialogResult.OK) { commentColourPicker.InitialColour = new Color(cd.Color.R, cd.Color.G, cd.Color.B); } if (!InputManager.ReplayStreaming) { AudioEngine.TogglePause(); Player.Paused = false; } }; if (GameBase.User != null && (GameBase.User.Permission & Permissions.Supporter) > 0) { commentBoxSprites.Add(commentColourPicker); spriteManager.Add(commentColourPicker); pText pt = new pText("Colour", 15 * 0.7f, originalCheckboxPosition + new Vector2(94, 2), 0.96f, true, Color.TransparentWhite); commentBoxSprites.Add(pt); spriteManager.Add(pt); } if (ConfigManager.sShowReplayComments) { RequestComments(); } }