各种优化,movable采音器完善
This commit is contained in:
@@ -24,6 +24,7 @@ public class EventPoint : MonoBehaviour
|
||||
public RawImage CurveCanvas;
|
||||
|
||||
public FlexibleFloatTab FatherTab;
|
||||
public TMP_Text ViewText;
|
||||
|
||||
public int BeatDeviver => FatherTab.BeatDeviver;
|
||||
public void Initialize(AnimatedFloat animatedFloat)
|
||||
@@ -122,11 +123,15 @@ public class EventPoint : MonoBehaviour
|
||||
|
||||
selectButton.transform.localPosition = EvDrawimage.transform.localPosition;
|
||||
selectButton.GetComponent<RectTransform>().sizeDelta = EvDrawimage.rectTransform.sizeDelta;
|
||||
ViewText.text = animatedFloat.startTime.ToString("0.00") + "s" + "\n" +
|
||||
animatedFloat.startValue.ToString("0.0") + "\n" + animatedFloat.endValue.ToString("0.0") + "\n" + animatedFloat.endTime.ToString("0.00") + "s" + "\n" +
|
||||
animatedFloat.animationCurveType.ToString();
|
||||
ViewText.color = new Color(1, 1, 1, EvDrawimage.rectTransform.sizeDelta.x < 100 ? 0 : 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SelectButtonClick()
|
||||
public void SelectButtonClick()//unity内:当按钮按下时
|
||||
{
|
||||
if (Keyboard.current.leftShiftKey.isPressed)
|
||||
{
|
||||
@@ -134,6 +139,7 @@ public class EventPoint : MonoBehaviour
|
||||
{
|
||||
FatherTab.FatherWindow.ClipBoard[FatherTab.Title].Remove(animatedFloat);
|
||||
LeftSide.sizeDelta = new Vector2(15, EvDrawimage.rectTransform.sizeDelta.y);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,6 +148,7 @@ public class EventPoint : MonoBehaviour
|
||||
LeftSide.sizeDelta = EvDrawimage.rectTransform.sizeDelta;
|
||||
|
||||
}
|
||||
FatherTab.FatherWindow.updateClipBoardMuM();
|
||||
}
|
||||
else UpLoad();
|
||||
}
|
||||
@@ -166,6 +173,10 @@ public class EventPoint : MonoBehaviour
|
||||
// 如果有已连接点,则重置其颜色
|
||||
if (FatherTab.FatherWindow.ConnectedPoint != null)
|
||||
{
|
||||
FatherTab.TabButton.onClick.RemoveAllListeners();
|
||||
FatherTab.TabButton.onClick.AddListener(FatherTab.AddEvent);
|
||||
FatherTab.FatherWindow.EvEndpointChangeButton.GetComponent<Image>().color = new Color(1f, 1f, 1f, 1);
|
||||
|
||||
FatherTab.FatherWindow.ConnectedPoint.EvDrawimage.color = new Color(
|
||||
FatherTab.FatherWindow.ConnectedPoint.EvDrawimage.color.r,
|
||||
0.3019607843137255f,
|
||||
@@ -193,4 +204,79 @@ public class EventPoint : MonoBehaviour
|
||||
|
||||
FatherTab.FatherWindow.animationCurveTypeDropdown.onValueChanged.AddListener(value => FatherTab.FatherWindow.ChangeValue());
|
||||
}
|
||||
|
||||
// 添加静态方法:查找插入索引
|
||||
public static int FindInsertIndex(List<EventPoint> eventPoints, float startTime)
|
||||
{
|
||||
int low = 0;
|
||||
int high = eventPoints.Count - 1;
|
||||
while (low <= high)
|
||||
{
|
||||
int mid = (low + high) / 2;
|
||||
if (eventPoints[mid].animatedFloat.startTime < startTime)
|
||||
{
|
||||
low = mid + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
high = mid - 1;
|
||||
}
|
||||
}
|
||||
return low;
|
||||
}
|
||||
|
||||
// 添加实例方法:连接事件点
|
||||
public void LinkEventPoints(List<EventPoint> eventPoints, int index)
|
||||
{
|
||||
if (index - 1 >= 0)
|
||||
{
|
||||
LastEventPoint = eventPoints[index - 1];
|
||||
LastEventPoint.NextEventPoint = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
LastEventPoint = null;
|
||||
}
|
||||
if (index == eventPoints.Count - 1)
|
||||
{
|
||||
NextEventPoint = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加实例方法:连接新事件点
|
||||
public void LinkNewEventPoint(List<EventPoint> eventPoints, bool link, float scalevalue)
|
||||
{
|
||||
int index = eventPoints.IndexOf(this);
|
||||
if (index - 1 >= 0)
|
||||
{
|
||||
LastEventPoint = eventPoints[index - 1];
|
||||
LastEventPoint.NextEventPoint = this;
|
||||
LastEventPoint.ReDraw(scalevalue);
|
||||
}
|
||||
if (index + 1 < eventPoints.Count)
|
||||
{
|
||||
NextEventPoint = eventPoints[index + 1];
|
||||
if (link) animatedFloat.endTime = NextEventPoint.animatedFloat.startTime;
|
||||
Initialize(animatedFloat);
|
||||
NextEventPoint.LastEventPoint = this;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加静态方法:克隆 AnimatedFloat 并应用时间偏移
|
||||
/// <summary>
|
||||
/// 克隆一个 AnimatedFloat 对象,并根据偏移量调整其开始和结束时间。
|
||||
/// </summary>
|
||||
/// <param name="animatedFloat">要克隆的 AnimatedFloat 对象。</param>
|
||||
/// <param name="offset">时间偏移量。</param>
|
||||
/// <returns>克隆后的 AnimatedFloat 对象。</returns>
|
||||
public static AnimatedFloat CloneWithOffset(AnimatedFloat animatedFloat, float offset)
|
||||
{
|
||||
return new AnimatedFloat(
|
||||
animatedFloat.startTime + offset,
|
||||
animatedFloat.endTime + offset,
|
||||
animatedFloat.startValue,
|
||||
animatedFloat.endValue,
|
||||
animatedFloat.animationCurveType
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user