From 7c8c8b8bfc81e89244077e737472f78b68587569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=95=E3=83=9E=E3=82=B8=E3=83=A1?= <161014075+fu-majime@users.noreply.github.com> Date: Wed, 17 Apr 2024 23:08:18 +0900 Subject: [PATCH 1/3] Added major and minor features to Timeline (#874) * wip * move fix * wip * Insert / Delete Space --- Assets/Scripts/LevelEditor/Commands/Space.cs | 57 +++++++++++++++++ .../LevelEditor/Commands/Space.cs.meta | 11 ++++ Assets/Scripts/LevelEditor/Editor.cs | 12 ++++ .../Scripts/LevelEditor/Timeline/Timeline.cs | 62 +++++++++++++++++++ .../LevelEditor/Timeline/TimelineEventObj.cs | 12 +++- 5 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 Assets/Scripts/LevelEditor/Commands/Space.cs create mode 100644 Assets/Scripts/LevelEditor/Commands/Space.cs.meta diff --git a/Assets/Scripts/LevelEditor/Commands/Space.cs b/Assets/Scripts/LevelEditor/Commands/Space.cs new file mode 100644 index 000000000..9761aa350 --- /dev/null +++ b/Assets/Scripts/LevelEditor/Commands/Space.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Jukebox; + +using HeavenStudio.Editor.Track; +using Newtonsoft.Json; +using UnityEditor; +using UnityEngine.Timeline; + +namespace HeavenStudio.Editor.Commands +{ + // Insert / Delete Space + public class MoveEntity : ICommand + { + private readonly List entityIDs = new(); + private List newMoveBeat; + private List lastMoveBeat; + + public MoveEntity(List originalEntities, List newBeat) + { + entityIDs = originalEntities.Select(c => c.guid).ToList(); + newMoveBeat = newBeat; + } + + public void Execute() + { + lastMoveBeat = new(); + var beatmap = GameManager.instance.Beatmap; + var entities = new[] { beatmap.Entities, beatmap.TempoChanges, beatmap.VolumeChanges, beatmap.SectionMarkers } + .SelectMany(list => list); + + for (var i = 0; i < entityIDs.Count; i++) + { + var movedEntity = entities.FirstOrDefault(c => c.guid == entityIDs[i]); + + lastMoveBeat.Add(movedEntity.beat); + movedEntity.beat = newMoveBeat[i]; + } + } + + public void Undo() + { + var beatmap = GameManager.instance.Beatmap; + var entities = new[] { beatmap.Entities, beatmap.TempoChanges, beatmap.VolumeChanges, beatmap.SectionMarkers } + .SelectMany(list => list); + + for (var i = 0; i < entityIDs.Count; i++) + { + var movedEntity = entities.FirstOrDefault(c => c.guid == entityIDs[i]); + + movedEntity.beat = lastMoveBeat[i]; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/Commands/Space.cs.meta b/Assets/Scripts/LevelEditor/Commands/Space.cs.meta new file mode 100644 index 000000000..8d3c184d4 --- /dev/null +++ b/Assets/Scripts/LevelEditor/Commands/Space.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6bb50347e9fcfa143aa79f3ef0f0b436 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index d85ad599d..800c894bf 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -199,6 +199,18 @@ namespace HeavenStudio.Editor { Timeline.instance.Paste(); } + + if (Input.GetKey(KeyCode.LeftShift)) + { + if (Input.GetKeyDown(KeyCode.I)) + { + Timeline.instance.InsertSpace(); + } + else if (Input.GetKeyDown(KeyCode.U)) + { + Timeline.instance.DeleteSpace(); + } + } } if (Input.GetKey(KeyCode.LeftControl)) diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index d393ca8bd..aa2a8d6e0 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -935,6 +935,68 @@ namespace HeavenStudio.Editor.Track return dup; } + public void InsertSpace() + { + List originalEntities = new(); + List newBeats = new(); + + var beatmap = GameManager.instance.Beatmap; + var specialEntities = new[] { beatmap.TempoChanges, beatmap.VolumeChanges, beatmap.SectionMarkers } + .SelectMany(list => list); + + foreach (var entity in beatmap.Entities) + { + var entityBeat = entity.beat; + if (entityBeat >= PlaybackBeat) + { + originalEntities.Add(entity); + newBeats.Add(entityBeat + snapInterval); + } + } + foreach (var entity in specialEntities) + { + var entityBeat = entity.beat; + if (entityBeat >= PlaybackBeat && entityBeat > 0) + { + originalEntities.Add(entity); + newBeats.Add(entityBeat + snapInterval); + } + } + + if (originalEntities.Count > 0) CommandManager.Instance.AddCommand(new Commands.MoveEntity(originalEntities, newBeats)); + } + + public void DeleteSpace() + { + List originalEntities = new(); + List newBeats = new(); + + var beatmap = GameManager.instance.Beatmap; + var specialEntities = new[] { beatmap.TempoChanges, beatmap.VolumeChanges, beatmap.SectionMarkers } + .SelectMany(list => list); + + foreach (var entity in beatmap.Entities) + { + var entityBeat = entity.beat; + if (entityBeat - snapInterval >= PlaybackBeat) + { + originalEntities.Add(entity); + newBeats.Add(entityBeat - snapInterval); + } + } + foreach (var entity in specialEntities) + { + var entityBeat = entity.beat; + if (entityBeat - snapInterval >= PlaybackBeat && entityBeat > 0) + { + originalEntities.Add(entity); + newBeats.Add(entityBeat - snapInterval); + } + } + + if (originalEntities.Count > 0) CommandManager.Instance.AddCommand(new Commands.MoveEntity(originalEntities, newBeats)); + } + public float SnapToLayer(float y) { float size = LayerHeight(); diff --git a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs index d4f620684..2fa616596 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs @@ -62,6 +62,8 @@ namespace HeavenStudio.Editor.Track private double initMoveX = 0; private float initMoveY = 0; + private double selectedMinInitMoveX, selectedMaxInitMoveX; + private float selectedMinInitMoveY, selectedMaxInitMoveY; private bool movedEntity = false; private double lastBeat = 0; @@ -238,8 +240,10 @@ namespace HeavenStudio.Editor.Track { foreach (var marker in Selections.instance.eventsSelected) { - marker.entity.beat = System.Math.Max(Timeline.instance.MousePos2BeatSnap - marker.initMoveX, 0); - marker.entity["track"] = Mathf.Clamp(Timeline.instance.MousePos2Layer - marker.initMoveY, 0, Timeline.instance.LayerCount - 1); + var nextBeat = System.Math.Max(Timeline.instance.MousePos2BeatSnap, selectedMaxInitMoveX) - marker.initMoveX; + var nextTrack = Mathf.Clamp(Timeline.instance.MousePos2Layer, selectedMaxInitMoveY, Timeline.instance.LayerCount - 1 + selectedMinInitMoveY) - marker.initMoveY; + marker.entity.beat = System.Math.Max(nextBeat, 0); + marker.entity["track"] = Mathf.Clamp(nextTrack, 0, Timeline.instance.LayerCount - 1); marker.SetColor((int)entity["track"]); marker.SetWidthHeight(); } @@ -293,6 +297,10 @@ namespace HeavenStudio.Editor.Track marker.initMoveX = Timeline.instance.MousePos2BeatSnap - marker.entity.beat; marker.initMoveY = Timeline.instance.MousePos2Layer - (int)marker.entity["track"]; } + selectedMinInitMoveX = Selections.instance.eventsSelected.Min(marker => marker.initMoveX); + selectedMaxInitMoveX = Selections.instance.eventsSelected.Max(marker => marker.initMoveX); + selectedMinInitMoveY = Selections.instance.eventsSelected.Min(marker => marker.initMoveY); + selectedMaxInitMoveY = Selections.instance.eventsSelected.Max(marker => marker.initMoveY); } #region ClickEvents From 543d280c42285ae70b86894da3e3727a3d3c6f85 Mon Sep 17 00:00:00 2001 From: wookywok <62037083+wookywok@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:01:43 -0500 Subject: [PATCH 2/3] Fixed Toss Boys Ball Pop Prepare in Touch Mode (#876) They didnt prepare in touch mode - it;s a holdover from when the ball pop was going to be a flick --- Assets/Scripts/Games/TossBoys/TossBoys.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Assets/Scripts/Games/TossBoys/TossBoys.cs b/Assets/Scripts/Games/TossBoys/TossBoys.cs index b33abfc70..e56a80eee 100644 --- a/Assets/Scripts/Games/TossBoys/TossBoys.cs +++ b/Assets/Scripts/Games/TossBoys/TossBoys.cs @@ -497,7 +497,6 @@ namespace HeavenStudio.Games else if (passBallDict[beat + length].datamodel == "tossBoys/pop") { currentBall.willBePopped = true; - if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch) BeatAction.New(instance, new List() { new BeatAction.Action(beat + length - 1, delegate { GetCurrentReceiver().PopBallPrepare(); }) @@ -517,7 +516,6 @@ namespace HeavenStudio.Games else if (eventDatamodel == "tossBoys/pop") { currentBall.willBePopped = true; - if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch) BeatAction.New(instance, new List() { new BeatAction.Action(beat + length - 1, delegate { GetCurrentReceiver().PopBallPrepare(); }) @@ -584,7 +582,6 @@ namespace HeavenStudio.Games if (passBallDict.ContainsKey(beat + currentEventLength) && passBallDict[beat + currentEventLength].datamodel == "tossBoys/pop") { currentBall.willBePopped = true; - if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch) BeatAction.New(instance, new List() { new BeatAction.Action(beat + currentEventLength - 1, delegate { GetCurrentReceiver().PopBallPrepare(); }) From 7db182f9853ca01508f027d1eb4a43fffcddfd6c Mon Sep 17 00:00:00 2001 From: wookywok <62037083+wookywok@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:01:46 -0500 Subject: [PATCH 3/3] Vignette Spotlight (+ Neon fix) (#877) * Vignette Spotlight + two bugfixes - increased the maximum value of the Vignette vfx block, plus made its location customizable - fixed Neon being unable to turn off - fixed Toss Boys not preparing to pop the ball in touch mode * Revert "Vignette Spotlight + two bugfixes" This reverts the toss boys script, that's gonna be a separate pr --- Assets/Scenes/Editor.unity | 8 ++--- Assets/Scripts/Minigames.cs | 29 ++++++++++++------- Assets/Scripts/PostProcessingVFX.cs | 7 +++++ .../EdgeDetectionSobelNeonV2.cs | 4 +-- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index d72983276..94da93bb5 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -8261,7 +8261,7 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 0 + m_fontSize: 14 m_fontSizeBase: 14.3 m_fontWeight: 400 m_enableAutoSizing: 1 @@ -31578,7 +31578,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 45.795906} + m_AnchoredPosition: {x: 0, y: 199.06123} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &1154875945 @@ -41324,8 +41324,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1220118245} m_HandleRect: {fileID: 1220118244} m_Direction: 2 - m_Value: 1.0000001 - m_Size: 0 + m_Value: 1 + m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index dce38946e..733841b67 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -1037,12 +1037,18 @@ namespace HeavenStudio resizable = true, parameters = new() { - new("intenStart", new EntityTypes.Float(0f, 1f), "Start Intensity", "Set the intensity at the start of the event."), - new("intenEnd", new EntityTypes.Float(0f, 1f, 1f), "End Intensity", "Set the intensity at the end of the event."), + new("intenStart", new EntityTypes.Float(0f, 20f), "Start Intensity", "Set the intensity at the start of the event."), + new("intenEnd", new EntityTypes.Float(0f, 20f, 1f), "End Intensity", "Set the intensity at the end of the event."), new("colorStart", Color.black, "Start Color", "Set the color at the start of the event."), new("colorEnd", Color.black, "End Color", "Set the color at the end of the event."), + new("xLocStart", new EntityTypes.Float(0.0f, 1f, 0.5f), "Start X Location", "Set the X location at the start of the event."), + new("xLocEnd", new EntityTypes.Float(0.0f, 1f, 0.5f), "End X Location", "Set the X location at the end of the event."), + + new("yLocStart", new EntityTypes.Float(0.0f, 1f, 0.5f), "Start Y Location", "Set the Y location at the start of the event."), + new("yLocEnd", new EntityTypes.Float(0.0f, 1f, 0.5f), "End Y Location", "Set the Y location at the end of the event."), + new("smoothStart", new EntityTypes.Float(0.01f, 1f, 0.2f), "Start Smoothness", "Set the smoothness at the start of the event."), new("smoothEnd", new EntityTypes.Float(0.01f, 1f, 0.2f), "End Smoothness", "Set the smoothness at the end of the event."), @@ -1052,7 +1058,7 @@ namespace HeavenStudio new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new() { - new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "intenStart", "colorStart", "smoothStart", "roundStart" }) + new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "intenStart", "colorStart", "smoothStart", "roundStart", "xLocStart", "yLocStart" }) }), } }, @@ -1193,10 +1199,10 @@ namespace HeavenStudio new("rgbStart", new EntityTypes.Float(0f, 1f, 1f), "Start RGB Blend", "Set the RGB blend at the start of the event."), new("rgbEnd", new EntityTypes.Float(0f, 1f, 1f), "End RGB Blend", "Set the RGB blend at the end of the event."), - new("bottomStart", new EntityTypes.Float(0f, 1f, 0f), "Start Bottom Collapse", "Set the bottom collapse at the start of the event."), + new("bottomStart", new EntityTypes.Float(0f, 1f, 0.02f), "Start Bottom Collapse", "Set the bottom collapse at the start of the event."), new("bottomEnd", new EntityTypes.Float(0f, 1f, 0.02f), "End Bottom Collapse", "Set the bottom collapse at the end of the event."), - new("noiseStart", new EntityTypes.Float(0f, 1f, 0f), "Start Noise", "Set the noise at the start of the event."), + new("noiseStart", new EntityTypes.Float(0f, 1f, 0.3f), "Start Noise", "Set the noise at the start of the event."), new("noiseEnd", new EntityTypes.Float(0f, 1f, 0.3f), "End Noise", "Set the noise knee at the end of the event."), new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new() @@ -1262,20 +1268,21 @@ namespace HeavenStudio resizable = true, parameters = new() { - new("intenStart", new EntityTypes.Float(0.1f, 1f, 0.1f), "Start Intensity", "Set the edge fade at the start of the event."), - new("intenEnd", new EntityTypes.Float(0.1f, 1f, 1f), "End Intensity", "Set the edge fade at the end of the event."), + new("intenStart", new EntityTypes.Float(0.0f, 1f, 0.0f), "Start Intensity", "Set the edge fade at the start of the event."), + new("intenEnd", new EntityTypes.Float(0.0f, 1f, 1f), "End Intensity", "Set the edge fade at the end of the event."), - new("edgeWidthStart", new EntityTypes.Float(0.05f, 5f, 0.05f), "Start Edge Width", "Set the edge width at the start of the event."), - new("edgeWidthEnd", new EntityTypes.Float(0.05f, 5f, 2f), "End Edge Width", "Set the edge width at the end of the event."), + new("edgeWidthStart", new EntityTypes.Float(0.00f, 5f, 0.0f), "Start Edge Width", "Set the edge width at the start of the event."), + new("edgeWidthEnd", new EntityTypes.Float(0.00f, 5f, 2f), "End Edge Width", "Set the edge width at the end of the event."), - new("bgFadeStart", new EntityTypes.Float(0f, 1f, 0f), "Start Background Presence", "Set the background presence at the start of the event."), + new("bgFadeStart", new EntityTypes.Float(0f, 1f, 1f), "Start Background Presence", "Set the background presence at the start of the event."), new("bgFadeEnd", new EntityTypes.Float(0f, 1f, 0f), "End Background Presence", "Set the background presence at the end of the event."), - new("brightnessStart", new EntityTypes.Float(0f, 2f, 0f), "Start Brightness", "Set the brightness at the start of the event."), + new("brightnessStart", new EntityTypes.Float(0f, 2f, 1f), "Start Brightness", "Set the brightness at the start of the event."), new("brightnessEnd", new EntityTypes.Float(0f, 2f, 1f), "End Brightness", "Set the brightness at the end of the event."), + new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new() { new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "intenStart", "edgeWidthStart", "bgFadeStart", "brightnessStart" }) diff --git a/Assets/Scripts/PostProcessingVFX.cs b/Assets/Scripts/PostProcessingVFX.cs index 69a45e4b4..5d5800b6d 100644 --- a/Assets/Scripts/PostProcessingVFX.cs +++ b/Assets/Scripts/PostProcessingVFX.cs @@ -115,6 +115,10 @@ namespace HeavenStudio float newRoundness = func(e["roundStart"], e["roundEnd"], clampNormal); v.roundness.Override(newRoundness); + + float newXPos = func(e["xLocStart"], e["xLocEnd"], clampNormal); + float newYPos = func(e["yLocStart"], e["yLocEnd"], clampNormal); + v.center.Override( new Vector2Parameter { value = new Vector2(newXPos, newYPos) }); } } @@ -388,6 +392,9 @@ namespace HeavenStudio float newBrightness = func(e["brightnessStart"], e["brightnessEnd"], clampNormal); sn.Brigtness.Override(newBrightness); + + + } } diff --git a/Assets/X-PostProcessing/Effects/EdgeDetectionSobelNeonV2/EdgeDetectionSobelNeonV2.cs b/Assets/X-PostProcessing/Effects/EdgeDetectionSobelNeonV2/EdgeDetectionSobelNeonV2.cs index 2871cd175..cc736e6db 100644 --- a/Assets/X-PostProcessing/Effects/EdgeDetectionSobelNeonV2/EdgeDetectionSobelNeonV2.cs +++ b/Assets/X-PostProcessing/Effects/EdgeDetectionSobelNeonV2/EdgeDetectionSobelNeonV2.cs @@ -21,10 +21,10 @@ namespace XPostProcessing [PostProcess(typeof(EdgeDetectionSobelNeonV2Renderer), PostProcessEvent.AfterStack, "X-PostProcessing/EdgeDetection/EdgeDetectionSobelNeonV2")] public class EdgeDetectionSobelNeonV2 : PostProcessEffectSettings { - [Range(0.05f, 5.0f)] + [Range(0.0f, 5.0f)] public FloatParameter EdgeWidth = new FloatParameter { value = 1f }; - [Range(0.1f, 1.0f)] + [Range(0.0f, 1.0f)] public FloatParameter EdgeNeonFade = new FloatParameter { value = 1f }; [Range(0.0f, 1.0f)]