LookAt,Offset,Effect Remove
Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,9 +138,10 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
//Editor
|
||||
|
||||
noteVisual.GetComponent<Collider>().enabled = !isFirstJudged;
|
||||
|
||||
if (noteVisual != null)
|
||||
{
|
||||
noteVisual.GetComponent<Collider>().enabled = !isFirstJudged;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user