-
-
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.
Replace dashboard user cards with the new design
- Loading branch information
Showing
5 changed files
with
214 additions
and
135 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,36 @@ | ||
using fluXis.Game.Online; | ||
using fluXis.Game.Online.Drawables; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osuTK; | ||
|
||
namespace fluXis.Game.Tests.Online; | ||
|
||
public partial class TestDrawableUserCard : FluXisTestScene | ||
{ | ||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
var flow = new FillFlowContainer | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Direction = FillDirection.Vertical, | ||
Spacing = new Vector2(0, 10) | ||
}; | ||
|
||
Add(flow); | ||
|
||
AddStep("Add uid 1", () => flow.Add(new DrawableUserCard(UserCache.GetUser(1)) | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre | ||
})); | ||
|
||
AddStep("Add uid 2", () => flow.Add(new DrawableUserCard(UserCache.GetUser(2)) | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre | ||
})); | ||
} | ||
} |
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,45 @@ | ||
using fluXis.Game.Graphics.Sprites; | ||
using fluXis.Game.Graphics.UserInterface.Color; | ||
using fluXis.Shared.Components.Groups; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Shapes; | ||
using osuTK; | ||
|
||
namespace fluXis.Game.Online.Drawables; | ||
|
||
public partial class DrawableGroupBadge : CircularContainer | ||
{ | ||
private IAPIGroup group { get; } | ||
|
||
public DrawableGroupBadge(IAPIGroup group) | ||
{ | ||
this.group = group; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
Size = new Vector2(40, 16); | ||
Masking = true; | ||
|
||
InternalChildren = new Drawable[] | ||
{ | ||
new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Colour = FluXisColors.Background2, | ||
Alpha = .8f | ||
}, | ||
new FluXisSpriteText | ||
{ | ||
Text = group.Tag, | ||
Colour = Colour4.FromHex(group.Color), | ||
WebFontSize = 10, | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre | ||
} | ||
}; | ||
} | ||
} |
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,124 @@ | ||
using System.Linq; | ||
using fluXis.Game.Graphics.Containers; | ||
using fluXis.Game.Graphics.Drawables; | ||
using fluXis.Game.Graphics.Sprites; | ||
using fluXis.Game.Graphics.UserInterface.Color; | ||
using fluXis.Game.Overlay.User; | ||
using fluXis.Shared.Components.Users; | ||
using JetBrains.Annotations; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Shapes; | ||
using osu.Framework.Input.Events; | ||
using osuTK; | ||
|
||
namespace fluXis.Game.Online.Drawables; | ||
|
||
public partial class DrawableUserCard : CompositeDrawable | ||
{ | ||
[CanBeNull] | ||
[Resolved(CanBeNull = true)] | ||
private UserProfileOverlay profile { get; set; } | ||
|
||
private APIUserShort user { get; } | ||
|
||
public DrawableUserCard(APIUserShort user) | ||
{ | ||
this.user = user; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
Size = new Vector2(300, 80); | ||
CornerRadius = 20; | ||
Masking = true; | ||
|
||
InternalChildren = new Drawable[] | ||
{ | ||
new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Colour = FluXisColors.Background4 | ||
}, | ||
new LoadWrapper<DrawableBanner> | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
LoadContent = () => new DrawableBanner(user) | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre | ||
}, | ||
OnComplete = banner => banner.FadeInFromZero(400) | ||
}, | ||
new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Colour = FluXisColors.Background2, | ||
Alpha = 0.5f | ||
}, | ||
new FillFlowContainer | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Direction = FillDirection.Horizontal, | ||
Spacing = new Vector2(10), | ||
Children = new Drawable[] | ||
{ | ||
new LoadWrapper<DrawableAvatar> | ||
{ | ||
Size = new Vector2(80), | ||
CornerRadius = 20, | ||
Masking = true, | ||
LoadContent = () => new DrawableAvatar(user) | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre | ||
}, | ||
OnComplete = avatar => avatar.FadeInFromZero(400) | ||
}, | ||
new FillFlowContainer | ||
{ | ||
AutoSizeAxes = Axes.Both, | ||
Direction = FillDirection.Vertical, | ||
Anchor = Anchor.CentreLeft, | ||
Origin = Anchor.CentreLeft, | ||
Children = new Drawable[] | ||
{ | ||
new FluXisSpriteText | ||
{ | ||
Text = user.PreferredName, | ||
WebFontSize = 20, | ||
Shadow = true | ||
}, | ||
new FluXisSpriteText | ||
{ | ||
Text = user.Username, | ||
Alpha = string.IsNullOrWhiteSpace(user.DisplayName) ? 0 : .8f, | ||
Margin = new MarginPadding { Top = -5 }, | ||
WebFontSize = 12, | ||
Shadow = true | ||
}, | ||
new FillFlowContainer | ||
{ | ||
AutoSizeAxes = Axes.Both, | ||
Direction = FillDirection.Horizontal, | ||
Spacing = new Vector2(5), | ||
Alpha = user.Groups.Count != 0 ? 1 : 0, | ||
ChildrenEnumerable = user.Groups.Select(group => new DrawableGroupBadge(group)) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
|
||
protected override bool OnClick(ClickEvent e) | ||
{ | ||
profile?.ShowUser(user.ID); | ||
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
This file was deleted.
Oops, something went wrong.