/// <summary> /// </summary> private void CreateSubHeaders() { SubHeaderBackground = new Sprite { Parent = CustomizeContainer, Y = 2, Alignment = Alignment.TopCenter, Size = new ScalableVector2(CustomizeContainer.Width - 4, 47), Tint = ColorHelper.HexToColor("#212121") }; // ReSharper disable once ObjectCreationAsStatement new SpriteTextBitmap(FontsBitmap.GothamRegular, "Presets") { Parent = SubHeaderBackground, Alignment = Alignment.MidLeft, X = 18, FontSize = 18 }; var addButton = new BorderedTextButton("Add", Color.Lime, (sender, args) => { var windows = new JudgementWindows() { Name = "Preset" }; var presetCount = JudgementWindowsDatabaseCache.Presets.FindAll(x => !x.IsDefault).Count; JudgementWindowsDatabaseCache.Insert(windows); windows.Name = $"Preset {presetCount + 1}"; JudgementWindowsDatabaseCache.Update(windows); WindowContainer.AddObject(windows); JudgementWindowsDatabaseCache.Selected.Value = windows; }) { Parent = SubHeaderBackground, Alignment = Alignment.MidRight, X = -15, Text = { FontSize = 14, Font = Fonts.Exo2SemiBold } }; addButton.Size = new ScalableVector2(addButton.Width * 0.85f, addButton.Height * 0.85f); EditButton = new BorderedTextButton("Edit Name", Color.Yellow, (sender, args) => { DialogManager.Show(new JudgementWindowRenameDialog(JudgementWindowsDatabaseCache.Selected.Value, WindowContainer)); }) { Parent = SubHeaderBackground, Alignment = Alignment.MidRight, X = addButton.X - addButton.Width - 12, Text = { FontSize = 14, Font = Fonts.Exo2SemiBold } }; EditButton.Size = new ScalableVector2(EditButton.Width * 0.85f, EditButton.Height * 0.85f); DeleteButton = new BorderedTextButton("Delete", Color.Crimson, (sender, args) => { var index = JudgementWindowsDatabaseCache.Presets.IndexOf(JudgementWindowsDatabaseCache.Selected.Value); JudgementWindowsDatabaseCache.Delete(JudgementWindowsDatabaseCache.Selected.Value); WindowContainer.Remove(JudgementWindowsDatabaseCache.Selected.Value); JudgementWindowsDatabaseCache.Selected.Value = JudgementWindowsDatabaseCache.Presets[index - 1]; }) { Parent = SubHeaderBackground, Alignment = Alignment.MidRight, X = EditButton.X - EditButton.Width - 12, Text = { FontSize = 14, Font = Fonts.Exo2SemiBold } }; DeleteButton.Size = new ScalableVector2(DeleteButton.Width * 0.85f, DeleteButton.Height * 0.85f); ResetToDefaultButton = new BorderedTextButton("Reset", Color.Orange, (sender, args) => { Sliders[Judgement.Marv].BindedValue.Value = (int)JudgementWindowsDatabaseCache.Standard.Marvelous; Sliders[Judgement.Perf].BindedValue.Value = (int)JudgementWindowsDatabaseCache.Standard.Perfect; Sliders[Judgement.Great].BindedValue.Value = (int)JudgementWindowsDatabaseCache.Standard.Great; Sliders[Judgement.Good].BindedValue.Value = (int)JudgementWindowsDatabaseCache.Standard.Good; Sliders[Judgement.Okay].BindedValue.Value = (int)JudgementWindowsDatabaseCache.Standard.Okay; Sliders[Judgement.Miss].BindedValue.Value = (int)JudgementWindowsDatabaseCache.Standard.Miss; }) { Parent = SubHeaderBackground, Alignment = Alignment.MidRight, X = DeleteButton.X - DeleteButton.Width - 12, Text = { FontSize = 14, Font = Fonts.Exo2SemiBold } }; ResetToDefaultButton.Size = new ScalableVector2(ResetToDefaultButton.Width * 0.85f, ResetToDefaultButton.Height * 0.85f); }
public sealed override void CreateContent() { ContainingBox = new Sprite() { Parent = Container, Size = new ScalableVector2(WindowManager.Width, 200), Alignment = Alignment.MidCenter, Tint = Color.Black, Alpha = 0.95f }; var line = new Sprite() { Parent = ContainingBox, Size = new ScalableVector2(ContainingBox.Width, 1), Tint = Colors.MainAccent }; Header = new SpriteText(Fonts.Exo2Bold, $"Rename Judgement Window Preset", 20) { Parent = ContainingBox, Alignment = Alignment.TopCenter, Y = 25 }; TextContent = new SpriteText(Fonts.Exo2SemiBold, "Choose a new name for your judgement window preset", 14) { Parent = ContainingBox, Alignment = Alignment.TopCenter, Y = Header.Y + Header.Height + 5 }; Textbox = new Textbox(new ScalableVector2(400, 40), Fonts.Exo2SemiBold, 16, Windows.Name) { Parent = ContainingBox, Alignment = Alignment.TopCenter, Y = TextContent.Y + 35, Alpha = 0, InputText = { Alignment = Alignment.MidLeft }, Cursor = { Alignment = Alignment.MidLeft } }; Textbox.AddBorder(Colors.MainAccent, 2); Textbox.OnSubmit += (e) => { Windows.Name = e; JudgementWindowsDatabaseCache.Update(Windows); var windows = WindowContainer.Pool.Find(x => x.Item == Windows); if (windows != null) { var w = (DrawableJudgementWindows)windows; w.Name.Text = e; } DialogManager.Dismiss(this); }; }