Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-23 11:40:29 +08:00
parent 2dae60d368
commit 6d010467ae
60 changed files with 196637 additions and 17425 deletions

View File

@@ -26,6 +26,7 @@ public class EventPoint : MonoBehaviour
public FlexibleFloatTab FatherTab;
public TMP_Text ViewText;
public static bool Locked = false;
public int BeatDeviver => FatherTab.BeatDeviver;
public void Initialize(AnimatedFloat animatedFloat)
{
@@ -51,8 +52,13 @@ public class EventPoint : MonoBehaviour
}
public float value => FatherTab.scalevalue;
public void Refresh()
public void Refresh(bool changePos = false)
{
if (changePos)
{
Initialize(animatedFloat);
}
UpdateValue();
ReDraw(value);
}
@@ -138,6 +144,7 @@ public class EventPoint : MonoBehaviour
public void SelectButtonClick()//unity内当按钮按下时
{
if (Locked) return;
if (Keyboard.current.leftShiftKey.isPressed)
{
if (FatherTab.FatherWindow.ClipBoard[FatherTab.Title].Contains(animatedFloat))
@@ -190,7 +197,7 @@ public class EventPoint : MonoBehaviour
}
private void UpdateValue()
public void UpdateValue()
{
// 设置新的连接点并更新UI
FatherTab.FatherWindow.ConnectedPoint = this;
@@ -270,6 +277,7 @@ public class EventPoint : MonoBehaviour
}
}
// 添加静态方法:克隆 AnimatedFloat 并应用时间偏移
/// <summary>
/// 克隆一个 AnimatedFloat 对象,并根据偏移量调整其开始和结束时间。

View File

@@ -265,4 +265,48 @@ public class FlexibleFloatTab : MonoBehaviour
Destroy(eventPoint.gameObject);
}
}
public IEnumerator Draging()
{
EventPoint.Locked = true;
while (Keyboard.current.uKey.isPressed)
{
bool changed = false;
var point = FatherWindow.ConnectedPoint;
if (Mouse.current.leftButton.isPressed)
{
point.animatedFloat.startTime = GetBeat();
changed = true;
}
else if (Mouse.current.rightButton.isPressed)
{
point.animatedFloat.endTime = GetBeat();
changed = true;
}
if (changed)
{
// 保证时间顺序
if (point.animatedFloat.startTime >= point.animatedFloat.endTime)
{
if (Mouse.current.leftButton.isPressed)
point.animatedFloat.endTime = point.animatedFloat.startTime + 0.1f;
else
point.animatedFloat.startTime = point.animatedFloat.endTime - 0.1f;
}
// 保证不超过下一个事件点
if (point.NextEventPoint != null && point.animatedFloat.endTime > point.NextEventPoint.animatedFloat.startTime)
{
if (Mouse.current.leftButton.isPressed)
point.animatedFloat.endTime = point.NextEventPoint.animatedFloat.startTime;
else
point.animatedFloat.startTime = point.NextEventPoint.animatedFloat.startTime - 0.1f;
}
point.Initialize(point.animatedFloat);
point.UpdateValue();
}
yield return null;
}
FatherWindow.ConnectedPoint.Refresh(true);
EventPoint.Locked = false;
}
}

View File

@@ -229,13 +229,24 @@ public partial class GraphicalFlexibleFloatWindow
ConnectedPoint.animatedFloat.startValue *= -1;
ConnectedPoint.Refresh();
}
if (Keyboard.current.sKey.wasPressedThisFrame)
else if (Keyboard.current.sKey.wasPressedThisFrame)
{
float value = ConnectedPoint.animatedFloat.startValue;
ConnectedPoint.animatedFloat.startValue = ConnectedPoint.animatedFloat.endValue;
ConnectedPoint.animatedFloat.endValue = value;
ConnectedPoint.Refresh();
}
else if (Keyboard.current.uKey.wasPressedThisFrame)
{
try
{
ConnectedPoint.FatherTab.StartCoroutine(ConnectedPoint.FatherTab.Draging());
}
catch (System.Exception)
{
EventPoint.Locked = false;
}
}
}