This commit is contained in:
2025-05-30 19:37:54 +08:00
parent 82790c3d86
commit abd7cf3150
17 changed files with 779 additions and 135 deletions

View File

@@ -76,6 +76,12 @@ namespace Ichni.RhythmGame
node = new SplinePoint(position, Vector3.up, normal, size, color);
track.trackPathSubmodule.SetPathNode(this);
}
public void OnDestroy()
{
track.trackPathSubmodule.pathNodeList.Remove(this);
track.Refresh();
print("PathNode " + elementName + " destroyed.");
}
}
public partial class PathNode
@@ -98,10 +104,10 @@ namespace Ichni.RhythmGame
base.SetUpInspector();
var container = inspector.GenerateContainer("Path Node");
var pathNodeSettings = container.GenerateSubcontainer(3);
var indexText = inspector.GenerateHintText(this, pathNodeSettings, "Index: " + index);
var isShowingSphereToggle =
var isShowingSphereToggle =
inspector.GenerateToggle(this, pathNodeSettings, "Is Showing Sphere", nameof(isShowingSphere))
.AddListenerFunction(() => SetPathNodeSphere(isShowingSphere));
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Dreamteck.Splines;
using Ichni.Editor;
using Ichni.RhythmGame.Beatmap;
@@ -25,7 +26,7 @@ namespace Ichni.RhythmGame
Track.TrackSamplingType trackSamplingType, bool isClosed, bool isShowingDisplay) : base(track)
{
this.path = track.AddComponent<SplineComputer>();
this.pathNodeList = new List<PathNode>();
this.trackSpaceType = trackSpaceType;
this.trackSamplingType = trackSamplingType;
@@ -92,10 +93,6 @@ namespace Ichni.RhythmGame
public override void Refresh()
{
SetTrackSpaceType((int)trackSpaceType);
SetUpSplineComputer(trackSpaceType, trackSamplingType);

View File

@@ -116,6 +116,7 @@ namespace Ichni.RhythmGame
t.trailRenderer.emitting = emitting;
t.trailRenderer.enabled = emitting;
if (willClear) t.trailRenderer.Clear();
}
}
}

View File

@@ -51,10 +51,22 @@ public class FlexibleFloatTab : MonoBehaviour
// 创建节拍线
private void CreateBeatLines()
{
for (int i = 0; i < (int)EditorManager.instance.songInformation.song.length / FatherWindow.timePerBeat; i++)
// 先清空BeatArea下的所有子对象防止重复生成
for (int i = BeatArea.childCount - 1; i >= 0; i--)
{
Destroy(BeatArea.GetChild(i).gameObject);
}
float maxX = 1400f + (3 * BeatDeviver);
int totalBeats = (int)(EditorManager.instance.songInformation.song.length / FatherWindow.timePerBeat);
for (int i = 0; i < totalBeats; i++)
{
float posX = BeatDeviver * i;
if (posX > maxX)
{
break;
}
GameObject u = Instantiate(BeatLine, BeatArea);
u.transform.localPosition = new Vector3(BeatDeviver * i, 0, 0);
u.transform.localPosition = new Vector3(posX, 0, 0);
}
}
@@ -82,7 +94,15 @@ public class FlexibleFloatTab : MonoBehaviour
Vector3 newPosition = new Vector3(-FatherWindow.songBeat * BeatDeviver, 0, 0);
Area.localPosition = newPosition;
BeatArea.localPosition = newPosition;
XBeatArea.localPosition = newPosition;
while (true)
{
BeatArea.localPosition += new Vector3(BeatDeviver, 0, 0);
if (BeatArea.localPosition.x > ((-200f) - BeatDeviver))
{
break;
}
}
XBeatArea.localPosition = BeatArea.localPosition;
}
// 添加事件
@@ -141,7 +161,7 @@ public class FlexibleFloatTab : MonoBehaviour
public float GetBeat()
{
// 获取鼠标在 BeatArea 中的相对位置
Vector2 localMousePosition = BeatArea.InverseTransformPoint(Mouse.current.position.ReadValue());
Vector2 localMousePosition = Area.InverseTransformPoint(Mouse.current.position.ReadValue());
//Debug.Log(localMousePosition);
float mouseBeat = localMousePosition.x / BeatDeviver;

View File

@@ -19,7 +19,7 @@ namespace Ichni.Editor
EditorManager.instance.songInformation.songTime += Time.deltaTime;
return;
}
if (isPlaying)
{
EditorManager.instance.songInformation.songTime = EditorManager.instance.musicPlayer.audioSource.time;
@@ -33,7 +33,7 @@ namespace Ichni.Editor
Trail.SetAllTrails(true, false);
EditorManager.instance.songInformation.songTime = audioSource.time;
if (isPlaying) audioSource.Play();
else audioSource.Pause();
else PauseMusic();
}
public void PauseMusic()

View File

@@ -32,7 +32,6 @@ public class SampleWindow : MovableWindow//该window高度为300横的要在1
public GameObject beatLinePrefabv;
public GameObject beatLinePrefabh;
public GameObject NotePrefab;
public RectTransform secBeatLineh;//用于定位屏幕位置
float songTime => EditorManager.instance.songInformation.songTime;
float songBeat => EditorManager.instance.songInformation.songBeat;
float beatmapStartTime => -EditorManager.instance.songInformation.delay;
@@ -99,12 +98,7 @@ public class SampleWindow : MovableWindow//该window高度为300横的要在1
GameObject u = Instantiate(beatLinePrefabh, LineMovepoint);
u.transform.localPosition = new Vector3(0, i * beatDeviver, 0);
if (i == 1)
{
secBeatLineh = u.GetComponent<RectTransform>();
realDevider = secBeatLineh.position.y - LineMovepoint.position.y;
Debug.Log(realDevider);
}
if (u.transform.localPosition.y > 600)
{
Destroy(u);
@@ -177,7 +171,7 @@ public class SampleWindow : MovableWindow//该window高度为300横的要在1
TransformChanged();
windowRect.GetComponent<CanvasGroup>().alpha = track.timeDurationSubmodule.CheckTimeInDuration(songTime) ? 1f : 0.2f;
}
if (selectedGameObject == null && RectTransformUtility.RectangleContainsScreenPoint(windowRect, Mouse.current.position.ReadValue()))
if (selectedGameObject is null && RectTransformUtility.RectangleContainsScreenPoint(windowRect, Mouse.current.position.ReadValue()))
{
DetectNote();