采音器初步

This commit is contained in:
2025-05-01 22:54:56 +08:00
parent a0e1338c36
commit 6f1ed89221
23 changed files with 6562 additions and 351 deletions

View File

@@ -6,6 +6,7 @@ using Ichni.Editor;
using Ichni.RhythmGame;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Profiling;
using Object = UnityEngine.Object;
namespace Ichni.Editor
@@ -34,6 +35,13 @@ namespace Ichni.Editor
graphicalFlexibleFloatWindow.Initialize(baseElement, title, FlexibleFloats, subTitle);
return graphicalFlexibleFloatWindow;
}
public SampleWindow GenerateSampler(GameElement baseElement, string title)
{
SampleWindow sampler = Object.Instantiate(EditorManager.instance.basePrefabs.sampler, EditorManager.instance.uiManager.inspector.inspectorCanvas.GetComponent<RectTransform>())
.GetComponent<SampleWindow>();
sampler.Initialize(baseElement, title);
return sampler;
}
public DynamicUIContainer GenerateContainer(string titleText)
{
DynamicUIContainer container =

View File

@@ -1,5 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening.Core.Easing;
using Ichni;
using UnityEngine;
public static class WindowAnim
@@ -41,6 +43,18 @@ public static class WindowAnim
gameObject.transform.localScale = Vector3.zero;
}
public static IEnumerator Shake(GameObject gameObject)
{
float timer = 0f;
Vector3 origpos = gameObject.transform.position;
while (timer <= 1f)
{
float offset = 50 * AnimationCurveEvaluator.Evaluate(AnimationCurveType.OutElastic, timer / 1f);
gameObject.transform.position = origpos + new Vector3(Random.Range(-offset, offset), Random.Range(-offset, offset), 0);
timer += Time.deltaTime;
yield return null;
}
gameObject.transform.position = origpos;
}
}

View File

@@ -118,7 +118,7 @@ namespace Ichni.RhythmGame
noteVisual.effectSubmodule.effectCollection["Miss"].ForEach(e => e.UpdateEffect(exactJudgeTime));
break;
}
noteVisual.effectSubmodule.effectCollection["AfterJudge"].ForEach(e => e.UpdateEffect(exactJudgeTime));
if (EditorManager.instance.cameraManager.haveGameCamera)
@@ -150,9 +150,9 @@ namespace Ichni.RhythmGame
public override void SetUpInspector()
{
base.SetUpInspector();
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var infoContainer = inspector.GenerateContainer("Note Info");
var noteBaseSettings = infoContainer.GenerateSubcontainer(3);
var exactJudgeTimeInputField =
@@ -163,9 +163,9 @@ namespace Ichni.RhythmGame
{
EditorManager.instance.projectManager.notePrefabManager.SaveNotePrefab(this, GetNoteTypeName(this) + "_Prefab");
});
var noteScreenPositionText = inspector.GenerateHintText(this, noteBaseSettings,
var noteScreenPositionText = inspector.GenerateHintText(this, noteBaseSettings,
() => "Note Screen Position: " + noteScreenPosition);
var noteVisualContainer = inspector.GenerateContainer("Note Visual");
var noteVisualGeneration = noteVisualContainer.GenerateSubcontainer(3);
var generateNoteVisualButton = inspector.GenerateButton(this, noteVisualGeneration, "Generate Note Visual", () =>
@@ -178,6 +178,18 @@ namespace Ichni.RhythmGame
generateNoteVisualButton.button.interactable = false;
}
}
public override void OnDelete()
{
base.OnDelete();
if (parentElement != null)
{
if (EditorManager.instance.uiManager.inspector.connectedGameElement == parentElement)
{
EditorManager.instance.uiManager.timeline.SetTimeLine(parentElement);
foreach (SampleWindow i in SampleWindow.instances.Where(i => i.gameElement)) i.OnceSpawnNote();
}
}
}
}
public abstract partial class NoteBase

View File

@@ -291,9 +291,17 @@ namespace Ichni.RhythmGame
var setOnlyStartEndPathNodeSphereEnabledButton =
inspector.GenerateButton(this, pathNodeToolsSubcontainer, "Only Enable Start & End Path Node's sphere",
SetOnlyStartEndPathNodeSphereEnabled);
var Sampler = inspector.GenerateContainer("Sampler"); //cyq
var SamplerSubcontainer = Sampler.GenerateSubcontainer(1);
var SamplerButton = inspector.GenerateButton(this, SamplerSubcontainer, "Sampler", () =>
{
SampleWindow sampleWindow = inspector.GenerateSampler(this, this.elementName);
}
);
}
}
public partial class Track
{
[Button("Test GetAllNotes")]
@@ -312,7 +320,7 @@ namespace Ichni.RhythmGame
{
Debug.Log(note.GetType() + " " + note.elementName + " " + note.exactJudgeTime);
}
return notes;
}
}

View File

@@ -118,7 +118,7 @@ public class FlexibleFloatTab : MonoBehaviour
eventPoint.Initialize(new AnimatedFloat(GetBeat(),
GetBeat() + (float.Parse(FatherWindow.EventMultiplier.text) * FatherWindow.timePerBeat), 0, 0, AnimationCurveType.Linear));
eventPoints.Insert(FindInsertIndex(eventPoint.animatedFloat.startTime), eventPoint);
LinkNewEventPoint(eventPoint);
LinkNewEventPoint(eventPoint, true);
eventPoint.ReDraw(scalevalue);
eventPoint.selectButton.onClick.Invoke();
FatherWindow.ChangeValue();
@@ -142,7 +142,7 @@ public class FlexibleFloatTab : MonoBehaviour
connectFloat.Sort();
}
// 连接新事件点
private void LinkNewEventPoint(EventPoint eventPoint)
private void LinkNewEventPoint(EventPoint eventPoint, bool link = false)
{
int index = eventPoints.IndexOf(eventPoint);
if (index - 1 >= 0)
@@ -154,7 +154,7 @@ public class FlexibleFloatTab : MonoBehaviour
if (index + 1 < eventPoints.Count)
{
eventPoint.NextEventPoint = eventPoints[index + 1];
eventPoint.animatedFloat.endTime = eventPoint.NextEventPoint.animatedFloat.startTime;
if (link) eventPoint.animatedFloat.endTime = eventPoint.NextEventPoint.animatedFloat.startTime;
eventPoint.Initialize(eventPoint.animatedFloat);
eventPoint.NextEventPoint.LastEventPoint = eventPoint;
}

View File

@@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.Profiling;
using UnityEngine.Serialization;
[CreateAssetMenu(fileName = "BasePrefabsCollection", menuName = "Ichni/BasePrefabsCollection", order = 0)]
@@ -15,6 +16,7 @@ public class BasePrefabsCollection : SerializedScriptableObject
public GameObject trackDisplay;
public GameObject pathNode;
public Material defaultTrackMaterial;
public GameObject sampler;
[Title("Trail相关")] public GameObject trail;
public Material defaultTrailMaterial;
@@ -29,7 +31,7 @@ public class BasePrefabsCollection : SerializedScriptableObject
public AudioClip holdNoteLoopSound;
public AudioClip holdNoteEndSound;
public AudioClip flickNoteSound;
[Title("Note 判定UI")]
[Title("Note 判定UI")]
public GameObject fullscreenNearTimeHint;
public GameObject areaHint;
public GameObject triggerHint;