Skip to content

Commit bccf844

Browse files
committed
implement note painting
1 parent 504d866 commit bccf844

5 files changed

Lines changed: 22 additions & 7 deletions

File tree

fluXis/Screens/Edit/Tabs/Charting/Blueprints/ChartingBlueprintContainer.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using osu.Framework.Graphics.Containers;
1616
using osu.Framework.Input.Events;
1717
using osuTK;
18+
using osuTK.Input;
1819

1920
namespace fluXis.Screens.Edit.Tabs.Charting.Blueprints;
2021

@@ -134,6 +135,18 @@ private void removePlacement()
134135
currentPlacement = null;
135136
}
136137

138+
protected override bool OnMouseMove(MouseMoveEvent e)
139+
{
140+
if (currentPlacement is null
141+
|| !currentPlacement.AllowPainting
142+
|| !InputManager.CurrentState.Keyboard.ShiftPressed
143+
|| !InputManager.CurrentState.Mouse.Buttons.Contains(MouseButton.Left))
144+
return base.OnMouseMove(e);
145+
146+
currentPlacement.FinishPlacement(true);
147+
return true;
148+
}
149+
137150
protected override SelectionBlueprint<ITimedObject> CreateBlueprint(ITimedObject obj)
138151
{
139152
SelectionBlueprint<ITimedObject> blueprint = null!;

fluXis/Screens/Edit/Tabs/Charting/Blueprints/Placement/NotePlacementBlueprint.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using fluXis.Utils;
66
using osu.Framework.Allocation;
77
using osu.Framework.Input;
8-
using osu.Framework.Logging;
98

109
namespace fluXis.Screens.Edit.Tabs.Charting.Blueprints.Placement;
1110

@@ -60,9 +59,6 @@ protected override void OnPlacementFinished(bool commit)
6059
else
6160
clone.Lane += Map.RealmMap.KeyCount;
6261

63-
Logger.Log(Hit.Serialize());
64-
Logger.Log(clone.Serialize());
65-
6662
Actions.Add(new NoteMultiPlaceAction(new[] { Hit, clone }));
6763
return;
6864
}

fluXis/Screens/Edit/Tabs/Charting/Blueprints/Placement/PlacementBlueprint.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public partial class PlacementBlueprint : Container
2323

2424
protected virtual ITimePositionProvider PositionProvider => ChartingContainer.Playfields[0];
2525

26+
public virtual bool AllowPainting => false;
27+
2628
public PlacementState State { get; set; }
2729
public ITimedObject Object { get; }
2830

fluXis/Screens/Edit/Tabs/Charting/Blueprints/Placement/SingleNotePlacementBlueprint.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Linq;
23
using fluXis.Screens.Edit.Tabs.Charting.Playfield;
34
using osu.Framework.Graphics;
@@ -8,6 +9,8 @@ namespace fluXis.Screens.Edit.Tabs.Charting.Blueprints.Placement;
89

910
public partial class SingleNotePlacementBlueprint : NotePlacementBlueprint
1011
{
12+
public override bool AllowPainting => true;
13+
1114
private readonly BlueprintNotePiece piece;
1215

1316
public SingleNotePlacementBlueprint()
@@ -40,7 +43,7 @@ protected override bool OnMouseDown(MouseDownEvent e)
4043

4144
protected override void OnPlacementFinished(bool commit)
4245
{
43-
if (Map.MapInfo.HitObjects.Any(h => (int)h.Time == (int)Hit.Time && h.Lane == Hit.Lane))
46+
if (Map.MapInfo.HitObjects.Where(x => x.Lane == Hit.Lane).Any(x => Math.Abs(x.Time - Hit.Time) < 10))
4447
return;
4548

4649
base.OnPlacementFinished(commit);

fluXis/Screens/Edit/Tabs/Charting/Blueprints/Placement/TickNotePlacementBlueprint.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Linq;
23
using fluXis.Screens.Edit.Tabs.Charting.Playfield;
34
using osu.Framework.Graphics;
@@ -8,6 +9,7 @@ namespace fluXis.Screens.Edit.Tabs.Charting.Blueprints.Placement;
89

910
public partial class TickNotePlacementBlueprint : NotePlacementBlueprint
1011
{
12+
public override bool AllowPainting => true;
1113
private readonly BlueprintNotePiece piece;
1214

1315
public TickNotePlacementBlueprint()
@@ -42,10 +44,9 @@ protected override bool OnMouseDown(MouseDownEvent e)
4244

4345
protected override void OnPlacementFinished(bool commit)
4446
{
45-
if (Map.MapInfo.HitObjects.Any(h => (int)h.Time == (int)Hit.Time && h.Lane == Hit.Lane))
47+
if (Map.MapInfo.HitObjects.Where(x => x.Lane == Hit.Lane).Any(x => Math.Abs(x.Time - Hit.Time) < 10))
4648
return;
4749

4850
base.OnPlacementFinished(commit);
4951
}
5052
}
51-

0 commit comments

Comments
 (0)