void searchInput_OnCommit(pTextBox sender, bool newText) { if (searchInput.Text.Length <= 0 || !newText) { return; } searchInput.Focus(true); }
void usePassword_OnCheckChanged(object sender, bool status) { if (status) { gamePassword.Focus(false); passwordSprites.ForEach(s => s.FadeIn(50)); } else { passwordSprites.ForEach(s => s.FadeOut(50)); } }
internal void UpdateState() { if (!renaming) { title.UnFocus(false); title.ReadOnly = true; try { containsCurrentMap = CollectionManager.FindCollection(originalName).Contains(BeatmapManager.Current.BeatmapChecksum); } catch { return; } title.Box.BorderColour = containsCurrentMap ? Color.YellowGreen : Color.White; string shortName = Name; if (Name.Length > 40) { shortName = Name.Substring(0, 40) + @"..."; } title.Text = string.Format(@"{0} ({1})", shortName, Count); if (Selected != title.Box.TextBold) { title.Box.TextBold = Selected; title.Box.TextChanged = true; } addButton.InitialColour = addSetButton.InitialColour = containsCurrentMap ? colourNotPresent : colourPresent; removeButton.InitialColour = removeSetButton.InitialColour = containsCurrentMap ? colourPresent : colourNotPresent; } else { title.Box.BorderColour = Color.Yellow; title.Text = Name; title.ReadOnly = false; title.Focus(false); } }
internal override void Display() { pText searchLabel = new pText(LocalisationManager.GetString(OsuString.Lobby_Search), 15, new Vector2(elementOffsetX, 35), 0.95f, true, Color.White); spriteManager.Add(searchLabel); Vector2 textLength = searchLabel.MeasureText(); float searchLabelPadding = 2.5f; //distance between label and text box searchInput = new pTextBox(string.Empty, 15, new Vector2(searchLabel.Position.X + textLength.X + searchLabelPadding, 35), 100, 0.94f); searchInput.CommitOnLeave = false; searchInput.OnChange += new pTextBox.OnCommitHandler(searchInput_OnChange); searchInput.OnCommit += new pTextBox.OnCommitHandler(searchInput_OnCommit); spriteManager.Add(searchInput.SpriteCollection); spawnChannelListing(); searchInput.Focus(true); base.Display(); }
internal void Focus() { Textbox.Focus(true); }
private void initializeSprites() { SkinManager.CreateUserSkin(); GameBase.TransitionManager.ClearBackground(false); ControlPanelLocation = new Vector2(GameBase.WindowManager.WidthScaled - 200, 380); float scale = TournamentLayout.ClientScale * GameBase.WindowManager.Ratio; backgroundManager = new BackgroundManager(this, spriteManager, 0.1f); ChatManager = new ChatManager(this, spriteManager, 1.005f); spriteManager.Add(new pSprite(GameBase.WhitePixel, Vector2.Zero, 1.005f, true, new Color(0, 0, 0, 127)) { Field = Fields.Native, VectorScale = new Vector2(TournamentLayout.WorkingSpace.X, TournamentLayout.ClientPositions[0].Y) }); spriteManager.Add(currentSong = new pText(string.Empty, 10, new Vector2(0, 143f) / scale, 1.01f, true, Color.White) { Field = Fields.TopCentre, Origin = Origins.Centre, FontFace = FontFace.ExoMedium, TextShadow = false }); spriteManager.Add(playingIcon = new pTextAwesome(FontAwesome.play_circle, 10, new Vector2(0, 143f) / scale) { Depth = 1.01f, Field = Fields.TopCentre, Origin = Origins.CentreRight, Alpha = 0, TextShadow = false }); Team1 = new Team(spriteManager, new Vector2(912 / scale, 86 / scale), FlowDirection.Left); Team2 = new Team(spriteManager, new Vector2(1008 / scale, 86 / scale), FlowDirection.Right); updateTeamNameWidths(); spriteManager.Add(annotationBg = new pSprite(TextureManager.Load(@"warmup-bg", SkinSource.Osu), Origins.Centre, new Vector2(0, 78 / scale), 1.02f, true, Color.White) { Field = Fields.TopCentre, Alpha = 0f }); spriteManager.Add(annotationText = new pText(@"warm up", 20, new Vector2(0, 78 / scale), 1.021f, true, Color.White) { Field = Fields.TopCentre, Origin = Origins.Centre, FontFace = FontFace.ExoRegular, Alpha = 0f, TextItalic = true, TextShadow = false }); annotationTextRatio = annotationText.MeasureText().X; Vector2 pos = ControlPanelLocation; spriteManager.Add((new pButton(@"Sync music", new Vector2(pos.X, pos.Y), new Vector2(80, 15), 1.01f, Color.YellowGreen, (o, e) => { AudioEngine.Play(); }) { SoundsEnabled = false }).SpriteCollection); spriteManager.Add(new pText(LocalisationManager.GetString(OsuString.Tournament_AnnotationText), 7.5f, new Vector2(pos.X + 95, pos.Y), 1.01f, true, Color.White)); spriteManager.Add((headerTb = new pTextBox(@"warm up", 7.5f, new Vector2(pos.X + 95, pos.Y + 7.5f), 52f, 1.01f)).SpriteCollection); headerTb.OnChange += (o, e) => { annotationText.Text = headerTb.Box.Text; annotationBg.VectorScale.X = annotationText.MeasureText().X / annotationTextRatio; updateTeamNameWidths(); }; pos.Y += 16; spriteManager.Add((new pButton(@"Toggle annotation", new Vector2(pos.X, pos.Y), new Vector2(80, 15), 1.01f, Color.YellowGreen, (o, e) => { annotationVisible = !annotationVisible; updateTeamNameWidths(); }, false, false, 10) { SoundsEnabled = false }).SpriteCollection); pos.Y += 16; spriteManager.Add((new pButton(@"Panic", new Vector2(pos.X, pos.Y), new Vector2(80, 15), 1.01f, Color.Red, (o, e) => { clients.Reset(); }) { SoundsEnabled = false }).SpriteCollection); spriteManager.Add(new pText(LocalisationManager.GetString(OsuString.Tournament_BestOf), 7.5f, new Vector2(pos.X + 95, pos.Y), 1.01f, true, Color.White)); spriteManager.Add((bestofTb = new pTextBox(@"1", 7.5f, new Vector2(pos.X + 95, pos.Y + 7.5f), 52f, 1.01f)).SpriteCollection); bestofTb.OnChange += (o, e) => { int tmp; if (int.TryParse(bestofTb.Box.Text, out tmp)) { Team1.BestOf = Team2.BestOf = tmp; } }; bestofTb.Focus(true); pos.Y += 16; spriteManager.Add((new pButton(@"Exit", new Vector2(pos.X, pos.Y), new Vector2(80, 15), 1.01f, Color.Red, (o, e) => { GameBase.BeginExit(); }) { SoundsEnabled = false }).SpriteCollection); currentSong.OnRefreshTexture += (o, e) => playingIcon.Position.X = currentSong.Position.X - currentSong.MeasureText().X / 2; }
internal override void Display() { descriptionTexts = new List <pText>(); currentVerticalSpace = 300; const int width = 450; int horizontalPosition = -width / 2; Fields fields = Fields.Centre; pText reportedUserText = new pText(LocalisationManager.GetString(OsuString.UserReportDialog_ReportedUser), 15, new Vector2(horizontalPosition, -100), 0.92f, true, Color.White); reportedUserText.Field = fields; reportedUserText.Origin = Origins.TopLeft; descriptionTexts.Add(reportedUserText); spriteManager.Add(reportedUserText); pText reportReasonText = new pText(LocalisationManager.GetString(OsuString.UserReportDialog_SelectReason), 15, new Vector2(horizontalPosition, -70), 0.92f, true, Color.White); reportReasonText.Field = fields; reportReasonText.Origin = Origins.TopLeft; descriptionTexts.Add(reportReasonText); spriteManager.Add(reportReasonText); pText reportReasonInfoText = new pText(LocalisationManager.GetString(OsuString.UserReportDialog_AdditionalInfo), 15, new Vector2(horizontalPosition, -40), 0.92f, true, Color.White); reportReasonInfoText.Field = fields; reportReasonInfoText.Origin = Origins.TopLeft; descriptionTexts.Add(reportReasonInfoText); spriteManager.Add(reportReasonInfoText); int biggestText = descriptionTexts.Max(e => (int)e.MeasureText().X); descriptionTexts.ForEach(e => e.MoveToX(e.CurrentPositionActual.X + ((float)biggestText - e.MeasureText().X), 0)); int widthOfBoxes = width - biggestText; int horizontalPositionOfBoxes = horizontalPosition + biggestText + 5; pText reportedUserName = new pText(reportedUser.Name, 15, new Vector2(horizontalPositionOfBoxes - 1, -100), 0.92f, true, Color.White); reportedUserName.TextBold = true; reportedUserName.Field = fields; reportedUserName.Origin = Origins.TopLeft; spriteManager.Add(reportedUserName); reportReason = new pDropdown(null, string.Empty, new Vector2(horizontalPositionOfBoxes, -70), widthOfBoxes, 0.96f); reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonSpamming), Reasons.Spam); reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonInsults), Reasons.Insults); reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonFoulPlay), Reasons.Cheating); reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonUnwantedContent), Reasons.UnwantedContent); reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonNonsense), Reasons.Nonsense); reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonOther), Reasons.Other); reportReason.SetSelected(Reasons.Spam, true); reportReason.SpriteManager = spriteManager; reportReason.SpriteCollection.ForEach(s => s.Field = fields); reportReason.SpriteMainBox.BorderColour = ColourHelper.Darken(reportReason.HighlightColour, 0.2f); reportReason.SpriteMainBox.BorderWidth = 1; spriteManager.Add(reportReason.SpriteCollection); reportReasonInfo = new pTextBox(string.Empty, 15, new Vector2(horizontalPositionOfBoxes, -40), widthOfBoxes, 0.92f); reportReasonInfo.SpriteCollection.ForEach(s => s.Field = fields); reportReasonInfo.Focus(true); reportReasonInfo.InputControl.OnKey += InputControl_OnKey; spriteManager.Add(reportReasonInfo.SpriteCollection); AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_SendReport), Color.Red, OnReportClick, true); AddCancel(LocalisationManager.GetString(OsuString.General_Cancel), Color.LightGray, null); base.Display(); }