/// <summary> /// Initializes the Page /// </summary> protected override void Init() { base.Init(); MenuAnchor aLeft = new MenuAnchor() { anchor = new Vector2(0.5f, 0), offset = new Vector2(-105, 200), offset_button = new Vector2(0, 50) }, aRight = new MenuAnchor() { anchor = new Vector2(0.5f, 0), offset = new Vector2(105, 200), offset_button = new Vector2(0, 50) }, aCentre = new MenuAnchor() { anchor = new Vector2(0.5f, 0f), offset = new Vector2(0f, 200f), offset_button = new Vector2(0f, 50f) }; anchors.AddRange(new List<MenuAnchor>() { aLeft, aRight, aCentre }); buttons.Add(new MenuButton(0, "Accent colour:", "", "", () => { }).With(mb => { mb.canMouseOver = false; mb.SetAutomaticPosition(aLeft, 0); mb.Update += () => mb.colorText = ColourAccent; })); buttons.Add(new Image(MctUI.WhitePixel) { Scale = new Vector2(24f), IsButton = true, size = new Vector2(40f) / 24f, colorText = FromAccentEnum(AccentColour.Cobalt), description = "Cobalt" } .With(mb => { mb.SetAutomaticPosition(aLeft, 1); mb.Click += () => AccentColour = AccentColour.Cobalt; })); buttons.Add(new Image(MctUI.WhitePixel) { Scale = new Vector2(24f), IsButton = true, size = new Vector2(40f) / 24f, colorText = FromAccentEnum(AccentColour.Lime), description = "Lime" } .With(mb => { mb.SetAutomaticPosition(aLeft, 2); mb.Click += () => AccentColour = AccentColour.Lime; })); buttons.Add(new Image(MctUI.WhitePixel) { Scale = new Vector2(24f), IsButton = true, size = new Vector2(40f) / 24f, colorText = FromAccentEnum(AccentColour.OrangeRed), description = "Orange-red" } .With(mb => { mb.SetAutomaticPosition(aLeft, 3); mb.Click += () => AccentColour = AccentColour.OrangeRed; })); // --- buttons.Add(new MenuButton(0, "Theme colour:", "", "", () => { }).With(mb => { mb.canMouseOver = false; mb.SetAutomaticPosition(aRight, 0); mb.Update += () => mb.colorText = ColourAccent; })); buttons.Add(new Image(MctUI.WhitePixel) { Scale = new Vector2(24f), IsButton = true, size = new Vector2(40f) / 24f, colorText = FromThemeEnum(ThemeColour.Black), description = "Black" } .With((mb) => { mb.SetAutomaticPosition(aRight, 1); mb.Click += () => ThemeColour = ThemeColour.Black; })); buttons.Add(new Image(MctUI.WhitePixel) { Scale = new Vector2(24f), IsButton = true, size = new Vector2(40f) / 24f, colorText = FromThemeEnum(ThemeColour.White), description = "White" } .With((mb) => { mb.SetAutomaticPosition(aRight, 2); mb.Click += () => ThemeColour = ThemeColour.White; })); // --- buttons.Add(new MenuButton(0, "Back", "Options").Where(mb => mb.SetAutomaticPosition(aCentre, 4))); }
public static Color FromAccentEnum(AccentColour accent) { switch (accent) { case AccentColour.Cobalt: return Cobalt; case AccentColour.Lime: return Color.Lime; case AccentColour.OrangeRed: return Color.OrangeRed; } throw new ArgumentOutOfRangeException("accent"); }
protected override void OnFree() { base.OnFree(); AccentColour.UnbindFrom(StarSheet.AccentColour); }
protected override void OnFree() { base.OnFree(); AccentColour.UnbindFrom(parentSlide.AccentColour); }
protected override void OnApply() { base.OnApply(); AccentColour.BindTo(ParentHitObject.AccentColour); }
private void load() { AccentColour.BindValueChanged(evt => capStar.UpdateColour(evt.NewValue), true); }