github ppy/osu-framework 2019.628.0

latest releases: 2024.528.1, 2024.528.0, 2024.523.0...
5 years ago

Thanks for following along! This is a tagged release (2019.628.0). For more information check out the osu! changelog page and dev blog.

Breaking Changes

Menu and several related components have been made abstract

For each component, there are two ways to resolve resulting errors:

  1. ContextMenuContainer
    1. BasicContextMenuContainer is provided as a drop-in replacement that comes with the framework design language.
    2. Implement your own local ContextMenuContainer. The following is consumable code that matches the removed implementation. Rename it to suit your project and update your references:
      public class MyContextMenuContainer : ContextMenuContainer
      {
          // If you have a custom menu, provide it here.
          protected override Menu CreateMenu() => new BasicMenu(Direction.Vertical);
      }
  2. Menu
    1. BasicMenu is provided as a drop-in replacement that comes with the framework design language.
    2. Implement your own local Menu. The following is consumable code that matches the removed implementation. Rename it to suit your project and update your references:
      public class MyMenu : Menu
      {
          public MyMenu(Direction direction, bool topLevelMenu = false)
              : base(direction, topLevelMenu)
          {
          }
      
          protected override Menu CreateSubMenu() => new MyMenu(Direction.Vertical);
      
          protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new MyDrawableMenuItem(item);
      
          // If you have a custom scroll container, provide it here.
          protected override ScrollContainer<Drawable> CreateScrollContainer(Direction direction) => new BasicScrollContainer(direction);
      
          private class MyDrawableMenuItem : DrawableMenuItem
          {
              public MyDrawableMenuItem(MenuItem item)
                  : base(item)
              {
              }
      
              protected override Drawable CreateContent() => new SpriteText
              {
                  Anchor = Anchor.CentreLeft,
                  Origin = Anchor.CentreLeft,
                  Padding = new MarginPadding(5),
                  Font = new FontUsage(size: 17),
              };
          }
      }
  3. DropdownMenu / DropdownMenuItem. This is only applicable if you already implement a custom Dropdown<T>.
    1. The following is consumable code that matches the removed implementation. Rename it to suit your project and update your references:
      public class MyDropdown<T> : Dropdown<T>
      {
          // If you have a custom header, provide it here.
          protected override DropdownHeader CreateHeader() => null;
      
          protected override DropdownMenu CreateMenu() => new MyDropdownMenu();
      
          private class MyDropdownMenu : DropdownMenu
          {
              // If you have a custom menu, provide it here.
              protected override Menu CreateSubMenu() => new BasicMenu(Direction);
      
              // If you have a custom scroll container, provide it here.
              protected override ScrollContainer<Drawable> CreateScrollContainer(Direction direction) => new BasicScrollContainer(direction);
      
              protected override DrawableDropdownMenuItem CreateDrawableDropdownMenuItem(MenuItem item) => new MyDrawableDropdownMenuItem(item);
      
              private class MyDrawableDropdownMenuItem : DrawableDropdownMenuItem
              {
                  public MyDrawableDropdownMenuItem(MenuItem item)
                      : base(item)
                  {
                  }
      
                  // If you have custom content, provide it here.
                  protected override Drawable CreateContent() => new SpriteText
                  {
                      Anchor = Anchor.CentreLeft,
                      Origin = Anchor.CentreLeft,
                      Padding = new MarginPadding(5),
                      Font = new FontUsage(size: 17),
                  };
              }
          }
      }

DebugSetting.ActiveGCMode no longer exists

If you were manually setting this, you can do so via .NET methods.

Don't miss a new osu-framework release

NewReleases is sending notifications on new releases.