-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor "HitObjectFade" into "LayerFade" and make it support more th…
…an just hitobjects
- Loading branch information
Showing
14 changed files
with
162 additions
and
117 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
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 was deleted.
Oops, something went wrong.
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,40 @@ | ||
using fluXis.Game.Map.Structures.Bases; | ||
using Newtonsoft.Json; | ||
using osu.Framework.Graphics; | ||
|
||
namespace fluXis.Game.Map.Structures.Events; | ||
|
||
public class LayerFadeEvent : IMapEvent, IHasDuration, IHasEasing | ||
{ | ||
[JsonProperty("time")] | ||
public double Time { get; set; } | ||
|
||
[JsonProperty("duration")] | ||
public double Duration { get; set; } | ||
|
||
[JsonProperty("alpha")] | ||
public float Alpha { get; set; } = 1; | ||
|
||
[JsonProperty("ease")] | ||
public Easing Easing { get; set; } | ||
|
||
[JsonProperty("layer")] | ||
public FadeLayer Layer { get; set; } = FadeLayer.HitObjects; | ||
|
||
public void Apply(Drawable drawable) | ||
{ | ||
// make sure this is set, just in case it's missing | ||
if (Alpha <= 0.0001f) | ||
drawable.AlwaysPresent = true; | ||
|
||
using (drawable.BeginAbsoluteSequence(Time)) | ||
drawable.FadeTo(Alpha, Duration, Easing); | ||
} | ||
|
||
public enum FadeLayer | ||
{ | ||
HitObjects, | ||
Stage, | ||
Receptors | ||
} | ||
} |
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
67 changes: 0 additions & 67 deletions
67
fluXis.Game/Screens/Edit/Tabs/Design/Points/Entries/HitObjectFadeEntry.cs
This file was deleted.
Oops, something went wrong.
79 changes: 79 additions & 0 deletions
79
fluXis.Game/Screens/Edit/Tabs/Design/Points/Entries/LayerFadeEntry.cs
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,79 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using fluXis.Game.Graphics.Sprites; | ||
using fluXis.Game.Graphics.UserInterface.Color; | ||
using fluXis.Game.Map.Structures.Bases; | ||
using fluXis.Game.Map.Structures.Events; | ||
using fluXis.Game.Screens.Edit.Tabs.Shared.Points.List; | ||
using fluXis.Game.Screens.Edit.Tabs.Shared.Points.Settings; | ||
using fluXis.Game.Screens.Edit.Tabs.Shared.Points.Settings.Preset; | ||
using fluXis.Game.Utils; | ||
using osu.Framework.Graphics; | ||
|
||
namespace fluXis.Game.Screens.Edit.Tabs.Design.Points.Entries; | ||
|
||
public partial class LayerFadeEntry : PointListEntry | ||
{ | ||
protected override string Text => "Layer Fade"; | ||
protected override Colour4 Color => FluXisColors.LayerFade; | ||
|
||
private LayerFadeEvent fade => Object as LayerFadeEvent; | ||
|
||
public LayerFadeEntry(LayerFadeEvent obj) | ||
: base(obj) | ||
{ | ||
} | ||
|
||
public override ITimedObject CreateClone() => new LayerFadeEvent | ||
{ | ||
Time = Object.Time, | ||
Duration = fade.Duration, | ||
Alpha = fade.Alpha, | ||
Easing = fade.Easing, | ||
Layer = fade.Layer | ||
}; | ||
|
||
protected override Drawable[] CreateValueContent() => new Drawable[] | ||
{ | ||
new FluXisSpriteText | ||
{ | ||
Text = $"{fade.Layer.ToString()} {(fade.Alpha * 100).ToStringInvariant()}% {(int)fade.Duration}ms", | ||
Colour = Color | ||
} | ||
}; | ||
|
||
protected override IEnumerable<Drawable> CreateSettings() | ||
{ | ||
return base.CreateSettings().Concat(new Drawable[] | ||
{ | ||
new PointSettingsLength<LayerFadeEvent>(Map, fade, BeatLength), | ||
new PointSettingsSlider<float> | ||
{ | ||
Text = "Alpha", | ||
TooltipText = "The opacity of the hitobjects.", | ||
CurrentValue = fade.Alpha, | ||
Min = 0, | ||
Max = 1, | ||
OnValueChanged = v => | ||
{ | ||
fade.Alpha = v; | ||
Map.Update(fade); | ||
} | ||
}, | ||
new PointSettingsEasing<LayerFadeEvent>(Map, fade), | ||
new PointSettingsDropdown<LayerFadeEvent.FadeLayer> | ||
{ | ||
Text = "Layer", | ||
TooltipText = "The layer to adjust the opacity of.", | ||
CurrentValue = fade.Layer, | ||
Items = Enum.GetValues<LayerFadeEvent.FadeLayer>().ToList(), | ||
OnValueChanged = value => | ||
{ | ||
fade.Layer = value; | ||
Map.Update(fade); | ||
} | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.