LookAt,Offset,Effect Remove

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-13 11:55:44 +08:00
parent 46766a39e0
commit c4c1c05ed6
46 changed files with 16260 additions and 17707 deletions

View File

@@ -32,6 +32,9 @@ namespace Ichni.Editor
Scale.GenerateElement("New Scale", Guid.NewGuid(), new List<string>(), true, gameElement,
new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat());
}); //缩放
var LookAtButton = inspector.GenerateButton(gameElement, animationSubcontainer, "Look At",
() => LookAt.GenerateElement("New Look At", Guid.NewGuid(),
new List<string>(), true, gameElement, null, new FlexibleBool()));
}
public static void GenerateForLoading()
{

View File

@@ -94,7 +94,7 @@ namespace Ichni.Editor
public void SetTime(string time)
{
EditorManager.instance.musicPlayer.PauseMusic();
EditorManager.instance.musicPlayer.audioSource.time = float.Parse(time);
EditorManager.instance.musicPlayer.audioSource.time = Mathf.Clamp(float.Parse(time) - EditorManager.instance.songInformation.offset, 0, EditorManager.instance.songInformation.songLength);
EditorManager.instance.songInformation.songTime = float.Parse(time);
timePointerModule.UpdatePointers();
@@ -104,7 +104,7 @@ namespace Ichni.Editor
public void SetBeat(string beat)
{
EditorManager.instance.musicPlayer.PauseMusic();
EditorManager.instance.musicPlayer.audioSource.time = float.Parse(beat) * timePerBeat;
EditorManager.instance.musicPlayer.audioSource.time = Mathf.Clamp((float.Parse(beat) * timePerBeat) - EditorManager.instance.songInformation.offset, 0, EditorManager.instance.songInformation.songLength);
EditorManager.instance.songInformation.songTime = float.Parse(beat) * timePerBeat;
timePointerModule.UpdatePointers();

View File

@@ -15,7 +15,7 @@ namespace Ichni.RhythmGame
/// </summary>
public partial class LookAt : AnimationBase
{
public GameElement targetGameElement;
public TransformSubmodule targetTransformSubmodule;
public GameElement lookAtObject;
public FlexibleBool enabling;
@@ -33,9 +33,9 @@ namespace Ichni.RhythmGame
look.enabling = enabling;
look.animationReturnType = FlexibleReturnType.Before;
look.targetGameElement = lookAtTarget;
look.targetTransformSubmodule = (animatedObject as IHaveTransformSubmodule).transformSubmodule;
//look.timeDurationSubmodule.SetDuration(-999f, 999f); //TODO: 换为(-delay, songLength)
@@ -49,8 +49,9 @@ namespace Ichni.RhythmGame
protected override void UpdateAnimation(float songTime)
{
if (lookAtObject is null) return;
enabling.UpdateFlexibleBool(songTime);
if (enabling.value)
{
animationReturnType = FlexibleReturnType.MiddleExecuting;
@@ -58,13 +59,17 @@ namespace Ichni.RhythmGame
Vector3 eulerAnglesOffset = Quaternion.LookRotation(lookingDirection).eulerAngles;
targetTransformSubmodule.eulerAnglesOffsetLock = true;
targetTransformSubmodule.currentEulerAngles = eulerAnglesOffset;
targetTransformSubmodule.eulerAnglesOffset.Add(eulerAnglesOffset);
targetTransformSubmodule.eulerAnglesDirtyMark = true;
// targetTransformSubmodule.eulerAnglesOffsetLock = true;
// targetTransformSubmodule.currentEulerAngles = eulerAnglesOffset;
}
else
{
if (animationReturnType != FlexibleReturnType.MiddleInterval) targetTransformSubmodule.eulerAnglesOffset.Add(Vector3.zero);
targetTransformSubmodule.eulerAnglesDirtyMark = true;
animationReturnType = FlexibleReturnType.MiddleInterval;
targetTransformSubmodule.eulerAnglesOffsetLock = false;
// targetTransformSubmodule.eulerAnglesOffsetLock = false;
}
}
@@ -73,7 +78,7 @@ namespace Ichni.RhythmGame
matchedBM = new LookAt_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
enabling.ConvertToBM(), lookAtObject.elementGuid);
}
public override void ApplyTimeOffset(float offset)
{
base.ApplyTimeOffset(offset);
@@ -87,35 +92,35 @@ namespace Ichni.RhythmGame
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Enable Control");
var effectSettings = container.GenerateSubcontainer(3);
var connectedGameElementInputField = inspector.GenerateInputField(effectSettings, "Game Element Name");
var effectSettings = container.GenerateSubcontainer(2);
var connectedGameElementInputField = inspector.GenerateInputField(effectSettings, "Try Get Element");
var connectGameElementButton = inspector.GenerateButton(this, effectSettings, "Connect Game Element", () =>
{
GameElement targetElement = EditorManager.instance.beatmapContainer.gameElementList
.First(e => e.elementName == connectedGameElementInputField.GetValue<string>());
if (targetElement == null)
{
LogWindow.Log("Game Element not found.", Color.red);
LogWindow.Log("Game Element not found.", Color.yellow);
}
targetGameElement = targetElement;
targetTransformSubmodule = (targetElement as IHaveTransformSubmodule).transformSubmodule;
lookAtObject = targetElement;
//targetTransformSubmodule = (targetElement as IHaveTransformSubmodule).transformSubmodule;
inspectorMain.SetInspector(this);
});
string ShowConnection() => targetGameElement == null ? "No Game Element Connected" : "Connected With: " + targetGameElement.elementName;
string ShowConnection() => lookAtObject == null ? "No Game Element Connected" : "Connected With: " + lookAtObject.elementName;
var connectHintText = inspector.GenerateHintText(this, effectSettings, ShowConnection);
var enablingButton = inspector.GenerateButton(this, effectSettings, "Enabling", () =>
{
inspector.GenerateCompositeParameterWindow(this, "Enabling", nameof(enabling)).SetAsFlexibleBool();
});
}
}
namespace Beatmap
{
public class LookAt_BM : GameElement_BM
@@ -134,16 +139,16 @@ namespace Ichni.RhythmGame
this.enabling = enabling;
this.lookAtObjectGuid = lookAtObjectGuid;
}
public override void ExecuteBM()
{
matchedElement = LookAt.GenerateElement(elementName, elementGuid, tags, false,
GetElement(attachedElementGuid), GetElement(lookAtObjectGuid), enabling.ConvertToGameType());
}
public override GameElement DuplicateBM(GameElement parent)
{
return LookAt.GenerateElement(elementName, Guid.NewGuid(), tags, false, parent,
return LookAt.GenerateElement(elementName, Guid.NewGuid(), tags, false, parent,
GetElement(lookAtObjectGuid), enabling.ConvertToGameType());
}
}

View File

@@ -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);
}
}
}

View File

@@ -77,6 +77,7 @@ namespace Ichni.RhythmGame
var extensionButton = inspector.GenerateButton(this, generateAnimation, "Extension",
() => GameCameraExtension.GenerateElement("New Extension", Guid.NewGuid(),
new List<string>(), true, this, 1000f));
}
}

View File

@@ -90,7 +90,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new CameraOffsetEffect(duration, offsetValue, offsetCurve);
return new CameraOffsetEffect(duration, offsetValue, offsetCurve)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -85,7 +85,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new CameraShakeEffect(duration, frequency, amplitudeX, amplitudeY, amplitudeZ);
return new CameraShakeEffect(duration, frequency, amplitudeX, amplitudeY, amplitudeZ)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -104,7 +104,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new CameraTiltEffect(duration, tiltValue, tiltCurve);
return new CameraTiltEffect(duration, tiltValue, tiltCurve)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -42,7 +42,7 @@ namespace Ichni.RhythmGame
public override void SetUpInspector()
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Camera Shake");
var container = inspector.GenerateContainer("Camera Zoom");
var effectSettings = container.GenerateSubcontainer(3);
var zoomDurationInputField = inspector.GenerateInputField(this, effectSettings, "Zoom Duration", nameof(duration));
var relativeZoomInputField = inspector.GenerateInputField(this, effectSettings, "Relative Zoom", nameof(relativeZoom));
@@ -77,7 +77,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new CameraZoomEffect(duration, relativeZoom, zoomCurve);
return new CameraZoomEffect(duration, relativeZoom, zoomCurve)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -77,7 +77,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new ChromaticAberrationEffect(duration, peak, intensityCurve);
return new ChromaticAberrationEffect(duration, peak, intensityCurve)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -121,7 +121,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new EnableControlEffect(GameElement_BM.GetElement(connectedGameElementGuid), connectedVariableName,
enableValue, useExpression, expression);
enableValue, useExpression, expression)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -78,7 +78,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new HighPassFilterEffect(duration, peak, intensityCurve);
return new HighPassFilterEffect(duration, peak, intensityCurve)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -78,7 +78,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new LowPassFilterEffect(duration, bottom, intensityCurve);
return new LowPassFilterEffect(duration, bottom, intensityCurve)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -82,7 +82,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new SetIntegerEffect(targetVariableName, targetValue, isRandom, minValue, maxValue);
return new SetIntegerEffect(targetVariableName, targetValue, isRandom, minValue, maxValue)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -94,7 +94,10 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new VignetteEffect(duration, peak, smoothness, color, intensityCurve);
return new VignetteEffect(duration, peak, smoothness, color, intensityCurve)
{
attachedGameElement = attachedGameElement
};
}
}
}

View File

@@ -138,9 +138,10 @@ namespace Ichni.RhythmGame
}
}
//Editor
noteVisual.GetComponent<Collider>().enabled = !isFirstJudged;
if (noteVisual != null)
{
noteVisual.GetComponent<Collider>().enabled = !isFirstJudged;
}
}

View File

@@ -23,7 +23,7 @@ namespace Ichni.Editor
if (isPlaying)
{
EditorManager.instance.songInformation.songTime = EditorManager.instance.musicPlayer.audioSource.time;
EditorManager.instance.songInformation.songTime = EditorManager.instance.musicPlayer.audioSource.time - EditorManager.instance.songInformation.offset;
}
}
@@ -32,7 +32,7 @@ namespace Ichni.Editor
isPlaying = !isPlaying;
EditorManager.instance.songInformation.songTime = audioSource.time;
EditorManager.instance.songInformation.songTime = audioSource.time - EditorManager.instance.songInformation.offset;
if (isPlaying)
{
Trail.FreezeAllTrails(!isPlaying);
@@ -42,17 +42,17 @@ namespace Ichni.Editor
}
public IEnumerator PlayBackMusic()
{
float startt = audioSource.time;
float startt = audioSource.time - EditorManager.instance.songInformation.offset;
PlayMusic();
yield return new WaitUntil(() => Keyboard.current.rightAltKey.wasReleasedThisFrame);
audioSource.time = startt;
audioSource.time = startt + EditorManager.instance.songInformation.offset;
PauseMusic();
}
public void PauseMusic()
{
isPlaying = false;
EditorManager.instance.songInformation.songTime = audioSource.time;
EditorManager.instance.songInformation.songTime = audioSource.time - EditorManager.instance.songInformation.offset;
audioSource.Pause();
Trail.FreezeAllTrails(!isPlaying);
}

View File

@@ -20,14 +20,14 @@ namespace Ichni.StartMenu
public TMP_InputField projectNameInputField, creatorNameInputField, bpmInputField, songLocationInputField, delayInputField;
public Button selectSongButton, autoFillSongPathButton;
public Button createEmptyProjectButton;
private OpenFileName songFile;
public string songName;
public ThemeBundleSelector themeBundleSelector;
public AsyncOperation loadEditor;
private void Start()
{
loadEditor = SceneManager.LoadSceneAsync("EditorScene");
@@ -51,7 +51,7 @@ namespace Ichni.StartMenu
{
Directory.CreateDirectory(projectPath);
}
InformationTransistor.instance.projectInfo_BM = new ProjectInformation_BM(
projectNameInputField.text,
creatorNameInputField.text,
@@ -59,17 +59,19 @@ namespace Ichni.StartMenu
DateTime.Now.ToString(CultureInfo.CurrentCulture),
DateTime.Now.ToString(CultureInfo.CurrentCulture),
themeBundleSelector.GetSelectedThemeBundleList());
File.Copy(songLocationInputField.text,
File.Copy(songLocationInputField.text,
Application.streamingAssetsPath + "/Projects/" +
projectNameInputField.text + "/" + songName, true);
InformationTransistor.instance.songInfo_BM = new SongInformation_BM(
songName, float.Parse(bpmInputField.text),
float.Parse(delayInputField.text));
float.Parse(delayInputField.text),
0
);
InformationTransistor.instance.isLoadedProject = false;
//Load ThemeBundles, then go to EditorScene
ThemeBundleManager.instance.LoadThemeBundles(InformationTransistor.instance.projectInfo_BM.selectedThemeBundleList);
ThemeBundleManager.instance.waitingBundleAmount
@@ -89,7 +91,7 @@ namespace Ichni.StartMenu
{
fadeIn = DOTween.Sequence();
fadeOut = DOTween.Sequence();
fadeIn.Join(canvasGroup.DOFade(1f, 0.5f))
.SetEase(Ease.InOutQuad)
.SetAutoKill(false)
@@ -121,7 +123,7 @@ namespace Ichni.StartMenu
string forward = Application.streamingAssetsPath + "/Songs/";
songName = str.Replace(forward, "");
});
selectSongButton.onClick.AddListener(SelectSong);
autoFillSongPathButton.onClick.AddListener(AutoFillSongPath);
createEmptyProjectButton.onClick.AddListener(CreateEmptyProject);
@@ -132,7 +134,7 @@ namespace Ichni.StartMenu
string path = Application.streamingAssetsPath + "/Songs/";
songLocationInputField.text = path;
}
private void SelectSong()
{
songFile = new OpenFileName();
@@ -153,7 +155,7 @@ namespace Ichni.StartMenu
}
}
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class OpenFileName
{
@@ -190,7 +192,7 @@ namespace Ichni.StartMenu
{
return GetOpenFileName(ofn);
}
[DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)]
public static extern bool GetSaveFileName([In, Out] OpenFileName ofn);
public static bool GetSFN([In, Out] OpenFileName ofn)