LookAt,Offset,Effect Remove
Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
@@ -6,6 +6,7 @@ using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
using NLayer;
|
||||
using UnityEngine.Events;
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class SongInformation : IBaseElement
|
||||
@@ -19,14 +20,15 @@ namespace Ichni.RhythmGame
|
||||
public float songLength;
|
||||
public float songTime;
|
||||
public float songBeat => songTime / 60 * bpm;
|
||||
|
||||
public float offset = 0f;//设定偏移
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public SongInformation(string songName, float bpm, float delay)
|
||||
public SongInformation(string songName, float bpm, float delay, float offset)
|
||||
{
|
||||
this.songName = songName;
|
||||
this.bpm = bpm;
|
||||
this.delay = delay;
|
||||
this.offset = offset;
|
||||
songLocation = Path.Combine(EditorManager.instance.projectInformation.projectPath, songName);
|
||||
if (!ES3.FileExists(songLocation))
|
||||
{
|
||||
@@ -45,6 +47,11 @@ namespace Ichni.RhythmGame
|
||||
throw new Exception("Failed to load audio: " + songLocation);
|
||||
}
|
||||
songLength = song.length;
|
||||
EditorManager.instance.uiManager.mainPage.toolBar.songInfoButton.onClick.AddListener(() =>
|
||||
{
|
||||
EditorManager.instance.uiManager.inspector.ClearInspector();
|
||||
SetUpInspector();
|
||||
});
|
||||
}
|
||||
private AudioClip LoadMP3(string filepath)//猜猜我从哪里偷的
|
||||
{
|
||||
@@ -64,13 +71,30 @@ namespace Ichni.RhythmGame
|
||||
return ac;
|
||||
}
|
||||
|
||||
|
||||
public void SaveBM()
|
||||
{
|
||||
matchedBM = new SongInformation_BM(songName, bpm, delay);
|
||||
matchedBM = new SongInformation_BM(songName, bpm, delay, offset);
|
||||
}
|
||||
|
||||
public void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var a = inspector.GenerateContainer("Song Info");
|
||||
var subsetting = a.GenerateSubcontainer(3);
|
||||
var c = inspector.GenerateInputField(this, subsetting, "Offset", nameof(offset));
|
||||
|
||||
var o = inspector.GenerateInputField(this, subsetting, "Delay", nameof(delay));
|
||||
|
||||
var p = inspector.GenerateInputField(this, subsetting, "BPM", nameof(bpm));
|
||||
UnityAction action = (() =>
|
||||
{
|
||||
Debug.Log($"Song Information Updated: {songName}, BPM: {bpm}, Delay: {delay}, Offset: {offset}");
|
||||
EditorManager.instance.uiManager.timeline.timePointerModule.Initialize(delay, bpm);
|
||||
});
|
||||
p.AddListenerFunction(action);
|
||||
o.AddListenerFunction(action);
|
||||
c.AddListenerFunction(action);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -82,22 +106,23 @@ namespace Ichni.RhythmGame
|
||||
public string songName;
|
||||
public float bpm;
|
||||
public float delay;
|
||||
|
||||
public float offset;
|
||||
public SongInformation_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SongInformation_BM(string songName, float bpm, float delay)
|
||||
public SongInformation_BM(string songName, float bpm, float delay, float offset)
|
||||
{
|
||||
this.songName = songName;
|
||||
this.bpm = bpm;
|
||||
this.delay = delay;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
EditorManager.instance.songInformation = new SongInformation(songName, bpm, delay);
|
||||
EditorManager.instance.songInformation = new SongInformation(songName, bpm, delay, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user