From 954c73fef312f6384bb4b237271cda30c0626ba0 Mon Sep 17 00:00:00 2001 From: Coppertine <37494321+Coppertine@users.noreply.github.com> Date: Tue, 7 Apr 2020 01:05:51 +1000 Subject: [PATCH 1/9] Changed from PositionToEnd to Angle --- .../osu.Game.Rulesets.Tau.csproj | 4 +-- .../Beatmaps/tauBeatmapConverter.cs | 4 +-- osu.Game.Rulesets.tau/Extensions.cs | 2 +- .../Objects/Drawables/DrawabletauHitObject.cs | 14 +++++----- .../Replays/tauAutoGenerator.cs | 4 +-- osu.Game.Rulesets.tau/UI/tauPlayfield.cs | 28 +++++++++---------- 6 files changed, 27 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj b/osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj index 61adb36f..caee15d1 100644 --- a/osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj +++ b/osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/osu.Game.Rulesets.tau/Beatmaps/tauBeatmapConverter.cs b/osu.Game.Rulesets.tau/Beatmaps/tauBeatmapConverter.cs index abc089d0..e94b4ae7 100644 --- a/osu.Game.Rulesets.tau/Beatmaps/tauBeatmapConverter.cs +++ b/osu.Game.Rulesets.tau/Beatmaps/tauBeatmapConverter.cs @@ -33,9 +33,9 @@ protected override IEnumerable ConvertHitObject(HitObject original default: return new TauHitObject { - Samples = original is IHasCurve ? ((IHasCurve)original).NodeSamples[0] : original.Samples, + Samples = original is IHasCurve curve ? curve.NodeSamples[0] : original.Samples, StartTime = original.StartTime, - PositionToEnd = position, + Angle = position.GetHitObjectAngle(), NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, }.Yield(); diff --git a/osu.Game.Rulesets.tau/Extensions.cs b/osu.Game.Rulesets.tau/Extensions.cs index 8319ac9e..1186a7c4 100644 --- a/osu.Game.Rulesets.tau/Extensions.cs +++ b/osu.Game.Rulesets.tau/Extensions.cs @@ -16,6 +16,6 @@ public static float GetDegreesFromPosition(this Vector2 target, Vector2 self) return degrees; } - public static float GetHitObjectAngle(this Vector2 target, Vector2 self) => target.GetDegreesFromPosition(self) * 4; + public static float GetHitObjectAngle(this Vector2 target) => target.GetDegreesFromPosition(new Vector2(250, 192)); } } diff --git a/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs b/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs index 562105e8..7120e114 100644 --- a/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs +++ b/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs @@ -57,25 +57,25 @@ public DrawabletauHitObject(TauHitObject hitObject) Alpha = 0.05f }); - hitObject.Angle = hitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); Box.Rotation = hitObject.Angle; Position = Vector2.Zero; } - private Bindable size; + private Bindable size = new Bindable(10); // Change as you see fit. - [BackgroundDependencyLoader] + + [BackgroundDependencyLoader(true)] private void load(TauRulesetConfigManager config) { - size = config.GetBindable(TauRulesetSettings.BeatSize); + config?.BindWith(TauRulesetSettings.BeatSize, size); size.BindValueChanged(value => this.Size = new Vector2(value.NewValue), true); } protected override void UpdateInitialTransforms() { base.UpdateInitialTransforms(); - var b = HitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); + var b = HitObject.Angle; var a = b *= (float)(Math.PI / 180); Box.FadeIn(HitObject.TimeFadeIn); @@ -128,7 +128,7 @@ protected override void UpdateStateTransforms(ArmedState state) break; case ArmedState.Hit: - var b = HitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); + var b = HitObject.Angle; var a = b *= (float)(Math.PI / 180); Box.ScaleTo(2f, time_fade_hit, Easing.OutCubic) @@ -141,7 +141,7 @@ protected override void UpdateStateTransforms(ArmedState state) break; case ArmedState.Miss: - var c = HitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); + var c = HitObject.Angle; var d = c *= (float)(Math.PI / 180); Box.ScaleTo(0.5f, time_fade_miss, Easing.InCubic) diff --git a/osu.Game.Rulesets.tau/Replays/tauAutoGenerator.cs b/osu.Game.Rulesets.tau/Replays/tauAutoGenerator.cs index a3f3f6eb..02e432d6 100644 --- a/osu.Game.Rulesets.tau/Replays/tauAutoGenerator.cs +++ b/osu.Game.Rulesets.tau/Replays/tauAutoGenerator.cs @@ -51,14 +51,14 @@ public override Replay Generate() //Make the cursor stay at the last note's position if there's enough time between the notes if (i > 0 && h.StartTime - Beatmap.HitObjects[i - 1].StartTime > reactionTime) { - float b = Beatmap.HitObjects[i - 1].PositionToEnd.GetHitObjectAngle(Vector2.Zero) * MathF.PI / 180; + float b = Beatmap.HitObjects[i - 1].Angle * MathF.PI / 180; Replay.Frames.Add(new TauReplayFrame(h.StartTime - reactionTime, new Vector2(offset - (cursorDistance * MathF.Cos(b)), offset - (cursorDistance * MathF.Sin(b))))); buttonIndex = (int)TauAction.LeftButton; } - float a = h.PositionToEnd.GetHitObjectAngle(Vector2.Zero) * MathF.PI / 180; + float a = h.Angle * MathF.PI / 180; Replay.Frames.Add(new TauReplayFrame(h.StartTime, new Vector2(offset - (cursorDistance * MathF.Cos(a)), offset - (cursorDistance * MathF.Sin(a))), (TauAction)(buttonIndex++ % 2))); } diff --git a/osu.Game.Rulesets.tau/UI/tauPlayfield.cs b/osu.Game.Rulesets.tau/UI/tauPlayfield.cs index ae2b9316..95de6fba 100644 --- a/osu.Game.Rulesets.tau/UI/tauPlayfield.cs +++ b/osu.Game.Rulesets.tau/UI/tauPlayfield.cs @@ -112,21 +112,21 @@ public TauPlayfield() }); } - [Resolved] - private TauRulesetConfigManager config { get; set; } + protected Bindable PlayfieldDimLevel = new Bindable(1); // Change the default as you see fit - protected override void LoadComplete() + [BackgroundDependencyLoader(true)] + private void load(TauRulesetConfigManager config) { - base.LoadComplete(); - - PlayfieldDimLevel = config.GetBindable(TauRulesetSettings.PlayfieldDim); + config?.BindWith(TauRulesetSettings.PlayfieldDim, PlayfieldDimLevel); PlayfieldDimLevel.ValueChanged += _ => updateVisuals(); + } + protected override void LoadComplete() + { + base.LoadComplete(); updateVisuals(); } - protected Bindable PlayfieldDimLevel { get; private set; } - private void updateVisuals() { playfieldBackground.FadeTo(PlayfieldDimLevel.Value, 100); @@ -151,8 +151,7 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) var tauObj = (DrawabletauHitObject)judgedObject; - var b = tauObj.HitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); - var a = b *= (float)(Math.PI / 180); + var a = tauObj.HitObject.Angle * (float)(Math.PI / 180); DrawableTauJudgement explosion = new DrawableTauJudgement(result, tauObj) { @@ -179,7 +178,7 @@ private class VisualisationContainer : BeatSyncedContainer private LogoVisualisation visualisation; private bool firstKiaiBeat = true; private int kiaiBeatIndex; - protected Bindable ShowVisualisation; + private readonly Bindable ShowVisualisation = new Bindable(true); [BackgroundDependencyLoader(true)] private void load(TauRulesetConfigManager settings) @@ -200,16 +199,15 @@ private void load(TauRulesetConfigManager settings) Colour = Color4.Transparent }; - ShowVisualisation = settings.GetBindable(TauRulesetSettings.ShowVisualizer); - - ShowVisualisation.ValueChanged += value => { visualisation.FadeTo(value.NewValue ? 1 : 0, 500); }; - ShowVisualisation.TriggerChange(); + settings?.BindWith(TauRulesetSettings.ShowVisualizer, ShowVisualisation); + ShowVisualisation.BindValueChanged(value => { visualisation.FadeTo(value.NewValue ? 1 : 0, 500); }); } protected override void LoadComplete() { base.LoadComplete(); visualisation.AccentColour = Color4.White; + ShowVisualisation.TriggerChange(); } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) From 7d63e3eccea081a5447a0c27e110f2a7b3d0cbbb Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Mon, 6 Apr 2020 23:28:15 +0800 Subject: [PATCH 2/9] Remove odd angle in angle calculations I don't see how it's required if it gets offset. The only consequence I can see happening from this commit is that all notes will move to a slightly different point on the circle. --- osu.Game.Rulesets.tau/Extensions.cs | 2 +- osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.tau/Extensions.cs b/osu.Game.Rulesets.tau/Extensions.cs index 1186a7c4..c76a4b93 100644 --- a/osu.Game.Rulesets.tau/Extensions.cs +++ b/osu.Game.Rulesets.tau/Extensions.cs @@ -11,7 +11,7 @@ public static class Extensions public static float GetDegreesFromPosition(this Vector2 target, Vector2 self) { Vector2 offset = self - target; - float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; + float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)); return degrees; } diff --git a/osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs b/osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs index b7dd5750..8fe8f1d6 100644 --- a/osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs +++ b/osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs @@ -167,7 +167,7 @@ public GameplayCursor(float cs) protected override bool OnMouseMove(MouseMoveEvent e) { - var angle = e.MousePosition.GetDegreesFromPosition(AnchorPosition) - 25; + var angle = e.MousePosition.GetDegreesFromPosition(AnchorPosition); Rotation = angle; From 6f710d303e22059a0f9a47b4d7759ad601b09ebb Mon Sep 17 00:00:00 2001 From: Coppertine <37494321+Coppertine@users.noreply.github.com> Date: Tue, 7 Apr 2020 01:05:51 +1000 Subject: [PATCH 3/9] Changed from PositionToEnd to Angle --- .../Beatmaps/tauBeatmapConverter.cs | 4 +-- osu.Game.Rulesets.tau/Extensions.cs | 2 +- .../Objects/Drawables/DrawabletauHitObject.cs | 14 +++++----- .../Replays/tauAutoGenerator.cs | 4 +-- osu.Game.Rulesets.tau/UI/tauPlayfield.cs | 28 +++++++++---------- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.tau/Beatmaps/tauBeatmapConverter.cs b/osu.Game.Rulesets.tau/Beatmaps/tauBeatmapConverter.cs index abc089d0..e94b4ae7 100644 --- a/osu.Game.Rulesets.tau/Beatmaps/tauBeatmapConverter.cs +++ b/osu.Game.Rulesets.tau/Beatmaps/tauBeatmapConverter.cs @@ -33,9 +33,9 @@ protected override IEnumerable ConvertHitObject(HitObject original default: return new TauHitObject { - Samples = original is IHasCurve ? ((IHasCurve)original).NodeSamples[0] : original.Samples, + Samples = original is IHasCurve curve ? curve.NodeSamples[0] : original.Samples, StartTime = original.StartTime, - PositionToEnd = position, + Angle = position.GetHitObjectAngle(), NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, }.Yield(); diff --git a/osu.Game.Rulesets.tau/Extensions.cs b/osu.Game.Rulesets.tau/Extensions.cs index 8319ac9e..1186a7c4 100644 --- a/osu.Game.Rulesets.tau/Extensions.cs +++ b/osu.Game.Rulesets.tau/Extensions.cs @@ -16,6 +16,6 @@ public static float GetDegreesFromPosition(this Vector2 target, Vector2 self) return degrees; } - public static float GetHitObjectAngle(this Vector2 target, Vector2 self) => target.GetDegreesFromPosition(self) * 4; + public static float GetHitObjectAngle(this Vector2 target) => target.GetDegreesFromPosition(new Vector2(250, 192)); } } diff --git a/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs b/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs index 562105e8..7120e114 100644 --- a/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs +++ b/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs @@ -57,25 +57,25 @@ public DrawabletauHitObject(TauHitObject hitObject) Alpha = 0.05f }); - hitObject.Angle = hitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); Box.Rotation = hitObject.Angle; Position = Vector2.Zero; } - private Bindable size; + private Bindable size = new Bindable(10); // Change as you see fit. - [BackgroundDependencyLoader] + + [BackgroundDependencyLoader(true)] private void load(TauRulesetConfigManager config) { - size = config.GetBindable(TauRulesetSettings.BeatSize); + config?.BindWith(TauRulesetSettings.BeatSize, size); size.BindValueChanged(value => this.Size = new Vector2(value.NewValue), true); } protected override void UpdateInitialTransforms() { base.UpdateInitialTransforms(); - var b = HitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); + var b = HitObject.Angle; var a = b *= (float)(Math.PI / 180); Box.FadeIn(HitObject.TimeFadeIn); @@ -128,7 +128,7 @@ protected override void UpdateStateTransforms(ArmedState state) break; case ArmedState.Hit: - var b = HitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); + var b = HitObject.Angle; var a = b *= (float)(Math.PI / 180); Box.ScaleTo(2f, time_fade_hit, Easing.OutCubic) @@ -141,7 +141,7 @@ protected override void UpdateStateTransforms(ArmedState state) break; case ArmedState.Miss: - var c = HitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); + var c = HitObject.Angle; var d = c *= (float)(Math.PI / 180); Box.ScaleTo(0.5f, time_fade_miss, Easing.InCubic) diff --git a/osu.Game.Rulesets.tau/Replays/tauAutoGenerator.cs b/osu.Game.Rulesets.tau/Replays/tauAutoGenerator.cs index a3f3f6eb..02e432d6 100644 --- a/osu.Game.Rulesets.tau/Replays/tauAutoGenerator.cs +++ b/osu.Game.Rulesets.tau/Replays/tauAutoGenerator.cs @@ -51,14 +51,14 @@ public override Replay Generate() //Make the cursor stay at the last note's position if there's enough time between the notes if (i > 0 && h.StartTime - Beatmap.HitObjects[i - 1].StartTime > reactionTime) { - float b = Beatmap.HitObjects[i - 1].PositionToEnd.GetHitObjectAngle(Vector2.Zero) * MathF.PI / 180; + float b = Beatmap.HitObjects[i - 1].Angle * MathF.PI / 180; Replay.Frames.Add(new TauReplayFrame(h.StartTime - reactionTime, new Vector2(offset - (cursorDistance * MathF.Cos(b)), offset - (cursorDistance * MathF.Sin(b))))); buttonIndex = (int)TauAction.LeftButton; } - float a = h.PositionToEnd.GetHitObjectAngle(Vector2.Zero) * MathF.PI / 180; + float a = h.Angle * MathF.PI / 180; Replay.Frames.Add(new TauReplayFrame(h.StartTime, new Vector2(offset - (cursorDistance * MathF.Cos(a)), offset - (cursorDistance * MathF.Sin(a))), (TauAction)(buttonIndex++ % 2))); } diff --git a/osu.Game.Rulesets.tau/UI/tauPlayfield.cs b/osu.Game.Rulesets.tau/UI/tauPlayfield.cs index ae2b9316..95de6fba 100644 --- a/osu.Game.Rulesets.tau/UI/tauPlayfield.cs +++ b/osu.Game.Rulesets.tau/UI/tauPlayfield.cs @@ -112,21 +112,21 @@ public TauPlayfield() }); } - [Resolved] - private TauRulesetConfigManager config { get; set; } + protected Bindable PlayfieldDimLevel = new Bindable(1); // Change the default as you see fit - protected override void LoadComplete() + [BackgroundDependencyLoader(true)] + private void load(TauRulesetConfigManager config) { - base.LoadComplete(); - - PlayfieldDimLevel = config.GetBindable(TauRulesetSettings.PlayfieldDim); + config?.BindWith(TauRulesetSettings.PlayfieldDim, PlayfieldDimLevel); PlayfieldDimLevel.ValueChanged += _ => updateVisuals(); + } + protected override void LoadComplete() + { + base.LoadComplete(); updateVisuals(); } - protected Bindable PlayfieldDimLevel { get; private set; } - private void updateVisuals() { playfieldBackground.FadeTo(PlayfieldDimLevel.Value, 100); @@ -151,8 +151,7 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) var tauObj = (DrawabletauHitObject)judgedObject; - var b = tauObj.HitObject.PositionToEnd.GetHitObjectAngle(Vector2.Zero); - var a = b *= (float)(Math.PI / 180); + var a = tauObj.HitObject.Angle * (float)(Math.PI / 180); DrawableTauJudgement explosion = new DrawableTauJudgement(result, tauObj) { @@ -179,7 +178,7 @@ private class VisualisationContainer : BeatSyncedContainer private LogoVisualisation visualisation; private bool firstKiaiBeat = true; private int kiaiBeatIndex; - protected Bindable ShowVisualisation; + private readonly Bindable ShowVisualisation = new Bindable(true); [BackgroundDependencyLoader(true)] private void load(TauRulesetConfigManager settings) @@ -200,16 +199,15 @@ private void load(TauRulesetConfigManager settings) Colour = Color4.Transparent }; - ShowVisualisation = settings.GetBindable(TauRulesetSettings.ShowVisualizer); - - ShowVisualisation.ValueChanged += value => { visualisation.FadeTo(value.NewValue ? 1 : 0, 500); }; - ShowVisualisation.TriggerChange(); + settings?.BindWith(TauRulesetSettings.ShowVisualizer, ShowVisualisation); + ShowVisualisation.BindValueChanged(value => { visualisation.FadeTo(value.NewValue ? 1 : 0, 500); }); } protected override void LoadComplete() { base.LoadComplete(); visualisation.AccentColour = Color4.White; + ShowVisualisation.TriggerChange(); } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) From 0ef24c073a8e0919e54e04a999a8881d4e19a897 Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Mon, 6 Apr 2020 23:28:15 +0800 Subject: [PATCH 4/9] Remove odd angle in angle calculations I don't see how it's required if it gets offset. The only consequence I can see happening from this commit is that all notes will move to a slightly different point on the circle. --- osu.Game.Rulesets.tau/Extensions.cs | 2 +- osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.tau/Extensions.cs b/osu.Game.Rulesets.tau/Extensions.cs index 1186a7c4..c76a4b93 100644 --- a/osu.Game.Rulesets.tau/Extensions.cs +++ b/osu.Game.Rulesets.tau/Extensions.cs @@ -11,7 +11,7 @@ public static class Extensions public static float GetDegreesFromPosition(this Vector2 target, Vector2 self) { Vector2 offset = self - target; - float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; + float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)); return degrees; } diff --git a/osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs b/osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs index b7dd5750..8fe8f1d6 100644 --- a/osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs +++ b/osu.Game.Rulesets.tau/UI/Cursor/tauCursor.cs @@ -167,7 +167,7 @@ public GameplayCursor(float cs) protected override bool OnMouseMove(MouseMoveEvent e) { - var angle = e.MousePosition.GetDegreesFromPosition(AnchorPosition) - 25; + var angle = e.MousePosition.GetDegreesFromPosition(AnchorPosition); Rotation = angle; From 17b340dba92600af7390f29f850370f916e2a092 Mon Sep 17 00:00:00 2001 From: Coppertine <37494321+Coppertine@users.noreply.github.com> Date: Tue, 7 Apr 2020 01:36:09 +1000 Subject: [PATCH 5/9] invert y position in direction --- osu.Game.Rulesets.tau/Extensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.tau/Extensions.cs b/osu.Game.Rulesets.tau/Extensions.cs index c76a4b93..bd36e455 100644 --- a/osu.Game.Rulesets.tau/Extensions.cs +++ b/osu.Game.Rulesets.tau/Extensions.cs @@ -11,7 +11,7 @@ public static class Extensions public static float GetDegreesFromPosition(this Vector2 target, Vector2 self) { Vector2 offset = self - target; - float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)); + float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, -offset.Y)); return degrees; } From a26c87794932ca63f08a7ceed417a4fcfc1779fe Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Mon, 6 Apr 2020 23:40:27 +0800 Subject: [PATCH 6/9] Fix codefactor issue --- osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs b/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs index 7120e114..9a14bee1 100644 --- a/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs +++ b/osu.Game.Rulesets.tau/Objects/Drawables/DrawabletauHitObject.cs @@ -64,7 +64,6 @@ public DrawabletauHitObject(TauHitObject hitObject) private Bindable size = new Bindable(10); // Change as you see fit. - [BackgroundDependencyLoader(true)] private void load(TauRulesetConfigManager config) { From 584e1dc7156ab226cf9b66008c00499ef5a5aee6 Mon Sep 17 00:00:00 2001 From: Coppertine <37494321+Coppertine@users.noreply.github.com> Date: Tue, 7 Apr 2020 01:48:50 +1000 Subject: [PATCH 7/9] Fix offset issue with centre calculation --- osu.Game.Rulesets.tau/Extensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.tau/Extensions.cs b/osu.Game.Rulesets.tau/Extensions.cs index bd36e455..adde4abf 100644 --- a/osu.Game.Rulesets.tau/Extensions.cs +++ b/osu.Game.Rulesets.tau/Extensions.cs @@ -16,6 +16,6 @@ public static float GetDegreesFromPosition(this Vector2 target, Vector2 self) return degrees; } - public static float GetHitObjectAngle(this Vector2 target) => target.GetDegreesFromPosition(new Vector2(250, 192)); + public static float GetHitObjectAngle(this Vector2 target) => target.GetDegreesFromPosition(new Vector2(256, 192)); } } From dedb5506965f18fe872bdc20dbea936ff7b296b7 Mon Sep 17 00:00:00 2001 From: Coppertine <37494321+Coppertine@users.noreply.github.com> Date: Tue, 7 Apr 2020 14:57:48 +1000 Subject: [PATCH 8/9] fixed paddle and cursor not being in same place. --- osu.Game.Rulesets.tau/Extensions.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.tau/Extensions.cs b/osu.Game.Rulesets.tau/Extensions.cs index adde4abf..61f8476d 100644 --- a/osu.Game.Rulesets.tau/Extensions.cs +++ b/osu.Game.Rulesets.tau/Extensions.cs @@ -3,6 +3,7 @@ using System; using osuTK; +using Vector2 = osuTK.Vector2; namespace osu.Game.Rulesets.Tau { @@ -11,11 +12,13 @@ public static class Extensions public static float GetDegreesFromPosition(this Vector2 target, Vector2 self) { Vector2 offset = self - target; - float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, -offset.Y)); - - return degrees; + return (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)); } - public static float GetHitObjectAngle(this Vector2 target) => target.GetDegreesFromPosition(new Vector2(256, 192)); + public static float GetHitObjectAngle(this Vector2 target) + { + Vector2 offset = new Vector2(256,192) - target; + return (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, -offset.Y)); + } } } From f425deb8c8cb1945f72bb927914786a0aa7ea112 Mon Sep 17 00:00:00 2001 From: Coppertine <37494321+Coppertine@users.noreply.github.com> Date: Tue, 7 Apr 2020 14:57:48 +1000 Subject: [PATCH 9/9] fixed paddle and cursor not being in same place. --- osu.Game.Rulesets.tau/Extensions.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.tau/Extensions.cs b/osu.Game.Rulesets.tau/Extensions.cs index adde4abf..7075ea45 100644 --- a/osu.Game.Rulesets.tau/Extensions.cs +++ b/osu.Game.Rulesets.tau/Extensions.cs @@ -3,6 +3,7 @@ using System; using osuTK; +using Vector2 = osuTK.Vector2; namespace osu.Game.Rulesets.Tau { @@ -11,11 +12,13 @@ public static class Extensions public static float GetDegreesFromPosition(this Vector2 target, Vector2 self) { Vector2 offset = self - target; - float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, -offset.Y)); - - return degrees; + return (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)); } - public static float GetHitObjectAngle(this Vector2 target) => target.GetDegreesFromPosition(new Vector2(256, 192)); + public static float GetHitObjectAngle(this Vector2 target) + { + Vector2 offset = new Vector2(256, 192) - target; // Using centre of playfield. + return (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, -offset.Y)); + } } }