各种优化,movable采音器完善
This commit is contained in:
@@ -57,6 +57,7 @@ public partial class GraphicalFlexibleFloatWindow : MovableWindow
|
||||
|
||||
};
|
||||
XDeviverScale("1");
|
||||
EvEndpointChangeButton.onClick.AddListener(EvEndpointStartChange);
|
||||
}
|
||||
public void AddUnit(FlexibleFloat flexibleFloat, string Subtitle)
|
||||
{
|
||||
@@ -123,36 +124,23 @@ public partial class GraphicalFlexibleFloatWindow
|
||||
public GameObject VisibleArea;
|
||||
|
||||
|
||||
public void Removed()
|
||||
/// <summary>
|
||||
/// 移除当前连接的事件点,并更新 UI。
|
||||
/// </summary>
|
||||
public void RemoveConnectedPoint()
|
||||
{
|
||||
if (ConnectedPoint != null)
|
||||
{
|
||||
ConnectedPoint.FatherTab.remoceAnim(ConnectedPoint.animatedFloat);
|
||||
ConnectedPoint.FatherTab.eventPoints.Remove(ConnectedPoint);
|
||||
if (ConnectedPoint.LastEventPoint != null)
|
||||
{
|
||||
ConnectedPoint.LastEventPoint.NextEventPoint = ConnectedPoint.NextEventPoint;
|
||||
if (ConnectedPoint.LastEventPoint.NextEventPoint != null) ConnectedPoint.LastEventPoint.NextEventPoint.ReDraw(scalevalue);
|
||||
ConnectedPoint.LastEventPoint.ReDraw(scalevalue);
|
||||
}
|
||||
|
||||
if (ConnectedPoint.NextEventPoint != null)
|
||||
{
|
||||
ConnectedPoint.NextEventPoint.LastEventPoint = ConnectedPoint.LastEventPoint;
|
||||
if (ConnectedPoint.NextEventPoint.LastEventPoint != null) ConnectedPoint.NextEventPoint.LastEventPoint.ReDraw(scalevalue);
|
||||
}
|
||||
|
||||
//Destroy(ConnectedPoint.animatedFloat);
|
||||
// 调用 FlexibleFloatTab 的 RemoveEventPoint 方法
|
||||
ConnectedPoint.FatherTab.RemoveEventPoint(ConnectedPoint);
|
||||
|
||||
// 清空连接点并隐藏可见区域
|
||||
ConnectedPoint = null;
|
||||
VisibleArea.SetActive(false);
|
||||
|
||||
Destroy(ConnectedPoint.gameObject);
|
||||
ApplyParameters();
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeValue()
|
||||
|
||||
|
||||
{
|
||||
if (ConnectedPoint != null)
|
||||
{
|
||||
@@ -170,45 +158,75 @@ public partial class GraphicalFlexibleFloatWindow
|
||||
ConnectedPoint.ReDraw(scalevalue);
|
||||
}
|
||||
}
|
||||
public Button EvEndpointChangeButton;
|
||||
public void EvEndpointStartChange()
|
||||
{
|
||||
if (ConnectedPoint != null)
|
||||
{
|
||||
EndText.text = (ConnectedPoint.animatedFloat.startTime + 0.01).ToString();
|
||||
ChangeValue();
|
||||
EvEndpointChangeButton.GetComponent<Image>().color = new Color(1f, 0.5f, 0.5f, 1);
|
||||
ConnectedPoint.FatherTab.TabButton.onClick.RemoveAllListeners();
|
||||
ConnectedPoint.FatherTab.TabButton.onClick.AddListener(EvEndpointEndChange);
|
||||
|
||||
}
|
||||
}
|
||||
public void EvEndpointEndChange()
|
||||
{
|
||||
if (ConnectedPoint != null)
|
||||
{
|
||||
EvEndpointChangeButton.GetComponent<Image>().color = new Color(1f, 1f, 1f, 1);
|
||||
|
||||
float newendtime = ConnectedPoint.FatherTab.GetBeat();
|
||||
if (newendtime > ConnectedPoint.animatedFloat.startTime)
|
||||
{
|
||||
if (ConnectedPoint.NextEventPoint != null && newendtime > ConnectedPoint.NextEventPoint.animatedFloat.startTime)
|
||||
EndText.text = ConnectedPoint.NextEventPoint.animatedFloat.startTime.ToString();
|
||||
else EndText.text = newendtime.ToString();
|
||||
ChangeValue();
|
||||
}
|
||||
|
||||
ConnectedPoint.FatherTab.TabButton.onClick.RemoveAllListeners();
|
||||
ConnectedPoint.FatherTab.TabButton.onClick.AddListener(ConnectedPoint.FatherTab.AddEvent);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, List<AnimatedFloat>> ClipBoard = new();
|
||||
public float MinCopyTime = 0f;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Keyboard.current.deleteKey.isPressed && ConnectedPoint != null)
|
||||
{
|
||||
Removed();
|
||||
RemoveConnectedPoint();
|
||||
}
|
||||
|
||||
if (Keyboard.current.shiftKey.isPressed && Keyboard.current.vKey.wasPressedThisFrame)
|
||||
{
|
||||
Paste();
|
||||
PasteClipboard();
|
||||
}
|
||||
}
|
||||
public void Paste()
|
||||
{
|
||||
float time = unitList[0].GetBeat();
|
||||
print(time);
|
||||
FindMinStartTime();
|
||||
foreach (KeyValuePair<string, List<AnimatedFloat>> i in ClipBoard)
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame)
|
||||
{
|
||||
foreach (AnimatedFloat j in i.Value)
|
||||
foreach (var key in ClipBoard.Keys.ToList())
|
||||
{
|
||||
AnimatedFloat newone = new AnimatedFloat(j.startTime, j.endTime, j.startValue, j.endValue, j.animationCurveType)
|
||||
ClipBoard[key] = new List<AnimatedFloat>();
|
||||
}
|
||||
foreach (FlexibleFloatTab i in unitList)
|
||||
{
|
||||
foreach (EventPoint j in i.eventPoints)
|
||||
{
|
||||
startTime = j.startTime - MinCopyTime + time,
|
||||
endTime = j.endTime - MinCopyTime + time
|
||||
};
|
||||
|
||||
unitList.Find(x => x.Title == i.Key).SpawnEvent(newone);
|
||||
j.LeftSide.sizeDelta = new Vector2(15, j.EvDrawimage.rectTransform.sizeDelta.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FindMinStartTime()
|
||||
public void PasteClipboard()
|
||||
{
|
||||
MinCopyTime = float.MaxValue;
|
||||
// 获取当前时间线的节拍位置
|
||||
float time = unitList[0].GetBeat();
|
||||
float MinCopyTime = float.MaxValue;
|
||||
// 遍历剪贴板中的所有动画数据MinCopyTime = float.MaxValue;
|
||||
foreach (var list in ClipBoard.Values)
|
||||
{
|
||||
foreach (var animatedFloat in list)
|
||||
@@ -219,5 +237,30 @@ public partial class GraphicalFlexibleFloatWindow
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var key in ClipBoard.Keys)
|
||||
{
|
||||
foreach (var animatedFloat in ClipBoard[key])
|
||||
{
|
||||
// 克隆动画数据并应用时间偏移
|
||||
AnimatedFloat newFloat = EventPoint.CloneWithOffset(animatedFloat, time - MinCopyTime);
|
||||
|
||||
// 在对应的 FlexibleFloatTab 中生成事件点
|
||||
unitList.Find(x => x.Title == key).SpawnEvent(newFloat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public partial class GraphicalFlexibleFloatWindow
|
||||
{//以后显示类写这里,别在叠大粪了
|
||||
public TMP_Text ClipBoardMuM;
|
||||
public void updateClipBoardMuM()
|
||||
{
|
||||
int mum = 0;
|
||||
foreach (var key in ClipBoard.Keys)
|
||||
{
|
||||
mum += ClipBoard[key].Count();
|
||||
}
|
||||
ClipBoardMuM.text = "ClipBoard: " + mum.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user