Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
flustix committed Dec 14, 2024
1 parent cf841fd commit d3cdf2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 4 additions & 0 deletions fluXis.Game/Map/Structures/Events/LaneSwitchEvent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Linq;
using fluXis.Game.Map.Structures.Bases;
using Newtonsoft.Json;
using osu.Framework.Graphics;
Expand Down Expand Up @@ -173,6 +174,9 @@ public class LaneSwitchEvent : IMapEvent, IHasDuration, IHasEasing

public static bool[] GetRow(int count, int keycount, bool newLayout)
{
if (count == keycount)
return Enumerable.Repeat(true, keycount).ToArray();

var layout = newLayout ? SWITCH_VISIBILITY_V2 : SWITCH_VISIBILITY;

var m = layout[keycount - 2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,14 @@ private void update()
else
length = clock.TrackLength - Event.Time;

var visibility = LaneSwitchEvent.GetRow(Event.Count, map.RealmMap.KeyCount, map.MapInfo.NewLaneSwitchLayout);
var current = LaneSwitchEvent.GetRow(Event.Count, map.RealmMap.KeyCount, map.MapInfo.NewLaneSwitchLayout);
StateChange[] states = new StateChange[map.RealmMap.KeyCount];

var current = Event.Count == map.RealmMap.KeyCount
? Enumerable.Repeat(true, map.RealmMap.KeyCount).ToArray()
: visibility;

var previousEvent = map.MapEvents.LaneSwitchEvents.LastOrDefault(e => e.Time < Event.Time);

if (previousEvent != null)
{
var prev = previousEvent.Count == map.RealmMap.KeyCount
? Enumerable.Repeat(true, map.RealmMap.KeyCount).ToArray()
: visibility;
var prev = LaneSwitchEvent.GetRow(previousEvent.Count, map.RealmMap.KeyCount, map.MapInfo.NewLaneSwitchLayout);

for (int i = 0; i < map.RealmMap.KeyCount; i++)
{
Expand Down
4 changes: 0 additions & 4 deletions fluXis.Game/Screens/Gameplay/Ruleset/LaneSwitchManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ private void build()
private IEnumerable<int> getWidths(LaneSwitchEvent ev)
{
var w = skin.SkinJson.GetKeymode(ev.Count).ColumnWidth;

if (ev.Count == keycount)
return Enumerable.Repeat(0, keycount).Select(_ => w);

return LaneSwitchEvent.GetRow(ev.Count, keycount, newLayout).Select(l => l ? w : 0);
}
}

0 comments on commit d3cdf2a

Please sign in to comment.