调bug
添加了track的一些refresh(static没做) TrackPercentPoint 在有Movable的前提下添加默认动画
This commit is contained in:
@@ -39,6 +39,17 @@ namespace Ichni.RhythmGame
|
||||
|
||||
point.isBeyond1 = trackPercent.animations.Any(animation => animation.endValue > 1); //判断是否有超过1的动画,超过1将会循环
|
||||
|
||||
|
||||
//添加默认动画
|
||||
if (point.parentElement is Track track1 && track1.submoduleList.Where(submodule => submodule is TrackTimeSubmoduleMovable).Count() == 1)
|
||||
{
|
||||
TrackTimeSubmoduleMovable trackTimeSubmoduleMovable = track1.submoduleList.Where(submodule => submodule is TrackTimeSubmoduleMovable).FirstOrDefault() as TrackTimeSubmoduleMovable;
|
||||
point.trackPercent.Add(
|
||||
new AnimatedFloat(trackTimeSubmoduleMovable.trackStartTime, trackTimeSubmoduleMovable.trackEndTime, 0, 1, AnimationCurveType.Linear)); //添加一个默认的动画
|
||||
|
||||
}
|
||||
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -86,12 +97,12 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Track Percent", nameof(trackPercent)).SetAsFlexibleFloat();
|
||||
});
|
||||
|
||||
|
||||
var generateTrailButton = inspector.GenerateButton(this, container, "Generate Trail", () =>
|
||||
{
|
||||
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(),
|
||||
true, this, 1, true,
|
||||
1, AnimationCurve.Constant(0,1, 1));
|
||||
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(),
|
||||
true, this, 1, true,
|
||||
1, AnimationCurve.Constant(0, 1, 1));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ namespace Ichni.RhythmGame
|
||||
public Track.TrackSpaceType trackSpaceType;
|
||||
public Track.TrackSamplingType trackSamplingType;
|
||||
public bool isClosed;
|
||||
|
||||
|
||||
public bool isShowingDisplay;
|
||||
|
||||
public TrackPathSubmodule(Track track, Track.TrackSpaceType trackSpaceType,
|
||||
public TrackPathSubmodule(Track track, Track.TrackSpaceType trackSpaceType,
|
||||
Track.TrackSamplingType trackSamplingType, bool isClosed, bool isShowingDisplay) : base(track)
|
||||
{
|
||||
this.path = track.AddComponent<SplineComputer>();
|
||||
|
||||
|
||||
this.track.trackPathSubmodule = this;
|
||||
this.pathNodeList = new List<PathNode>();
|
||||
this.trackSpaceType = trackSpaceType;
|
||||
@@ -33,15 +33,15 @@ namespace Ichni.RhythmGame
|
||||
this.isClosed = isClosed;
|
||||
|
||||
this.path.sampleRate = 16;
|
||||
|
||||
|
||||
SetUpSplineComputer(this.trackSpaceType, this.trackSamplingType);
|
||||
//闭合路径在PathNode生成时执行,在初始化的情况下,PathNode数量为0,不会执行闭合操作
|
||||
|
||||
|
||||
this.isShowingDisplay = isShowingDisplay;
|
||||
this.trackDisplay = UnityEngine.Object.Instantiate(EditorManager.instance.basePrefabs.trackDisplay, track.transform).GetComponent<SplineRenderer>();
|
||||
this.trackDisplay.spline = path;
|
||||
this.trackDisplay.size = 0.1f;
|
||||
|
||||
|
||||
this.SetDisplay(isShowingDisplay);
|
||||
}
|
||||
}
|
||||
@@ -77,13 +77,33 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
path.SetPoint(point.index, point.node, SplineComputer.Space.Local);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetDisplay(bool isShowing)
|
||||
{
|
||||
this.isShowingDisplay = isShowing;
|
||||
trackDisplay.gameObject.SetActive(isShowing);
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
if (trackSpaceType == Track.TrackSpaceType.Linear)
|
||||
{
|
||||
SetTrackSpaceType((int)Spline.Type.Linear);
|
||||
path.type = Spline.Type.Linear;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
SetTrackSpaceType((int)trackSpaceType);
|
||||
SetUpSplineComputer(trackSpaceType, trackSamplingType);
|
||||
}
|
||||
|
||||
foreach (var pathNode in pathNodeList)
|
||||
{
|
||||
SetPathNode(pathNode);
|
||||
}
|
||||
ClosePath();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TrackPathSubmodule
|
||||
@@ -97,22 +117,22 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Track Path");
|
||||
|
||||
|
||||
var trackSpaceDropdown =
|
||||
inspector.GenerateDropdown(this, container, "Space Type", typeof(Track.TrackSpaceType), nameof(trackSpaceType));
|
||||
|
||||
|
||||
var trackSamplingDropdown =
|
||||
inspector.GenerateDropdown(this, container, "Sampling Type", typeof(Track.TrackSamplingType), nameof(trackSamplingType));
|
||||
|
||||
var isClosedToggle =
|
||||
|
||||
var isClosedToggle =
|
||||
inspector.GenerateToggle(this, container, "Is Closed", nameof(isClosed));
|
||||
isClosedToggle.AddListenerFunction(ClosePath);
|
||||
|
||||
|
||||
var generatePathNodeButton = inspector.GenerateButton(this, container, "Generate Path Node", () =>
|
||||
{
|
||||
PathNode.GenerateElement("New Path Node", Guid.NewGuid(), new List<string>(), true, track, true);
|
||||
});
|
||||
|
||||
|
||||
var showDisplayToggle = inspector.GenerateToggle(this, container, "Show Display", nameof(isShowingDisplay));
|
||||
showDisplayToggle.AddListenerFunction(() => SetDisplay(isShowingDisplay));
|
||||
}
|
||||
@@ -126,10 +146,10 @@ namespace Ichni.RhythmGame
|
||||
public Track.TrackSamplingType trackSamplingType;
|
||||
public bool isClosed;
|
||||
public bool isShowingDisplay;
|
||||
|
||||
|
||||
public TrackPathSubmodule_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -155,6 +175,6 @@ namespace Ichni.RhythmGame
|
||||
track.trackPathSubmodule = new TrackPathSubmodule(track, trackSpaceType, trackSamplingType, isClosed, isShowingDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,20 @@ namespace Ichni.RhythmGame
|
||||
float per = AnimationCurveEvaluator.Evaluate(animationCurveType, (songTimeInTime - trackStartTime) / trackTotalTime);
|
||||
return Mathf.Clamp01(per);
|
||||
}
|
||||
public override void Refresh()
|
||||
|
||||
{
|
||||
trackTotalTime = trackEndTime - trackStartTime;
|
||||
UpdateTrackPart();
|
||||
|
||||
track.childElementList.ForEach(child =>
|
||||
{
|
||||
if (child is NoteBase note)
|
||||
{
|
||||
note.UpdateNoteInTrack();
|
||||
}
|
||||
});
|
||||
}
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackTimeSubmoduleMovable_BM(attachedGameElement, this);
|
||||
@@ -71,22 +84,22 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
|
||||
|
||||
|
||||
var container = inspector.GenerateContainer("Track Time Movable");
|
||||
var startTimeInputField =
|
||||
inspector.GenerateInputField(this, container, "Start Time", nameof(trackStartTime));
|
||||
startTimeInputField.AddListenerFunction(RefreshChildren);
|
||||
|
||||
|
||||
var endTimeInputField = inspector.GenerateInputField(this, container, "End Time", nameof(trackEndTime));
|
||||
endTimeInputField.AddListenerFunction(RefreshChildren);
|
||||
|
||||
|
||||
var visibleTimeInputField =
|
||||
inspector.GenerateInputField(this, container, "Visible Time Length", nameof(visibleTrackTimeLength));
|
||||
|
||||
|
||||
var animationCurveDropdown = inspector.GenerateDropdown(this, container, "Animation Curve",
|
||||
typeof(AnimationCurveType), nameof(animationCurveType));
|
||||
animationCurveDropdown.AddListenerFunction(RefreshChildren);
|
||||
|
||||
|
||||
var deleteButton = inspector.GenerateButton(this, container, "Delete",
|
||||
() =>
|
||||
{
|
||||
@@ -117,12 +130,12 @@ namespace Ichni.RhythmGame
|
||||
public float trackEndTime;
|
||||
public float visibleTrackTimeLength;
|
||||
public AnimationCurveType animationCurveType;
|
||||
|
||||
|
||||
public TrackTimeSubmoduleMovable_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public TrackTimeSubmoduleMovable_BM(GameElement attachedElement, TrackTimeSubmoduleMovable trackTimeSubmoduleMovable) : base(attachedElement)
|
||||
{
|
||||
trackStartTime = trackTimeSubmoduleMovable.trackStartTime;
|
||||
@@ -130,14 +143,14 @@ namespace Ichni.RhythmGame
|
||||
visibleTrackTimeLength = trackTimeSubmoduleMovable.visibleTrackTimeLength;
|
||||
animationCurveType = trackTimeSubmoduleMovable.animationCurveType;
|
||||
}
|
||||
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
Track track = attachedElement as Track;
|
||||
track.trackTimeSubmodule = new TrackTimeSubmoduleMovable(track, trackStartTime, trackEndTime, visibleTrackTimeLength, animationCurveType);
|
||||
}
|
||||
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
Track track = attached as Track;
|
||||
@@ -163,17 +176,31 @@ namespace Ichni.RhythmGame
|
||||
this.tailPercent = 1;
|
||||
//timeDurationSubmodule 根据下辖Note的时间来设置
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
if (track.trackRendererSubmodule != null)
|
||||
{
|
||||
track.trackRendererSubmodule.meshGenerator.clipFrom = tailPercent;
|
||||
track.trackRendererSubmodule.meshGenerator.clipTo = headPercent;
|
||||
}
|
||||
track.childElementList.ForEach(child =>
|
||||
{
|
||||
if (child is NoteBase note)
|
||||
{
|
||||
note.UpdateNoteInTrack();
|
||||
}
|
||||
});
|
||||
}
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackTimeSubmoduleStatic_BM(attachedGameElement, this);
|
||||
}
|
||||
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
|
||||
|
||||
|
||||
var container = inspector.GenerateContainer("Track Time Static");
|
||||
var totalTimeInputField =
|
||||
inspector.GenerateInputField(this, container, "Total Time", nameof(trackTotalTime));
|
||||
@@ -196,25 +223,25 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public float trackTotalTime;
|
||||
public AnimationCurveType animationCurveType;
|
||||
|
||||
|
||||
public TrackTimeSubmoduleStatic_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public TrackTimeSubmoduleStatic_BM(GameElement attachedElement, TrackTimeSubmoduleStatic trackTimeSubmoduleStatic) : base(attachedElement)
|
||||
{
|
||||
trackTotalTime = trackTimeSubmoduleStatic.trackTotalTime;
|
||||
animationCurveType = trackTimeSubmoduleStatic.animationCurveType;
|
||||
}
|
||||
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
Track track = attachedElement as Track;
|
||||
track.trackTimeSubmodule = new TrackTimeSubmoduleStatic(track, trackTotalTime, animationCurveType);
|
||||
}
|
||||
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
Track track = attached as Track;
|
||||
|
||||
Reference in New Issue
Block a user