Skip to content

Commit

Permalink
Some sexy tweaks and all that. Folder as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
steviegt6 committed Dec 25, 2021
1 parent b7f43b2 commit c5dd0bd
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 9 deletions.
63 changes: 63 additions & 0 deletions Aurora.Game.Plugins.LunarClient/LunarClientPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
using Aurora.Game.API;
using Aurora.Game.Graphics.Containers;
using Aurora.Game.Graphics.Utilities;
using Aurora.Game.Overlays;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;

namespace Aurora.Game.Plugins.LunarClient
{
Expand All @@ -15,5 +20,63 @@ public LunarClientPlugin()
}

public override UtilityBarButton GetButton() => new LunarClientButton();

public override Drawable[] GetPluginDrawables()
{
LinkTextFlowContainer largeText = new()
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
TextAnchor = Anchor.BottomCentre,
Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre,
Padding = new MarginPadding(40f),
Alpha = 1f,
Spacing = new Vector2(0f, 6f)
};

LinkTextFlowContainer smallText = new()
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
TextAnchor = Anchor.TopCentre,
Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre,
Padding = new MarginPadding(20f),
Alpha = 1f,
Spacing = new Vector2(0f, 2f),
AlwaysPresent = true
};

#region Large Text

{
void creationParameters(SpriteText x)
{
x.Font = AuroraFont.GetFont(AuroraFont.TORUS_TYPEFACE, 46f, AuroraFont.FontWeight.Regular);
x.Alpha = 1f;
}

largeText.AddText("This is some dummy text.", creationParameters);
}

#endregion

#region Small Text

{
void creationParameters(SpriteText x) => x.Font = AuroraFont.TorusFont;

smallText.AddText("You currently have the Lunar Launcher open!", creationParameters);
}

#endregion

return new Drawable[]
{
largeText,
smallText
};
}
}
}
4 changes: 2 additions & 2 deletions Aurora.Game/API/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Aurora.Game.Overlays;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;

Expand All @@ -24,6 +24,6 @@ protected Plugin()

public virtual UtilityBarButton GetButton() => throw new NotImplementedException();

public virtual Container GetPluginContainer() => throw new NotImplementedException();
public virtual Drawable[] GetPluginDrawables() => throw new NotImplementedException();
}
}
3 changes: 3 additions & 0 deletions Aurora.Game/Aurora.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
<ItemGroup>
<PackageReference Include="ppy.osu.Framework" Version="2021.1127.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Overlays\Settings" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions Aurora.Game/Overlays/UtilityBarBlockingOverlayButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Aurora.Game.Overlays
{
public class UtilityBarBlockingOverlayButton
{

}
}
30 changes: 26 additions & 4 deletions Aurora.Game/Overlays/UtilityBarButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public LocalisableString TooltipSub
private readonly SpriteText tooltip2;
private readonly SpriteText keyBindingTooltip;
protected FillFlowContainer Flow;
private bool CurrentlyRotating;

protected UtilityBarButton()
{
Expand Down Expand Up @@ -99,13 +100,18 @@ protected UtilityBarButton()
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
IconContainer = new ConstrainedIconContainer
new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(34f),
Alpha = 0,
Colour = Color4.White
Child = IconContainer = new ConstrainedIconContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(34f),
Alpha = 0,
Colour = Color4.White
}
},
DrawableText = new SpriteText
{
Expand Down Expand Up @@ -147,6 +153,11 @@ protected UtilityBarButton()
}
}
};

ScheduleAfterChildren(() =>
{
IconContainer.Icon.Origin = Anchor.Centre;
});
}

protected override bool OnMouseDown(MouseDownEvent e) => true;
Expand All @@ -163,6 +174,17 @@ protected override bool OnHover(HoverEvent e)
HoverBackground.FadeIn(200);
tooltipContainer.FadeIn(100);

if (CurrentlyRotating)
return base.OnHover(e);

IconContainer.RotateTo(360f, 1000D, Easing.InOutCubic).Delay(1000D).RotateTo(0f);
CurrentlyRotating = true;
Scheduler.AddDelayed(() =>
{
CurrentlyRotating = false;
}, 1000D);
// IconContainer.Icon.ScaleTo(0.7f, 250D, Easing.InCubic).Delay(250D).ScaleTo(1f, 250D, Easing.OutCubic);

return base.OnHover(e);
}

Expand Down
8 changes: 7 additions & 1 deletion Aurora.Game/Overlays/UtilityBarOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Aurora.Game.API;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
Expand Down Expand Up @@ -74,7 +76,11 @@ public void AddPlugin(Plugin plugin)

Scheduler.Add(() =>
{
LauncherFlowContainer.Add(plugin.GetButton());
// we prepend instead so our initial buttons (x, etc.) are to the right.
IEnumerable<Drawable> children = LauncherFlowContainer.Children.ToList(); // ToList() to get a new enumerable
children = children.Prepend(plugin.GetButton());
LauncherFlowContainer.Clear(false); // don't dispose children
LauncherFlowContainer.AddRange(children);
});
}
}
Expand Down
13 changes: 12 additions & 1 deletion Aurora.Game/Overlays/UtiltiyBarFoldersButton.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Platform;

namespace Aurora.Game.Overlays
{
public class UtiltiyBarFoldersButton : UtilityBarButton
{
protected override Anchor TooltipAnchor => Anchor.TopLeft;

[Resolved(canBeNull: true)]
private Storage? storage { get; set; }

[BackgroundDependencyLoader]
private void load()
{
TooltipMain = "Folder";
TooltipMain = "Open Folder";
TooltipSub = "Open the root launcher folder.";
SetIcon("Icons/FontAwesome/folder");
}

protected override bool OnClick(ClickEvent e)
{
storage?.PresentExternally();
return true;
}
}
}
4 changes: 3 additions & 1 deletion Aurora.Game/Screens/LauncherScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public void ChangeSelectedPlugin(ValueChangedEvent<Plugin> pluginEvent)
{
if (pluginEvent.NewValue is NullPlugin)
{
ClearInternal();

LinkTextFlowContainer largeText = new()
{
RelativeSizeAxes = Axes.X,
Expand Down Expand Up @@ -78,7 +80,7 @@ void creationParameters(SpriteText x)
}

ClearInternal();
AddInternal(pluginEvent.NewValue.GetPluginContainer());
AddRangeInternal(pluginEvent.NewValue.GetPluginDrawables());
}

public override void OnEntering(IScreen last)
Expand Down

0 comments on commit c5dd0bd

Please sign in to comment.