@@ -81,6 +81,13 @@ namespace Ichni.Editor
|
||||
public Vector2 vector2;
|
||||
public void FindTab(GameElement targetElement)
|
||||
{
|
||||
if (targetElement.connectedTab != null)
|
||||
{
|
||||
// 如果已经有Tab了,直接选中
|
||||
targetElement.connectedTab.SelectGameElement();
|
||||
getTabPos(targetElement.connectedTab);
|
||||
return;
|
||||
}
|
||||
targetElement.ScanAndAddEnableTypes();
|
||||
if (!EditorManager.instance.ExpandWhileClick)
|
||||
{
|
||||
@@ -144,11 +151,17 @@ namespace Ichni.Editor
|
||||
|
||||
yield return null;
|
||||
}
|
||||
yield return null; // 等待一帧,确保UI更新
|
||||
getTabPos(targetElement.connectedTab);
|
||||
|
||||
|
||||
}
|
||||
void getTabPos(HierarchyTab finalTab)
|
||||
{
|
||||
|
||||
HierarchyTab finalTab = targetElement.connectedTab;
|
||||
|
||||
// 修正定位算法
|
||||
yield return null; // 等待布局刷新
|
||||
|
||||
RectTransform tabRect = finalTab.GetComponent<RectTransform>();
|
||||
RectTransform containerRect = tabContainer;
|
||||
RectTransform viewportRect = scrollRect.viewport != null ? scrollRect.viewport : scrollRect.GetComponent<RectTransform>();
|
||||
@@ -170,7 +183,7 @@ namespace Ichni.Editor
|
||||
|
||||
scrollRect.verticalNormalizedPosition = normalized;
|
||||
finalTab.SelectGameElement();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,13 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!EditorManager.instance.musicPlayer.isPlaying && animationReturnType != FlexibleReturnType.MiddleInterval)
|
||||
{
|
||||
Vector3 currentPosition = new Vector3(positionX.value, positionY.value, positionZ.value);
|
||||
targetTransformSubmodule.positionOffset.Add(currentPosition);
|
||||
targetTransformSubmodule.positionDirtyMark = true;
|
||||
}
|
||||
|
||||
animationReturnType = FlexibleReturnType.MiddleInterval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Ichni.RhythmGame
|
||||
scale.animationReturnType = FlexibleReturnType.Before;
|
||||
|
||||
scale.targetTransformSubmodule = (animatedObject as IHaveTransformSubmodule).transformSubmodule;
|
||||
|
||||
|
||||
//scale.timeDurationSubmodule.SetDuration(scaleX, scaleY, scaleZ);
|
||||
|
||||
return scale;
|
||||
@@ -56,10 +56,17 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!EditorManager.instance.musicPlayer.isPlaying && animationReturnType != FlexibleReturnType.MiddleInterval)
|
||||
{
|
||||
Vector3 currentScale = new Vector3(scaleX.value, scaleY.value, scaleZ.value);
|
||||
targetTransformSubmodule.scaleOffset.Add(currentScale);
|
||||
targetTransformSubmodule.scaleDirtyMark = true;
|
||||
}
|
||||
|
||||
animationReturnType = FlexibleReturnType.MiddleInterval;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void ApplyTimeOffset(float offset)
|
||||
{
|
||||
base.ApplyTimeOffset(offset);
|
||||
@@ -73,7 +80,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Scale_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
matchedBM = new Scale_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
scaleX.ConvertToBM(), scaleY.ConvertToBM(), scaleZ.ConvertToBM());
|
||||
}
|
||||
|
||||
@@ -98,7 +105,7 @@ namespace Ichni.RhythmGame
|
||||
var graphicEditor = inspector.GenerateButton(this, subcontainer, "GraphicEditor", () =>
|
||||
{
|
||||
inspector.GenerateGraphicalFlexibleFloatWindow(this, "Scale",
|
||||
new FlexibleFloat[] { scaleX, scaleY, scaleZ },
|
||||
new FlexibleFloat[] { scaleX, scaleY, scaleZ },
|
||||
new string[] { "ScaleX", "ScaleY", "ScaleZ" });
|
||||
});
|
||||
}
|
||||
@@ -115,7 +122,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public Scale_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
public Scale_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
FlexibleFloat_BM scaleX, FlexibleFloat_BM scaleY, FlexibleFloat_BM scaleZ)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,13 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!EditorManager.instance.musicPlayer.isPlaying && animationReturnType != FlexibleReturnType.MiddleInterval)
|
||||
{
|
||||
Vector3 currentRotation = new Vector3(eulerAngleX.value, eulerAngleY.value, eulerAngleZ.value);
|
||||
targetTransformSubmodule.eulerAnglesOffset.Add(currentRotation);
|
||||
targetTransformSubmodule.eulerAnglesDirtyMark = true;
|
||||
}
|
||||
|
||||
animationReturnType = FlexibleReturnType.MiddleInterval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace Ichni.RhythmGame
|
||||
public float startValue, endValue; //起止值
|
||||
public float startTime, endTime; //起止时间
|
||||
public AnimationCurveType animationCurveType; //动画曲线类型
|
||||
|
||||
|
||||
public float differenceValue => endValue - startValue; //差值
|
||||
public float totalTime => endTime - startTime; //总时间
|
||||
|
||||
|
||||
|
||||
public AnimatedFloat(float startTime, float endTime, float startValue, float endValue,
|
||||
AnimationCurveType animationCurveType)
|
||||
@@ -26,7 +26,7 @@ namespace Ichni.RhythmGame
|
||||
this.endTime = endTime;
|
||||
this.animationCurveType = animationCurveType;
|
||||
}
|
||||
|
||||
|
||||
public void ApplyTimeOffset(float offset)
|
||||
{
|
||||
startTime += offset;
|
||||
@@ -79,8 +79,8 @@ namespace Ichni.RhythmGame
|
||||
/// <param name="歌曲时间"></param>
|
||||
public void UpdateFlexibleFloat(float nowTime)
|
||||
{
|
||||
if(isSwitchingReturnType) isSwitchingReturnType = false;
|
||||
|
||||
if (isSwitchingReturnType) isSwitchingReturnType = false;
|
||||
|
||||
AnimatedFloat nowAnimatedFloat = GetAnimatedFloat(nowTime); //获取当前时间点对应的AnimatedFloat
|
||||
if (nowAnimatedFloat != null) //如果能获取到,表明当前时间点存在动画
|
||||
{
|
||||
@@ -88,11 +88,11 @@ namespace Ichni.RhythmGame
|
||||
float nowPercent = AnimationCurveEvaluator.Evaluate(nowAnimatedFloat.animationCurveType,
|
||||
(nowTime - nowAnimatedFloat.startTime) / nowAnimatedFloat.totalTime);
|
||||
value = nowAnimatedFloat.startValue + nowPercent * nowAnimatedFloat.differenceValue; //计算value
|
||||
|
||||
|
||||
returnType = FlexibleReturnType.MiddleExecuting;
|
||||
if (lastReturnType != returnType) isSwitchingReturnType = true;
|
||||
lastReturnType = returnType;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Ichni.RhythmGame
|
||||
returnType = FlexibleReturnType.Before;
|
||||
if (lastReturnType != returnType) isSwitchingReturnType = true;
|
||||
lastReturnType = returnType;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,10 +131,10 @@ namespace Ichni.RhythmGame
|
||||
returnType = FlexibleReturnType.After;
|
||||
if (lastReturnType != returnType) isSwitchingReturnType = true;
|
||||
lastReturnType = returnType;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SetLateAnimatedFloat(nowTime); //如果当前时间点在动画之间,设置currentAnimationIndex
|
||||
if (currentAnimationIndex >= 0) //如果当前时间点在动画之间
|
||||
{
|
||||
value = animations[currentAnimationIndex].endValue;
|
||||
@@ -143,7 +143,7 @@ namespace Ichni.RhythmGame
|
||||
returnType = FlexibleReturnType.MiddleInterval;
|
||||
if (lastReturnType != returnType) isSwitchingReturnType = true;
|
||||
lastReturnType = returnType;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,15 +171,27 @@ namespace Ichni.RhythmGame
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
void SetLateAnimatedFloat(float nowTime)
|
||||
{
|
||||
for (int i = 0; i < animations.Count - 1; i++)
|
||||
{
|
||||
if (nowTime >= animations[i].startTime && nowTime <= animations[i + 1].startTime)
|
||||
{
|
||||
currentAnimationIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转换为Beatmap存档类型
|
||||
/// </summary>
|
||||
public FlexibleFloat_BM ConvertToBM()
|
||||
{
|
||||
FlexibleFloat_BM flexibleFloat_BM = new FlexibleFloat_BM();
|
||||
|
||||
|
||||
foreach (AnimatedFloat animatedFloat in animations)
|
||||
{
|
||||
flexibleFloat_BM.animatedFloatList.Add(new AnimatedFloat(animatedFloat.startTime, animatedFloat.endTime,
|
||||
|
||||
Reference in New Issue
Block a user