From a658f05ecb174272ad2978dfaf7062096bc664c7 Mon Sep 17 00:00:00 2001 From: Mikira Sora Date: Thu, 29 Aug 2024 14:32:44 +0800 Subject: [PATCH 1/8] Update BuildProgram.yml --- .github/workflows/BuildProgram.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/BuildProgram.yml b/.github/workflows/BuildProgram.yml index c5215058..a3a08a7b 100644 --- a/.github/workflows/BuildProgram.yml +++ b/.github/workflows/BuildProgram.yml @@ -43,7 +43,7 @@ jobs: - name: Setup .NET7 uses: actions/setup-dotnet@v4.0.1 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: get-version-action id: project-version uses: euberdeveloper/ga-project-version@main From 309a8fc8e711f9c19379ab0c21433e91086973c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E9=BB=91?= Date: Sat, 31 Aug 2024 21:57:33 +0800 Subject: [PATCH 2/8] Update SplashScreen styles --- OngekiFumenEditor/App.xaml | 2 ++ .../SplashScreen/Views/SplashScreenView.xaml | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/OngekiFumenEditor/App.xaml b/OngekiFumenEditor/App.xaml index a2ec62bb..7770166a 100644 --- a/OngekiFumenEditor/App.xaml +++ b/OngekiFumenEditor/App.xaml @@ -31,6 +31,8 @@ + + diff --git a/OngekiFumenEditor/Modules/SplashScreen/Views/SplashScreenView.xaml b/OngekiFumenEditor/Modules/SplashScreen/Views/SplashScreenView.xaml index ecd213c3..2a0fb5e6 100644 --- a/OngekiFumenEditor/Modules/SplashScreen/Views/SplashScreenView.xaml +++ b/OngekiFumenEditor/Modules/SplashScreen/Views/SplashScreenView.xaml @@ -12,23 +12,25 @@ xmlns:res="clr-namespace:OngekiFumenEditor.Properties" xmlns:vm="clr-namespace:OngekiFumenEditor.Modules.SplashScreen.ViewModels" Title="Welcome" + WindowTitleBrush="Transparent" Width="1000" Height="700" + BorderThickness="0" + GlowBrush="Black" d:DataContext="{d:DesignInstance Type=vm:SplashScreenViewModel}" Background="{StaticResource EnvironmentWindowBackground}" - ResizeMode="NoResize" + SaveWindowPosition="True" mc:Ignorable="d"> - @@ -182,7 +184,7 @@ HorizontalContentAlignment="Stretch" cal:Message.Attach="[Event MouseLeftButtonDown] = [Action CreateNewProject()]" Cursor="Hand"> - + @@ -215,7 +217,7 @@ HorizontalContentAlignment="Stretch" cal:Message.Attach="[Event MouseLeftButtonDown] = [Action OpenProject()]" Cursor="Hand"> - + @@ -248,7 +250,7 @@ HorizontalContentAlignment="Stretch" cal:Message.Attach="[Event MouseLeftButtonDown] = [Action FastOpen()]" Cursor="Hand"> - + @@ -285,7 +287,7 @@ HorizontalContentAlignment="Stretch" cal:Message.Attach="[Event MouseLeftButtonDown] = [Action OpenTutorial()]" Cursor="Hand"> - + From 2f7903ecbd7821bbd0451966c4fece8dbc9a2e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E9=BB=91?= Date: Sat, 31 Aug 2024 21:59:39 +0800 Subject: [PATCH 3/8] Fix Beam warning time --- .../Base/OngekiObjects/Beam/BeamStart.cs | 2 +- .../Sound/DefaultFumenSoundPlayer.cs | 2 +- .../Beam/BeamLazerDrawingTarget.cs | 15 +++++++------- .../FumenVisualEditor/TGridCalculator.cs | 20 +++++++++++++++---- .../FumenVisualEditorViewModel.Drawing.cs | 2 +- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/OngekiFumenEditor/Base/OngekiObjects/Beam/BeamStart.cs b/OngekiFumenEditor/Base/OngekiObjects/Beam/BeamStart.cs index cedf414b..9ab39a3b 100644 --- a/OngekiFumenEditor/Base/OngekiObjects/Beam/BeamStart.cs +++ b/OngekiFumenEditor/Base/OngekiObjects/Beam/BeamStart.cs @@ -6,7 +6,7 @@ namespace OngekiFumenEditor.Base.OngekiObjects.Beam { public class BeamStart : ConnectableStartObject, IBeamObject { - public const int LEAD_IN_DURATION = 1000; + public const float LEAD_IN_DURATION_FRAME = 50f; public const int LEAD_IN_BODY_DURATION = 250; public const int LEAD_OUT_DURATION = 250; diff --git a/OngekiFumenEditor/Kernel/Audio/DefaultCommonImpl/Sound/DefaultFumenSoundPlayer.cs b/OngekiFumenEditor/Kernel/Audio/DefaultCommonImpl/Sound/DefaultFumenSoundPlayer.cs index bee5cb9b..b5b8340f 100644 --- a/OngekiFumenEditor/Kernel/Audio/DefaultCommonImpl/Sound/DefaultFumenSoundPlayer.cs +++ b/OngekiFumenEditor/Kernel/Audio/DefaultCommonImpl/Sound/DefaultFumenSoundPlayer.cs @@ -294,7 +294,7 @@ void AddDurationSound(SoundControl sound, TGrid tGrid, TGrid endTGrid, int loopI //generate stop AddSound(SoundControl.BeamEnd, beam.MaxTGrid); AddDurationSound(SoundControl.BeamLoop, beam.TGrid, beam.MaxTGrid, loopId); - var leadBodyInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(beam.TGrid, editor) - TimeSpan.FromMilliseconds(BeamStart.LEAD_IN_DURATION), editor); + var leadBodyInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(beam.TGrid, editor) - TGridCalculator.ConvertFrameToAudioTime(BeamStart.LEAD_IN_DURATION_FRAME), editor); if (leadBodyInTGrid is null) leadBodyInTGrid = TGrid.Zero; AddSound(SoundControl.BeamPrepare, leadBodyInTGrid); diff --git a/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/OngekiObjects/Beam/BeamLazerDrawingTarget.cs b/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/OngekiObjects/Beam/BeamLazerDrawingTarget.cs index 18be1f97..ea4caeaf 100644 --- a/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/OngekiObjects/Beam/BeamLazerDrawingTarget.cs +++ b/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/OngekiObjects/Beam/BeamLazerDrawingTarget.cs @@ -79,11 +79,11 @@ public override void Draw(IFumenEditorDrawingContext target, BeamStart obj) bool prepareWarn = false; if (curTGrid < beginTGrid) - { + { //progress = [-1,0] - var leadBodyInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(beginTGrid, target.Editor) - TimeSpan.FromMilliseconds(BeamStart.LEAD_IN_BODY_DURATION), target.Editor); - progress = MathUtils.Normalize(leadBodyInTGrid.TotalGrid, beginTGrid.TotalGrid, curTGrid.TotalGrid) - 1; - xGrid = obj.XGrid; + var leadBodyInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(beginTGrid, target.Editor) - TimeSpan.FromMilliseconds(BeamStart.LEAD_IN_BODY_DURATION), target.Editor); + progress = MathUtils.Normalize(leadBodyInTGrid.TotalGrid, beginTGrid.TotalGrid, curTGrid.TotalGrid) - 1; + xGrid = obj.XGrid; prepareWarn = true; } @@ -127,14 +127,15 @@ public override void Draw(IFumenEditorDrawingContext target, BeamStart obj) if (prepareWarn) { var audioTime = TGridCalculator.ConvertTGridToAudioTime(beginTGrid, target.Editor); - var leadAudioTime = audioTime - TimeSpan.FromMilliseconds(BeamStart.LEAD_IN_DURATION); + var leadAudioTime = audioTime - TGridCalculator.ConvertFrameToAudioTime(BeamStart.LEAD_IN_DURATION_FRAME); var leadInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(leadAudioTime, target.Editor); if (leadInTGrid is null) leadInTGrid = TGrid.Zero; - var warnProgress = MathUtils.Normalize(leadInTGrid.TotalGrid, beginTGrid.TotalGrid, curTGrid.TotalGrid) - 0.25; + var warnProgress = MathUtils.Normalize(leadInTGrid.TotalGrid, beginTGrid.TotalGrid, curTGrid.TotalGrid); + if(warnProgress < 0) warnProgress = -1; lazerDrawing.Draw(target, textureWarn, (int)width, x, (float)warnProgress, new(1, 215 / 255.0f, 0, 0.5f), rotate, judgeOffset); } - + lazerDrawing.Draw(target, textureBody, (int)width, x, (float)progress, OpenTK.Mathematics.Vector4.One, rotate, judgeOffset); } diff --git a/OngekiFumenEditor/Modules/FumenVisualEditor/TGridCalculator.cs b/OngekiFumenEditor/Modules/FumenVisualEditor/TGridCalculator.cs index 09e0b1cb..cd0c6047 100644 --- a/OngekiFumenEditor/Modules/FumenVisualEditor/TGridCalculator.cs +++ b/OngekiFumenEditor/Modules/FumenVisualEditor/TGridCalculator.cs @@ -1,4 +1,6 @@ -using OngekiFumenEditor.Base; +using Microsoft.CodeAnalysis.Differencing; + +using OngekiFumenEditor.Base; using OngekiFumenEditor.Base.Collections; using OngekiFumenEditor.Base.OngekiObjects; using OngekiFumenEditor.Modules.FumenVisualEditor.ViewModels; @@ -12,10 +14,20 @@ namespace OngekiFumenEditor.Modules.FumenVisualEditor { public static class TGridCalculator - { - #region AudioTime -> TGrid + { + #region Frame -> AudioTime - [MethodImpl(MethodImplOptions.AggressiveInlining)] + public const float FRAME_DURATION = 16.666666f; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TimeSpan ConvertFrameToAudioTime(float frame) + => TimeSpan.FromMilliseconds(FRAME_DURATION * frame); + + #endregion + + #region AudioTime -> TGrid + + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TGrid ConvertAudioTimeToTGrid(TimeSpan audioTime, FumenVisualEditorViewModel editor) => ConvertAudioTimeToTGrid(audioTime, editor.Fumen.BpmList); [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/OngekiFumenEditor/Modules/FumenVisualEditor/ViewModels/FumenVisualEditorViewModel.Drawing.cs b/OngekiFumenEditor/Modules/FumenVisualEditor/ViewModels/FumenVisualEditorViewModel.Drawing.cs index c8584c37..46ae5caf 100644 --- a/OngekiFumenEditor/Modules/FumenVisualEditor/ViewModels/FumenVisualEditorViewModel.Drawing.cs +++ b/OngekiFumenEditor/Modules/FumenVisualEditor/ViewModels/FumenVisualEditorViewModel.Drawing.cs @@ -213,7 +213,7 @@ private IEnumerable GetDisplayableObjects(OngekiFumen fumen, if (containBeams) { - var leadInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(min, this) - TimeSpan.FromMilliseconds(BeamStart.LEAD_IN_DURATION), this); + var leadInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(min, this) - TGridCalculator.ConvertFrameToAudioTime(BeamStart.LEAD_IN_DURATION_FRAME), this); var leadOutTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(max, this) + TimeSpan.FromMilliseconds(BeamStart.LEAD_OUT_DURATION), this); r = r.Concat(fumen.Beams.GetVisibleStartObjects(leadInTGrid, leadOutTGrid)); From a52a0ad3d9efecd6c3967a634f905c845f9d799a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E9=BB=91?= Date: Sat, 31 Aug 2024 22:03:13 +0800 Subject: [PATCH 4/8] Fix timing error in getting player's position when bullet targets player. --- OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs b/OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs index 9701424b..21c316c8 100644 --- a/OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs +++ b/OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs @@ -1,6 +1,8 @@ using OngekiFumenEditor.Base.EditorObjects; using OngekiFumenEditor.Base.OngekiObjects.BulletPalleteEnums; using OngekiFumenEditor.Base.OngekiObjects.Lane; +using OngekiFumenEditor.Modules.FumenVisualEditor; + using System; using System.Linq; using System.Windows.Media; @@ -17,7 +19,10 @@ public double CalculateToXGridTotalUnit(IBulletPalleteReferencable refObject, On switch (TargetValue) { case Target.Player: - var tGrid = refObject.TGrid; + var frameOffset = (40f - 7.5f) / (0.47f * refObject.ReferenceBulletPallete.Speed); + var targetAudioTime = TGridCalculator.ConvertTGridToAudioTime(refObject.TGrid, fumen.BpmList) - TGridCalculator.ConvertFrameToAudioTime(frameOffset); + if(targetAudioTime < TimeSpan.Zero) targetAudioTime = TimeSpan.Zero; + var tGrid = TGridCalculator.ConvertAudioTimeToTGrid(targetAudioTime, fumen.BpmList); var apfLane = fumen.Lanes.GetVisibleStartObjects(tGrid, tGrid).OfType().LastOrDefault(); var xGrid = apfLane?.CalulateXGrid(tGrid); xGridTotalUnit = xGrid?.TotalUnit ?? 0d; From 6dd3e31ff0029ace0f2ddd274355966d23e77d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E9=BB=91?= Date: Sat, 31 Aug 2024 22:14:41 +0800 Subject: [PATCH 5/8] The bullet speed is at least 1 when targeting the player --- OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs b/OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs index 21c316c8..174341f0 100644 --- a/OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs +++ b/OngekiFumenEditor/Base/OngekiObjects/BulletPallete.cs @@ -19,7 +19,7 @@ public double CalculateToXGridTotalUnit(IBulletPalleteReferencable refObject, On switch (TargetValue) { case Target.Player: - var frameOffset = (40f - 7.5f) / (0.47f * refObject.ReferenceBulletPallete.Speed); + var frameOffset = (40f - 7.5f) / (0.47f * MathF.Min(refObject.ReferenceBulletPallete.Speed, 1)); var targetAudioTime = TGridCalculator.ConvertTGridToAudioTime(refObject.TGrid, fumen.BpmList) - TGridCalculator.ConvertFrameToAudioTime(frameOffset); if(targetAudioTime < TimeSpan.Zero) targetAudioTime = TimeSpan.Zero; var tGrid = TGridCalculator.ConvertAudioTimeToTGrid(targetAudioTime, fumen.BpmList); From 77a2ca4d94928ee41b308e57c2308162f59a8395 Mon Sep 17 00:00:00 2001 From: Sanheiii <35133371+Sanheiii@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:43:46 +0800 Subject: [PATCH 6/8] Update BeamLazerDrawingTarget.cs --- .../OngekiObjects/Beam/BeamLazerDrawingTarget.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/OngekiObjects/Beam/BeamLazerDrawingTarget.cs b/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/OngekiObjects/Beam/BeamLazerDrawingTarget.cs index ea4caeaf..0e1c986a 100644 --- a/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/OngekiObjects/Beam/BeamLazerDrawingTarget.cs +++ b/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/OngekiObjects/Beam/BeamLazerDrawingTarget.cs @@ -79,11 +79,11 @@ public override void Draw(IFumenEditorDrawingContext target, BeamStart obj) bool prepareWarn = false; if (curTGrid < beginTGrid) - { + { //progress = [-1,0] - var leadBodyInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(beginTGrid, target.Editor) - TimeSpan.FromMilliseconds(BeamStart.LEAD_IN_BODY_DURATION), target.Editor); - progress = MathUtils.Normalize(leadBodyInTGrid.TotalGrid, beginTGrid.TotalGrid, curTGrid.TotalGrid) - 1; - xGrid = obj.XGrid; + var leadBodyInTGrid = TGridCalculator.ConvertAudioTimeToTGrid(TGridCalculator.ConvertTGridToAudioTime(beginTGrid, target.Editor) - TimeSpan.FromMilliseconds(BeamStart.LEAD_IN_BODY_DURATION), target.Editor); + progress = MathUtils.Normalize(leadBodyInTGrid.TotalGrid, beginTGrid.TotalGrid, curTGrid.TotalGrid) - 1; + xGrid = obj.XGrid; prepareWarn = true; } From c140a2ee817db7dc5a8b84a9d04b8d44bff91d35 Mon Sep 17 00:00:00 2001 From: Sanheiii <35133371+Sanheiii@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:46:00 +0800 Subject: [PATCH 7/8] Update TGridCalculator.cs --- .../Modules/FumenVisualEditor/TGridCalculator.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/OngekiFumenEditor/Modules/FumenVisualEditor/TGridCalculator.cs b/OngekiFumenEditor/Modules/FumenVisualEditor/TGridCalculator.cs index cd0c6047..5924ae2a 100644 --- a/OngekiFumenEditor/Modules/FumenVisualEditor/TGridCalculator.cs +++ b/OngekiFumenEditor/Modules/FumenVisualEditor/TGridCalculator.cs @@ -14,20 +14,20 @@ namespace OngekiFumenEditor.Modules.FumenVisualEditor { public static class TGridCalculator - { - #region Frame -> AudioTime + { + #region Frame -> AudioTime - public const float FRAME_DURATION = 16.666666f; + public const float FRAME_DURATION = 16.666666f; - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TimeSpan ConvertFrameToAudioTime(float frame) => TimeSpan.FromMilliseconds(FRAME_DURATION * frame); - #endregion + #endregion - #region AudioTime -> TGrid + #region AudioTime -> TGrid - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TGrid ConvertAudioTimeToTGrid(TimeSpan audioTime, FumenVisualEditorViewModel editor) => ConvertAudioTimeToTGrid(audioTime, editor.Fumen.BpmList); [MethodImpl(MethodImplOptions.AggressiveInlining)] From 03a496a5e7969212169537fecefe33f87eb261bd Mon Sep 17 00:00:00 2001 From: Sanheiii <35133371+Sanheiii@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:50:27 +0800 Subject: [PATCH 8/8] Update SplashScreenView.xaml --- .../Modules/SplashScreen/Views/SplashScreenView.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OngekiFumenEditor/Modules/SplashScreen/Views/SplashScreenView.xaml b/OngekiFumenEditor/Modules/SplashScreen/Views/SplashScreenView.xaml index 2a0fb5e6..ab66b78d 100644 --- a/OngekiFumenEditor/Modules/SplashScreen/Views/SplashScreenView.xaml +++ b/OngekiFumenEditor/Modules/SplashScreen/Views/SplashScreenView.xaml @@ -19,7 +19,7 @@ GlowBrush="Black" d:DataContext="{d:DesignInstance Type=vm:SplashScreenViewModel}" Background="{StaticResource EnvironmentWindowBackground}" - + ResizeMode="NoResize" SaveWindowPosition="True" mc:Ignorable="d">