-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
881 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using fluXis.Game.Overlay.Club; | ||
using osu.Framework.Allocation; | ||
|
||
namespace fluXis.Game.Tests.Overlay; | ||
|
||
public partial class TestClubOverlay : FluXisTestScene | ||
{ | ||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
var overlay = new ClubOverlay(); | ||
Add(overlay); | ||
|
||
AddStep("Show Club 1", () => overlay.ShowClub(1)); | ||
AddStep("Show Club 2", () => overlay.ShowClub(2)); | ||
AddStep("Hide", overlay.Hide); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Sprites; | ||
|
||
namespace fluXis.Game.Graphics.UserInterface.Tabs; | ||
|
||
public abstract partial class TabContainer : Container | ||
{ | ||
public abstract IconUsage Icon { get; } | ||
public abstract string Title { get; } | ||
|
||
protected TabContainer() | ||
{ | ||
RelativeSizeAxes = Axes.X; | ||
AutoSizeAxes = Axes.Y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
using System; | ||
using System.Linq; | ||
using fluXis.Game.Graphics.Sprites; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Framework.Input.Events; | ||
using osuTK; | ||
|
||
namespace fluXis.Game.Graphics.UserInterface.Tabs; | ||
|
||
public partial class TabControl : CompositeDrawable | ||
{ | ||
public TabContainer[] Tabs { get; init; } = Array.Empty<TabContainer>(); | ||
|
||
private Bindable<TabContainer> current; | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
RelativeSizeAxes = Axes.X; | ||
AutoSizeAxes = Axes.Y; | ||
|
||
if (Tabs.Length <= 0) | ||
throw new ArgumentException($"{nameof(Tabs)} must have 1 or more children."); | ||
|
||
current = new Bindable<TabContainer>(Tabs.First()); | ||
|
||
InternalChild = new FillFlowContainer | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Direction = FillDirection.Vertical, | ||
Spacing = new Vector2(16), | ||
Children = new Drawable[] | ||
{ | ||
new FillFlowContainer | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Direction = FillDirection.Horizontal, | ||
Spacing = new Vector2(24), | ||
ChildrenEnumerable = Tabs.Select(t => new TabControlItem(t, current)) | ||
}, | ||
new Container | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Children = Tabs | ||
} | ||
} | ||
}; | ||
} | ||
|
||
protected override void LoadComplete() | ||
{ | ||
base.LoadComplete(); | ||
|
||
current.BindValueChanged(currentChanged, true); | ||
FinishTransforms(true); | ||
} | ||
|
||
private void currentChanged(ValueChangedEvent<TabContainer> e) | ||
{ | ||
foreach (var tab in Tabs) | ||
{ | ||
if (tab != e.NewValue) | ||
tab.FadeOut(150); | ||
} | ||
|
||
e.NewValue.Delay(100).FadeIn(150); | ||
} | ||
|
||
private partial class TabControlItem : FillFlowContainer | ||
{ | ||
private TabContainer container { get; } | ||
private Bindable<TabContainer> current { get; } | ||
|
||
public TabControlItem(TabContainer container, Bindable<TabContainer> current) | ||
{ | ||
this.container = container; | ||
this.current = current; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
AutoSizeAxes = Axes.Both; | ||
Direction = FillDirection.Horizontal; | ||
Spacing = new Vector2(8); | ||
|
||
InternalChildren = new Drawable[] | ||
{ | ||
new SpriteIcon | ||
{ | ||
Size = new Vector2(20), | ||
Icon = container.Icon, | ||
Anchor = Anchor.CentreLeft, | ||
Origin = Anchor.CentreLeft | ||
}, | ||
new FluXisSpriteText | ||
{ | ||
Text = container.Title, | ||
WebFontSize = 14, | ||
Anchor = Anchor.CentreLeft, | ||
Origin = Anchor.CentreLeft | ||
} | ||
}; | ||
} | ||
|
||
protected override void LoadComplete() | ||
{ | ||
base.LoadComplete(); | ||
|
||
current.BindValueChanged(currentChanged, true); | ||
FinishTransforms(); | ||
} | ||
|
||
private void currentChanged(ValueChangedEvent<TabContainer> e) | ||
{ | ||
this.FadeTo(e.NewValue == container ? 1 : .6f, 150); | ||
} | ||
|
||
protected override bool OnClick(ClickEvent e) | ||
{ | ||
current.Value = container; | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using fluXis.Shared.Components.Clubs; | ||
|
||
namespace fluXis.Game.Online.API.Requests.Clubs; | ||
|
||
public class ClubRequest : APIRequest<APIClub> | ||
{ | ||
protected override string Path => $"/club/{id}"; | ||
|
||
private long id { get; } | ||
|
||
public ClubRequest(long id) | ||
{ | ||
this.id = id; | ||
} | ||
} |
Oops, something went wrong.