86 lines
2.4 KiB
C#
86 lines
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using Ichni;
|
|
using Ichni.RhythmGame;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
|
|
public class FlexibleFloatTab : MonoBehaviour
|
|
{
|
|
public FlexibleFloat flexibleFloat;
|
|
|
|
public GraphicalFlexibleFloatWindow FatherWindow;
|
|
|
|
public List<EventPoint> eventPoints;
|
|
|
|
public RectTransform Area;
|
|
public RectTransform BeatArea;
|
|
|
|
public EventPoint eventPoint;
|
|
public GameObject BeatLine;
|
|
|
|
public int BeatDeviver => FatherWindow.BeatDeviver;
|
|
public void Initialize(FlexibleFloat flexibleFloat, string Title)
|
|
{
|
|
for (int i = 0; i < (int)EditorManager.instance.songInformation.song.length / FatherWindow.timePerBeat; i++)
|
|
{
|
|
GameObject u = Instantiate(BeatLine, BeatArea);
|
|
u.transform.localPosition = new Vector3(BeatDeviver * i, 0, 0);
|
|
}
|
|
for (int i = 0; i <= flexibleFloat.animations.Count - 1; i++)
|
|
{
|
|
AnimatedFloat animatedFloat = flexibleFloat.animations[i];
|
|
EventPoint eventPoint = Instantiate(this.eventPoint, Area);
|
|
eventPoint.FatherTab = this;
|
|
eventPoint.Initialize(animatedFloat);
|
|
eventPoints.Add(eventPoint);
|
|
if (i - 1 >= 0)
|
|
{
|
|
eventPoint.LastEventPoint = eventPoints[i - 1];
|
|
eventPoint.LastEventPoint.NextEventPoint = eventPoint;
|
|
}
|
|
else eventPoint.LastEventPoint = null;
|
|
if (i == flexibleFloat.animations.Count - 1) eventPoint.NextEventPoint = null;
|
|
|
|
|
|
|
|
}
|
|
Area.localPosition = new Vector3(FatherWindow.songBeat * BeatDeviver, 0, 0);
|
|
}
|
|
public void Update()
|
|
{
|
|
|
|
Area.localPosition = new Vector3(-FatherWindow.songBeat * BeatDeviver, 0, 0);
|
|
BeatArea.localPosition = Area.localPosition;
|
|
CheckForAddEvent();
|
|
}
|
|
|
|
private void CheckForAddEvent()
|
|
{
|
|
if (Keyboard.current.rKey.wasPressedThisFrame && RectTransformUtility.RectangleContainsScreenPoint(Area, Mouse.current.position.ReadValue()))
|
|
{
|
|
AddEvent();
|
|
}
|
|
}
|
|
|
|
private void AddEvent()
|
|
{
|
|
print(1);
|
|
}
|
|
|
|
|
|
|
|
public float scalevalue => FatherWindow.scalevalue;
|
|
public void CurveScale(float value)
|
|
{
|
|
foreach (EventPoint i in eventPoints)
|
|
{
|
|
i.ReDraw(value);
|
|
}
|
|
}
|
|
|
|
}
|