暂时存档
Timeline WindowAnim不止window能用
This commit is contained in:
@@ -1,18 +1,119 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.RhythmGame;
|
||||
using Sirenix.Utilities;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class Timeline : MonoBehaviour
|
||||
public partial class Timeline : MonoBehaviour
|
||||
{
|
||||
public float songTime => EditorManager.instance.songInformation.songTime;
|
||||
public float songBeat => EditorManager.instance.songInformation.songBeat;
|
||||
public float beatmapStartTime => -EditorManager.instance.songInformation.delay;
|
||||
public float timePerBeat => 60f / EditorManager.instance.songInformation.bpm;
|
||||
|
||||
|
||||
|
||||
|
||||
public GameObject timelineTabRect;
|
||||
public TimePointerModule timePointerModule;
|
||||
public MusicPlayer musicPlayer;
|
||||
|
||||
|
||||
public TMP_InputField TimeField;
|
||||
public TMP_InputField BeatField;
|
||||
|
||||
public RectTransform GetinputArea;
|
||||
public void Update()
|
||||
{
|
||||
if (musicPlayer.isPlaying) UpdateTime();
|
||||
if (RectTransformUtility.RectangleContainsScreenPoint(GetinputArea, Mouse.current.position.ReadValue()))
|
||||
{
|
||||
|
||||
DetectSetRange();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
private void DetectSetRange()
|
||||
{
|
||||
if (Mouse.current.scroll.ReadValue().y != 0)
|
||||
{
|
||||
|
||||
if (Keyboard.current.leftCtrlKey.isPressed || Keyboard.current.rightCtrlKey.isPressed)
|
||||
{
|
||||
float scrollValue = Mouse.current.scroll.ReadValue().y / 12;
|
||||
if (timePointerModule.timePointerInterval + scrollValue >= 30)
|
||||
{
|
||||
timePointerModule.timePointerInterval += scrollValue;
|
||||
timePointerModule.UpdatePointers();
|
||||
timePointerModule.SetRange(songTime);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Mouse.current.scroll.ReadValue().y >= 0)
|
||||
{
|
||||
SetTime((EditorManager.instance.songInformation.songTime + timePerBeat).ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EditorManager.instance.songInformation.songTime - timePerBeat >= 0)
|
||||
SetTime((EditorManager.instance.songInformation.songTime - timePerBeat).ToString());
|
||||
else
|
||||
SetTime("0");
|
||||
|
||||
}
|
||||
UpdateTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void UpdateTime()
|
||||
{
|
||||
TimeField.text = songTime.ToString("F2");
|
||||
BeatField.text = songBeat.ToString("F2");
|
||||
}
|
||||
|
||||
public void SetTime(string time)
|
||||
{
|
||||
musicPlayer.PauseMusic();
|
||||
musicPlayer.audioSource.time = float.Parse(time);
|
||||
EditorManager.instance.songInformation.songTime = float.Parse(time);
|
||||
|
||||
timePointerModule.UpdatePointers();
|
||||
timePointerModule.SetRange(songTime);
|
||||
|
||||
}
|
||||
public void SetBeat(string beat)
|
||||
{
|
||||
musicPlayer.PauseMusic();
|
||||
musicPlayer.audioSource.time = float.Parse(beat) * timePerBeat;
|
||||
EditorManager.instance.songInformation.songTime = float.Parse(beat) * timePerBeat;
|
||||
|
||||
timePointerModule.UpdatePointers();
|
||||
timePointerModule.SetRange(songTime);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public partial class Timeline
|
||||
{
|
||||
public TimelineTab timelineTabPrefab;
|
||||
public Dictionary<Type, TimelineTab> timelineTabList = new Dictionary<Type, TimelineTab>();
|
||||
public void SetTimeLine(GameElement element)
|
||||
{
|
||||
//在做了
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user