修改track复制步进和撤销模式

Signed-off-by: TRADER_FOER <lhf190@outlook.com>
This commit is contained in:
2026-07-10 14:05:45 +08:00
parent fdc20cd66f
commit a835e8321b
30 changed files with 1501 additions and 367 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Ichni.Editor;
using Ichni.Editor.Commands;
using UnityEngine;
namespace Ichni.RhythmGame
@@ -37,8 +38,8 @@ namespace Ichni.RhythmGame
.InputField(nameof(TimeOffset), "Offset")
.Button("Interferometer", () =>
{
Vector3Interferometer.GenerateElement("New Vector3 Interferometer", Guid.NewGuid(),
new List<string>(), true, this, InterferomType.Additive, Vector3.zero);
CommandManager.ExecuteCreate(() => Vector3Interferometer.GenerateElement("New Vector3 Interferometer", Guid.NewGuid(),
new List<string>(), true, this, InterferomType.Additive, Vector3.zero));
})
.Build();
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Ichni.Editor;
using Ichni.Editor.Commands;
using UnityEngine;
namespace Ichni.RhythmGame
@@ -37,8 +38,8 @@ namespace Ichni.RhythmGame
.InputField(nameof(TimeOffset), "Offset")
.Button("Interferometer", () =>
{
Vector3Interferometer.GenerateElement("New Vector3 Interferometer", Guid.NewGuid(),
new List<string>(), true, this, InterferomType.Additive, Vector3.zero);
CommandManager.ExecuteCreate(() => Vector3Interferometer.GenerateElement("New Vector3 Interferometer", Guid.NewGuid(),
new List<string>(), true, this, InterferomType.Additive, Vector3.zero));
})
.Build();
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Ichni.Editor;
using Ichni.Editor.Commands;
using UnityEngine;
namespace Ichni.RhythmGame
@@ -37,8 +38,8 @@ namespace Ichni.RhythmGame
.InputField(nameof(TimeOffset), "Offset")
.Button("Interferometer", () =>
{
Vector3Interferometer.GenerateElement("New Vector3 Interferometer", Guid.NewGuid(),
new List<string>(), true, this, InterferomType.Additive, Vector3.zero);
CommandManager.ExecuteCreate(() => Vector3Interferometer.GenerateElement("New Vector3 Interferometer", Guid.NewGuid(),
new List<string>(), true, this, InterferomType.Additive, Vector3.zero));
})
.Build();
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using UnityEngine;
namespace Ichni.RhythmGame
@@ -21,8 +22,8 @@ namespace Ichni.RhythmGame
new FlexibleFloat[] { positionX, positionY, positionZ }, new string[] { "PosX", "PosY", "PosZ" }))
.ParameterText(nameof(PreviewValue), "value:", autoUpdate: true)
.Span(3)
.Button("Interferometer", () => Vector3Interferometer.GenerateElement("New Vector3 Interferometer",
Guid.NewGuid(), new List<string>(), true, this, InterferomType.Additive, Vector3.zero))
.Button("Interferometer", () => CommandManager.ExecuteCreate(() => Vector3Interferometer.GenerateElement("New Vector3 Interferometer",
Guid.NewGuid(), new List<string>(), true, this, InterferomType.Additive, Vector3.zero)))
.Span(3)
.Build();
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using UnityEngine;
namespace Ichni.RhythmGame
@@ -22,8 +23,8 @@ namespace Ichni.RhythmGame
new string[] { "ScaleX", "ScaleY", "ScaleZ" }))
.ParameterText(nameof(PreviewValue), "value:", autoUpdate: true)
.Span(3)
.Button("Interferometer", () => Vector3Interferometer.GenerateElement("New Vector3 Interferometer",
Guid.NewGuid(), new List<string>(), true, this, InterferomType.Additive, Vector3.zero))
.Button("Interferometer", () => CommandManager.ExecuteCreate(() => Vector3Interferometer.GenerateElement("New Vector3 Interferometer",
Guid.NewGuid(), new List<string>(), true, this, InterferomType.Additive, Vector3.zero)))
.Span(3)
.Build();
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using UnityEngine;
namespace Ichni.RhythmGame
@@ -22,8 +23,8 @@ namespace Ichni.RhythmGame
new string[] { "EulerX", "EulerY", "EulerZ" }))
.ParameterText(nameof(PreviewValue), "value:", autoUpdate: true)
.Span(3)
.Button("Interferometer", () => Vector3Interferometer.GenerateElement("New Vector3 Interferometer",
Guid.NewGuid(), new List<string>(), true, this, InterferomType.Additive, Vector3.zero))
.Button("Interferometer", () => CommandManager.ExecuteCreate(() => Vector3Interferometer.GenerateElement("New Vector3 Interferometer",
Guid.NewGuid(), new List<string>(), true, this, InterferomType.Additive, Vector3.zero)))
.Span(3)
.Build();
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
namespace Ichni.RhythmGame
@@ -23,41 +24,41 @@ namespace Ichni.RhythmGame
var builder = InspectorBuilder.For(this)
.Section("Generate")
.Button("Environment Object", () =>
TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(),
new List<string>(), true, this))
CommandManager.ExecuteCreate(() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(),
new List<string>(), true, this)))
.Toggle(nameof(isStatic), "Is Static")
.OnChanged(() => gameObject.isStatic = isStatic)
.Preset(InspectorBuilder.TransformPreset)
.Section("Generate Animations")
.Button("Base Color Change", () =>
BaseColorChange.GenerateElement("New Base Color Change", Guid.NewGuid(), new List<string>(), true,
CommandManager.ExecuteCreate(() => BaseColorChange.GenerateElement("New Base Color Change", Guid.NewGuid(), new List<string>(), true,
this,
new FlexibleFloat(new List<AnimatedFloat> { new AnimatedFloat(0f, 0.1f, colorSubmodule.originalBaseColor.r, colorSubmodule.originalBaseColor.r, animationCurveType: AnimationCurveType.Linear) }),
new FlexibleFloat(new List<AnimatedFloat> { new AnimatedFloat(0f, 0.1f, colorSubmodule.originalBaseColor.g, colorSubmodule.originalBaseColor.g, animationCurveType: AnimationCurveType.Linear) }),
new FlexibleFloat(new List<AnimatedFloat> { new AnimatedFloat(0f, 0.1f, colorSubmodule.originalBaseColor.b, colorSubmodule.originalBaseColor.b, animationCurveType: AnimationCurveType.Linear) }),
new FlexibleFloat(new List<AnimatedFloat> { new AnimatedFloat(0f, 0.1f, colorSubmodule.originalBaseColor.a, colorSubmodule.originalBaseColor.a, animationCurveType: AnimationCurveType.Linear) })
));
)));
if (haveEmissionColor)
{
builder.Button("Emission Color Change", () =>
EmissionColorChange.GenerateElement("New Emission Color Change", Guid.NewGuid(),
CommandManager.ExecuteCreate(() => EmissionColorChange.GenerateElement("New Emission Color Change", Guid.NewGuid(),
new List<string>(), true, this,
new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat())));
}
builder
.Button("Property Animation Color", () =>
PropertyAnimationColor.GenerateElement("New Property Animation Color", Guid.NewGuid(),
CommandManager.ExecuteCreate(() => PropertyAnimationColor.GenerateElement("New Property Animation Color", Guid.NewGuid(),
new List<string>(), true, this, GetType().FullName, "",
new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()))
new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat())))
.Button("Property Animation Float", () =>
PropertyAnimationFloat.GenerateElement("New Property Animation Float", Guid.NewGuid(),
new List<string>(), true, this, GetType().FullName, "", new FlexibleFloat()))
CommandManager.ExecuteCreate(() => PropertyAnimationFloat.GenerateElement("New Property Animation Float", Guid.NewGuid(),
new List<string>(), true, this, GetType().FullName, "", new FlexibleFloat())))
.Button("Property Animation Vector3", () =>
PropertyAnimationVector3.GenerateElement("New Property Animation Vector3", Guid.NewGuid(),
CommandManager.ExecuteCreate(() => PropertyAnimationVector3.GenerateElement("New Property Animation Vector3", Guid.NewGuid(),
new List<string>(), true, this, GetType().FullName, "",
new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()))
new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat())))
.Build();
}
#endregion

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
using Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse;
using Sirenix.OdinInspector;
@@ -26,29 +27,29 @@ namespace Ichni.RhythmGame
InspectorBuilder.For(this)
.Section("Generate", sectionOrder: 10)
.Button("Folder", () => ElementFolder.GenerateElement("New Folder", Guid.NewGuid(), new List<string>(), true, this))
.Button("Track", () => Track.GenerateElement("New Track", Guid.NewGuid(), new List<string>(), true, this))
.Button("Camera", () => GameCamera.GenerateElement("New Camera", Guid.NewGuid(), new List<string>(), true, this, GameCamera.CameraViewType.Perspective, 60, 10))
.Button("Cross Track Point", () => CrossTrackPoint.GenerateElement("New Cross Track Point", Guid.NewGuid(), new List<string>(), true, this, new FlexibleInt(), new FlexibleFloat()))
.Button("Folder", () => CommandManager.ExecuteCreate(() => ElementFolder.GenerateElement("New Folder", Guid.NewGuid(), new List<string>(), true, this)))
.Button("Track", () => CommandManager.ExecuteCreate(() => Track.GenerateElement("New Track", Guid.NewGuid(), new List<string>(), true, this)))
.Button("Camera", () => CommandManager.ExecuteCreate(() => GameCamera.GenerateElement("New Camera", Guid.NewGuid(), new List<string>(), true, this, GameCamera.CameraViewType.Perspective, 60, 10)))
.Button("Cross Track Point", () => CommandManager.ExecuteCreate(() => CrossTrackPoint.GenerateElement("New Cross Track Point", Guid.NewGuid(), new List<string>(), true, this, new FlexibleInt(), new FlexibleFloat())))
.Build();
InspectorBuilder.For(this)
.Section("Generate Elements", sectionOrder: 15)
.Preset(InspectorBuilder.TransformPreset)
.Section("Generate Notes", sectionOrder: 20)
.Button("Tap", () => Tap.GenerateElement("New Tap", Guid.NewGuid(), new List<string>(), true, this, 0f))
.Button("Stay", () => Stay.GenerateElement("New Stay", Guid.NewGuid(), new List<string>(), true, this, 0f))
.Button("Hold", () => Hold.GenerateElement("New Hold", Guid.NewGuid(), new List<string>(), true, this, 0f, 1f))
.Button("Flick", () => Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), true, this, 0f, new List<Vector2>()))
.Button("Tap", () => CommandManager.ExecuteCreate(() => Tap.GenerateElement("New Tap", Guid.NewGuid(), new List<string>(), true, this, 0f)))
.Button("Stay", () => CommandManager.ExecuteCreate(() => Stay.GenerateElement("New Stay", Guid.NewGuid(), new List<string>(), true, this, 0f)))
.Button("Hold", () => CommandManager.ExecuteCreate(() => Hold.GenerateElement("New Hold", Guid.NewGuid(), new List<string>(), true, this, 0f, 1f)))
.Button("Flick", () => CommandManager.ExecuteCreate(() => Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), true, this, 0f, new List<Vector2>())))
.Section("Generate Environment", sectionOrder: 30)
.Button("Environment Object", () => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(), true, this))
.Button("Time Effects Collection", () => TimeEffectsCollection.GenerateElement("New Time Effects Collection", Guid.NewGuid(),
new List<string>(), true, this, 0))
.Button("Environment Object", () => CommandManager.ExecuteCreate(() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(), true, this)))
.Button("Time Effects Collection", () => CommandManager.ExecuteCreate(() => TimeEffectsCollection.GenerateElement("New Time Effects Collection", Guid.NewGuid(),
new List<string>(), true, this, 0)))
.Button("Particle Emitter", () =>
{
ParticleEmitter.GenerateElement("New Particle Emitter", Guid.NewGuid(), new List<string>(), true,
CommandManager.ExecuteCreate(() => ParticleEmitter.GenerateElement("New Particle Emitter", Guid.NewGuid(), new List<string>(), true,
this, "", "", false, 0, 1, ParticleSystemSimulationSpace.World,
10, 5, 1, 1, true, Vector3.zero);
10, 5, 1, 1, true, Vector3.zero));
})
.Section("Tools", sectionOrder: 40)

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
namespace Ichni.RhythmGame
@@ -25,14 +26,14 @@ namespace Ichni.RhythmGame
.Preset(InspectorBuilder.TransformPreset)
.Section("Generate")
.Button("Field of View", () =>
CameraFieldOfView.GenerateElement("New Field of View", Guid.NewGuid(),
CommandManager.ExecuteCreate(() => CameraFieldOfView.GenerateElement("New Field of View", Guid.NewGuid(),
new List<string>(), true, this, new FlexibleFloat(new List<AnimatedFloat>
{
new AnimatedFloat(0f, 1f, 60f, 60f, AnimationCurveType.Linear)
})))
}))))
.Button("Extension", () =>
GameCameraExtension.GenerateElement("New Extension", Guid.NewGuid(),
new List<string>(), true, this, 1000f))
CommandManager.ExecuteCreate(() => GameCameraExtension.GenerateElement("New Extension", Guid.NewGuid(),
new List<string>(), true, this, 1000f)))
.Build();
}
#endregion

View File

@@ -30,7 +30,7 @@ namespace Ichni.RhythmGame
.OnChanged(() => inspectorMain.SetInspector(this))
.Button("Generate", () =>
{
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(this);
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElementRaw(this);
inspectorMain.ClearInspector();
SubstantialObject.GenerateElement(elementName, elementGuid, tags, true,
themeBundleName, objectName, parentElement);

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
@@ -84,9 +85,9 @@ namespace Ichni.RhythmGame
{
if (skyboxSubsetter == null)
{
SkyboxSubsetter.GenerateElement("New Skybox Subsetter", Guid.NewGuid(),
CommandManager.ExecuteCreate(() => SkyboxSubsetter.GenerateElement("New Skybox Subsetter", Guid.NewGuid(),
new List<string>(), true, this,
new List<string>(), new List<string>(), new List<float>(), new List<float>());
new List<string>(), new List<string>(), new List<float>(), new List<float>()));
}
else
{

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
namespace Ichni.RhythmGame
@@ -75,7 +76,7 @@ namespace Ichni.RhythmGame
.Section("Note Visual")
.Button("Generate Note Visual", () =>
{
TemporaryObject.GenerateElement("New Note Visual", Guid.NewGuid(), new List<string>(), true, this);
CommandManager.ExecuteCreate(() => TemporaryObject.GenerateElement("New Note Visual", Guid.NewGuid(), new List<string>(), true, this));
})
.EnabledIf(() => noteVisual == null)
.Build();

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
namespace Ichni.RhythmGame
@@ -38,13 +39,13 @@ namespace Ichni.RhythmGame
public void GenerateBaseColorChange()
{
BaseColorChange.GenerateElement("New Base Color Change", Guid.NewGuid(), new List<string>(), true,
CommandManager.ExecuteCreate(() => BaseColorChange.GenerateElement("New Base Color Change", Guid.NewGuid(), new List<string>(), true,
this,
new FlexibleFloat(new List<AnimatedFloat> { new AnimatedFloat(0f, 0.1f, colorSubmodule.originalBaseColor.r, colorSubmodule.originalBaseColor.r, animationCurveType: AnimationCurveType.Linear) }),
new FlexibleFloat(new List<AnimatedFloat> { new AnimatedFloat(0f, 0.1f, colorSubmodule.originalBaseColor.g, colorSubmodule.originalBaseColor.g, animationCurveType: AnimationCurveType.Linear) }),
new FlexibleFloat(new List<AnimatedFloat> { new AnimatedFloat(0f, 0.1f, colorSubmodule.originalBaseColor.b, colorSubmodule.originalBaseColor.b, animationCurveType: AnimationCurveType.Linear) }),
new FlexibleFloat(new List<AnimatedFloat> { new AnimatedFloat(0f, 0.1f, colorSubmodule.originalBaseColor.a, colorSubmodule.originalBaseColor.a, animationCurveType: AnimationCurveType.Linear) })
);
));
}
#endregion

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
@@ -36,19 +37,19 @@ namespace Ichni.RhythmGame
.Toggle(nameof(MotionAngles), "Motion With Angles")
.Section("Generate")
.Button("Game Camera", () =>
GameCamera.GenerateElement("New Game Camera", Guid.NewGuid(), new List<string>(),
true, this, GameCamera.CameraViewType.Perspective, 60, 10))
CommandManager.ExecuteCreate(() => GameCamera.GenerateElement("New Game Camera", Guid.NewGuid(), new List<string>(),
true, this, GameCamera.CameraViewType.Perspective, 60, 10)))
.Button("Trail", () =>
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(),
CommandManager.ExecuteCreate(() => Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(),
true, this, 1, true, 1,
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", ""))
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", "")))
.Button("Environment Object", () =>
TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
true, this))
CommandManager.ExecuteCreate(() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
true, this)))
.Button("Generate Particle Emitter", () =>
ParticleEmitter.GenerateElement("New Particle Emitter", Guid.NewGuid(), new List<string>(), true,
CommandManager.ExecuteCreate(() => ParticleEmitter.GenerateElement("New Particle Emitter", Guid.NewGuid(), new List<string>(), true,
this, "", "", false, 0, 1, ParticleSystemSimulationSpace.World,
10, 5, 1, 1, true, Vector3.zero))
10, 5, 1, 1, true, Vector3.zero)))
.Build();
}
#endregion

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
@@ -29,16 +30,16 @@ namespace Ichni.RhythmGame
.OnChanged(() => trackPositioner.motion.rotationOffset = motionEulerAngles)
.Section("Generate")
.Button("Generate Trail", () =>
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
CommandManager.ExecuteCreate(() => Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
this, 1, true, 1,
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", ""))
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", "")))
.Button("Environment Object", () =>
TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
true, this))
CommandManager.ExecuteCreate(() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
true, this)))
.Button("Generate Particle Emitter", () =>
ParticleEmitter.GenerateElement("New Particle Emitter", Guid.NewGuid(), new List<string>(), true,
CommandManager.ExecuteCreate(() => ParticleEmitter.GenerateElement("New Particle Emitter", Guid.NewGuid(), new List<string>(), true,
this, "", "", false, 0, 1, ParticleSystemSimulationSpace.World,
10, 5, 1, 1, true, Vector3.zero))
10, 5, 1, 1, true, Vector3.zero)))
.Build();
}
#endregion

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
@@ -33,16 +34,16 @@ namespace Ichni.RhythmGame
.Toggle(nameof(MotionAngles), "Motion With Angles")
.Section("Generate")
.Button("Generate Trail", () =>
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
CommandManager.ExecuteCreate(() => Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
this, 1, true, 1,
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", ""))
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", "")))
.Button("Environment Object", () =>
TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
true, this))
CommandManager.ExecuteCreate(() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
true, this)))
.Button("Generate Particle Emitter", () =>
ParticleEmitter.GenerateElement("New Particle Emitter", Guid.NewGuid(), new List<string>(), true,
CommandManager.ExecuteCreate(() => ParticleEmitter.GenerateElement("New Particle Emitter", Guid.NewGuid(), new List<string>(), true,
this, "", "", false, 0, 1, ParticleSystemSimulationSpace.World,
10, 5, 1, 1, true, Vector3.zero))
10, 5, 1, 1, true, Vector3.zero)))
.Build();
}
#endregion

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
namespace Ichni.RhythmGame
@@ -27,7 +28,7 @@ namespace Ichni.RhythmGame
.OnChanged(ClosePath)
.Button("Generate Path Node", () =>
{
PathNode.GenerateElement("New Path Node", Guid.NewGuid(), new List<string>(), true, track, true);
CommandManager.ExecuteCreate(() => PathNode.GenerateElement("New Path Node", Guid.NewGuid(), new List<string>(), true, track, true));
})
.Toggle(nameof(isShowingDisplay), "Show Display")
.OnChanged(() => SetDisplay(isShowingDisplay))

View File

@@ -14,8 +14,10 @@ namespace Ichni.RhythmGame
/// </summary>
/// <param name="unitPositionOffset">单位位置整体偏移</param>
/// <param name="unitTimeOffset">单位时间偏移</param>
/// <param name="unitRotationOffset">单位旋转偏移(欧拉角)</param>
/// <param name="unitScaleOffset">单位缩放偏移</param>
/// <param name="iteration">迭代次数即产生几个粘贴的Track</param>
private void QuickCopy(Vector3 unitPositionOffset, float unitTimeOffset, bool includeAnimations = true, int iteration = 1, bool MovingTrack = false)
private void QuickCopy(Vector3 unitPositionOffset, float unitTimeOffset, bool includeAnimations = true, int iteration = 1, bool MovingTrack = false, Vector3 unitRotationOffset = default, Vector3 unitScaleOffset = default)
{
if (iteration <= 0) return;
@@ -23,23 +25,29 @@ namespace Ichni.RhythmGame
cpd.CopyElement(this);
for (int i = 1; i <= iteration; i++)
{
cpd.PasteElement(parentElement);
cpd.PasteElementRaw(this, parentElement);
Track newTrack = cpd.pastedElementList[0] as Track;
Vector3 positionOffset = unitPositionOffset * i;
float timeOffset = unitTimeOffset * i;
Vector3 rotationOffset = unitRotationOffset * i;
Vector3 scaleOffset = unitScaleOffset * i;
//以下对Track的所有有效的Submodule和子GameElement进行偏移 TODO: 需要思考是否有统一时间偏移的方法?
if (MovingTrack)
{
newTrack.transformSubmodule.originalPosition += positionOffset;
newTrack.transformSubmodule.originalEulerAngles += rotationOffset;
newTrack.transformSubmodule.originalScale += scaleOffset;
newTrack.transformSubmodule.Refresh();
}
else
{
//PathNode位置偏移
//PathNode位置/旋转/缩放偏移
newTrack.trackPathSubmodule.pathNodeList.ForEach(pn =>
{
pn.transformSubmodule.originalPosition += positionOffset;
pn.transformSubmodule.originalEulerAngles += rotationOffset;
pn.transformSubmodule.originalScale += scaleOffset;
pn.transformSubmodule.Refresh();
});
}
@@ -161,4 +169,4 @@ namespace Ichni.RhythmGame
trackPathSubmodule.pathNodeList.ForEach(pn => pn.SetPathNodeSphere(isShowing));
}
}
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using ichni.RhythmGame;
using Ichni.Editor;
using Ichni.Editor.Commands;
using Ichni.RhythmGame.Beatmap;
using Sirenix.OdinInspector;
using UnityEngine;
@@ -79,41 +80,45 @@ namespace Ichni.RhythmGame
.Section("Generate Elements", sectionOrder: 20)
.Button("Path Node", () =>
{
PathNode.GenerateElement("New Path Node", Guid.NewGuid(), new List<string>(), true, this, true);
CommandManager.ExecuteCreate(() => PathNode.GenerateElement("New Path Node", Guid.NewGuid(), new List<string>(), true, this, true));
})
.EnabledIf(() => trackPathSubmodule != null)
.Button("Track Percent Point", () =>
{
var a = TrackPercentPoint.GenerateElement("New Track Percent Point", Guid.NewGuid(), new List<string>(), true, this, new FlexibleFloat());
if (trackTimeSubmodule != null && trackTimeSubmodule is TrackTimeSubmoduleMovable trackTimeSubmoduleMovable)
a.trackPercent.Add(
new AnimatedFloat(trackTimeSubmoduleMovable.trackStartTime, trackTimeSubmoduleMovable.trackEndTime, 0, 1, AnimationCurveType.Linear));
CommandManager.ExecuteCreate(() =>
{
var a = TrackPercentPoint.GenerateElement("New Track Percent Point", Guid.NewGuid(), new List<string>(), true, this, new FlexibleFloat());
if (trackTimeSubmodule != null && trackTimeSubmodule is TrackTimeSubmoduleMovable trackTimeSubmoduleMovable)
a.trackPercent.Add(
new AnimatedFloat(trackTimeSubmoduleMovable.trackStartTime, trackTimeSubmoduleMovable.trackEndTime, 0, 1, AnimationCurveType.Linear));
return a;
});
})
.Button("Track Head Point", () =>
{
TrackHeadPoint.GenerateElement("New Track Head Point", Guid.NewGuid(), new List<string>(), true, this, false, Vector3.zero);
CommandManager.ExecuteCreate(() => TrackHeadPoint.GenerateElement("New Track Head Point", Guid.NewGuid(), new List<string>(), true, this, false, Vector3.zero));
})
.EnabledIf(() => trackTimeSubmodule is TrackTimeSubmoduleMovable)
.Button("Tap", () => Tap.GenerateElement("New Tap", Guid.NewGuid(), new List<string>(), true, this, 0f))
.Button("Stay", () => Stay.GenerateElement("New Stay", Guid.NewGuid(), new List<string>(), true, this, 0f))
.Button("Hold", () => Hold.GenerateElement("New Hold", Guid.NewGuid(), new List<string>(), true, this, 0f, 1f))
.Button("Flick", () => Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), true, this, 0f, new List<Vector2>()))
.Button("Tap", () => CommandManager.ExecuteCreate(() => Tap.GenerateElement("New Tap", Guid.NewGuid(), new List<string>(), true, this, 0f)))
.Button("Stay", () => CommandManager.ExecuteCreate(() => Stay.GenerateElement("New Stay", Guid.NewGuid(), new List<string>(), true, this, 0f)))
.Button("Hold", () => CommandManager.ExecuteCreate(() => Hold.GenerateElement("New Hold", Guid.NewGuid(), new List<string>(), true, this, 0f, 1f)))
.Button("Flick", () => CommandManager.ExecuteCreate(() => Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), true, this, 0f, new List<Vector2>())))
.Button("Particle Tracker", () =>
{
ParticleTracker.GenerateElement("New Particle Tracker", Guid.NewGuid(), new List<string>(), true, this,
string.Empty, string.Empty, false, 0, 1, false, 10, Vector3.right, 10, 5, true, Vector3.zero);
CommandManager.ExecuteCreate(() => ParticleTracker.GenerateElement("New Particle Tracker", Guid.NewGuid(), new List<string>(), true, this,
string.Empty, string.Empty, false, 0, 1, false, 10, Vector3.right, 10, 5, true, Vector3.zero));
})
.Button("Object Tracker", () =>
{
ObjectTracker.GenerateElement("New Object Tracker", Guid.NewGuid(), new List<string>(), true, this,
CommandManager.ExecuteCreate(() => ObjectTracker.GenerateElement("New Object Tracker", Guid.NewGuid(), new List<string>(), true, this,
string.Empty, string.Empty, 10, Vector2.zero, Vector2.zero, string.Empty,
false, Vector3.zero, Vector3.zero, string.Empty,
false, Vector3.zero, Vector3.zero, string.Empty);
false, Vector3.zero, Vector3.zero, string.Empty));
})
.Button("Track Global Color Change", () =>
{
TrackGlobalColorChange.GenerateElement("New Track Global Color Change", Guid.NewGuid(), new List<string>(), true, this,
new FlexibleFloat(true), new FlexibleFloat(true), new FlexibleFloat(true), new FlexibleFloat(true));
CommandManager.ExecuteCreate(() => TrackGlobalColorChange.GenerateElement("New Track Global Color Change", Guid.NewGuid(), new List<string>(), true, this,
new FlexibleFloat(true), new FlexibleFloat(true), new FlexibleFloat(true), new FlexibleFloat(true)));
})
.Build();
@@ -126,22 +131,44 @@ namespace Ichni.RhythmGame
{
IHaveInspection qcWindow = inspectorMain.GenerateSecondaryWindow(this, elementName + "'s Quick Copy");
var qcContainer = qcWindow.GenerateContainer();
var qcSubcontainer = qcContainer.GenerateSubcontainer(3);
var xField = qcWindow.GenerateInputField(qcSubcontainer, "X offset", "0");
var yField = qcWindow.GenerateInputField(qcSubcontainer, "Y offset", "0");
var zField = qcWindow.GenerateInputField(qcSubcontainer, "Z offset", "0");
var timeField = qcWindow.GenerateInputField(qcSubcontainer, "Time offset", "0");
var iterationField = qcWindow.GenerateInputField(qcSubcontainer, "Iteration", "0");
var includeAnimationToggle = qcWindow.GenerateToggle(null, qcSubcontainer, "Include Animation", string.Empty);
var movingTrackToggle = qcWindow.GenerateToggle(null, qcSubcontainer, "Moving Track or PathNode", string.Empty);
qcWindow.GenerateButton(this, qcSubcontainer, "Copy", () =>
// 位置偏移
var posSub = qcContainer.GenerateSubcontainer(3);
var xField = qcWindow.GenerateInputField(posSub, "X offset", "0");
var yField = qcWindow.GenerateInputField(posSub, "Y offset", "0");
var zField = qcWindow.GenerateInputField(posSub, "Z offset", "0");
// 旋转偏移(欧拉角)
var rotSub = qcContainer.GenerateSubcontainer(3);
var rotXField = qcWindow.GenerateInputField(rotSub, "Rot X", "0");
var rotYField = qcWindow.GenerateInputField(rotSub, "Rot Y", "0");
var rotZField = qcWindow.GenerateInputField(rotSub, "Rot Z", "0");
// 缩放偏移
var scaleSub = qcContainer.GenerateSubcontainer(3);
var scaleXField = qcWindow.GenerateInputField(scaleSub, "Scale X", "0");
var scaleYField = qcWindow.GenerateInputField(scaleSub, "Scale Y", "0");
var scaleZField = qcWindow.GenerateInputField(scaleSub, "Scale Z", "0");
// 时间 & 迭代
var timeSub = qcContainer.GenerateSubcontainer(3);
var timeField = qcWindow.GenerateInputField(timeSub, "Time offset", "0");
var iterationField = qcWindow.GenerateInputField(timeSub, "Iteration", "1");
// 选项 & 按钮
var toggleSub = qcContainer.GenerateSubcontainer(3);
var includeAnimationToggle = qcWindow.GenerateToggle(null, toggleSub, "Include Animation", string.Empty);
var movingTrackToggle = qcWindow.GenerateToggle(null, toggleSub, "Move Track", string.Empty);
qcWindow.GenerateButton(this, toggleSub, "Copy", () =>
{
Vector3 positionOffset = new Vector3(xField.GetValue<float>(), yField.GetValue<float>(), zField.GetValue<float>());
Vector3 rotationOffset = new Vector3(rotXField.GetValue<float>(), rotYField.GetValue<float>(), rotZField.GetValue<float>());
Vector3 scaleOffset = new Vector3(scaleXField.GetValue<float>(), scaleYField.GetValue<float>(), scaleZField.GetValue<float>());
float timeOffset = timeField.GetValue<float>();
int iteration = iterationField.GetValue<int>();
bool includeAnimation = includeAnimationToggle.toggle.isOn;
bool movingTrack = movingTrackToggle.toggle.isOn;
this.QuickCopy(positionOffset, timeOffset, includeAnimation, iteration, movingTrack);
this.QuickCopy(positionOffset, timeOffset, includeAnimation, iteration, movingTrack, rotationOffset, scaleOffset);
});
})
.Button("Whole Track Move", () =>
@@ -198,7 +225,7 @@ namespace Ichni.RhythmGame
.Span(3)
.Button("Fast Note Tracker", () =>
{
FastNoteTracker.GenerateElement("Fast Note Tracker", Guid.NewGuid(), new List<string>(), true, this);
CommandManager.ExecuteCreate(() => FastNoteTracker.GenerateElement("Fast Note Tracker", Guid.NewGuid(), new List<string>(), true, this));
})
.Span(3)
.Build();
@@ -225,7 +252,7 @@ namespace Ichni.RhythmGame
return notes;
}
[Button("Check Notes")]
public void checkNotes()
{
@@ -252,7 +279,7 @@ namespace Ichni.RhythmGame
}
}
}
[Button("Rebuild")]
public void Rebuild()
{