移除Feel,自定义动画参数实装
This commit is contained in:
@@ -125,7 +125,7 @@ namespace Ichni.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("未聚焦输入框");
|
||||
//Debug.Log("未聚焦输入框");
|
||||
}
|
||||
}
|
||||
private void UIscale()
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using Ichni;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame;
|
||||
using MoreMountains.Tools;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -15,9 +15,25 @@ namespace Ichni.RhythmGame.Beatmap
|
||||
|
||||
}
|
||||
|
||||
public PropertyAnimationColor_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
string componentName, string propertyName,
|
||||
FlexibleFloat_BM propertyValueR, FlexibleFloat_BM propertyValueG, FlexibleFloat_BM propertyValueB, FlexibleFloat_BM propertyValueA)
|
||||
{
|
||||
this.elementName = elementName;
|
||||
this.elementGuid = elementGuid;
|
||||
this.tags = tags;
|
||||
this.attachedElementGuid = attachedElement != null ? attachedElement.elementGuid : Guid.Empty;
|
||||
this.componentName = componentName;
|
||||
this.propertyName = propertyName;
|
||||
this.propertyValueR = propertyValueR;
|
||||
this.propertyValueG = propertyValueG;
|
||||
this.propertyValueB = propertyValueB;
|
||||
this.propertyValueA = propertyValueA;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = PropertyAnimationColor.GenerateElement(elementName, elementGuid, tags, true,
|
||||
matchedElement = PropertyAnimationColor.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), componentName, propertyName,
|
||||
propertyValueR?.ConvertToGameType(), propertyValueG?.ConvertToGameType(),
|
||||
propertyValueB?.ConvertToGameType(), propertyValueA?.ConvertToGameType());
|
||||
@@ -25,7 +41,7 @@ namespace Ichni.RhythmGame.Beatmap
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return PropertyAnimationColor.GenerateElement(elementName, Guid.NewGuid(), tags, false,
|
||||
return PropertyAnimationColor.GenerateElement(elementName, Guid.NewGuid(), tags, true,
|
||||
parent, componentName, propertyName,
|
||||
propertyValueR?.ConvertToGameType(), propertyValueG?.ConvertToGameType(),
|
||||
propertyValueB?.ConvertToGameType(), propertyValueA?.ConvertToGameType());
|
||||
|
||||
@@ -15,15 +15,27 @@ namespace Ichni.RhythmGame.Beatmap
|
||||
|
||||
}
|
||||
|
||||
public PropertyAnimationFloat_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
string componentName, string propertyName, FlexibleFloat_BM propertyValue)
|
||||
{
|
||||
this.elementName = elementName;
|
||||
this.elementGuid = elementGuid;
|
||||
this.tags = tags;
|
||||
this.attachedElementGuid = attachedElement != null ? attachedElement.elementGuid : Guid.Empty;
|
||||
this.componentName = componentName;
|
||||
this.propertyName = propertyName;
|
||||
this.propertyValue = propertyValue;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = PropertyAnimationFloat.GenerateElement(elementName, elementGuid, tags, true,
|
||||
matchedElement = PropertyAnimationFloat.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), componentName, propertyName, propertyValue?.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return PropertyAnimationFloat.GenerateElement(elementName, Guid.NewGuid(), tags, false,
|
||||
return PropertyAnimationFloat.GenerateElement(elementName, Guid.NewGuid(), tags, true,
|
||||
parent, componentName, propertyName, propertyValue?.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,16 +15,31 @@ namespace Ichni.RhythmGame.Beatmap
|
||||
|
||||
}
|
||||
|
||||
public PropertyAnimationVector3_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
string componentName, string propertyName,
|
||||
FlexibleFloat_BM propertyValueX, FlexibleFloat_BM propertyValueY, FlexibleFloat_BM propertyValueZ)
|
||||
{
|
||||
this.elementName = elementName;
|
||||
this.elementGuid = elementGuid;
|
||||
this.tags = tags;
|
||||
this.attachedElementGuid = attachedElement != null ? attachedElement.elementGuid : Guid.Empty;
|
||||
this.componentName = componentName;
|
||||
this.propertyName = propertyName;
|
||||
this.propertyValueX = propertyValueX;
|
||||
this.propertyValueY = propertyValueY;
|
||||
this.propertyValueZ = propertyValueZ;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = PropertyAnimationVector3.GenerateElement(elementName, elementGuid, tags, true,
|
||||
matchedElement = PropertyAnimationVector3.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), componentName, propertyName,
|
||||
propertyValueX?.ConvertToGameType(), propertyValueY?.ConvertToGameType(), propertyValueZ?.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return PropertyAnimationVector3.GenerateElement(elementName, Guid.NewGuid(), tags, false,
|
||||
return PropertyAnimationVector3.GenerateElement(elementName, Guid.NewGuid(), tags, true,
|
||||
parent, componentName, propertyName,
|
||||
propertyValueX?.ConvertToGameType(), propertyValueY?.ConvertToGameType(), propertyValueZ?.ConvertToGameType());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 511c628fb5d1e36429fdd1716dda0a68
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,51 @@
|
||||
using Ichni.Editor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class PropertyAnimationColor
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.PropertyAnimationColor_BM(elementName, elementGuid, tags,
|
||||
animatedObject.matchedBM as Beatmap.GameElement_BM, componentName, propertyName,
|
||||
propertyValueR?.ConvertToBM(), propertyValueG?.ConvertToBM(),
|
||||
propertyValueB?.ConvertToBM(), propertyValueA?.ConvertToBM());
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
base.SetUpInspector();
|
||||
|
||||
var container = inspector.GenerateContainer("Property Animation Color");
|
||||
var settings = container.GenerateSubcontainer(3);
|
||||
|
||||
inspector.GenerateInputField(this, settings, "Component Name", nameof(componentName));
|
||||
inspector.GenerateInputField(this, settings, "Property Name", nameof(propertyName));
|
||||
|
||||
var graphicEditor = inspector.GenerateButton(this, settings, "GraphicEditor", () =>
|
||||
{
|
||||
inspector.GenerateGraphicalFlexibleFloatWindow(this, "Property Color",
|
||||
new FlexibleFloat[] { propertyValueR, propertyValueG, propertyValueB, propertyValueA }, new string[] { "R", "G", "B", "A" });
|
||||
});
|
||||
|
||||
var colorRButton = inspector.GenerateButton(this, settings, "Color R", () =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Color R", nameof(propertyValueR)).SetAsFlexibleFloat();
|
||||
});
|
||||
var colorGButton = inspector.GenerateButton(this, settings, "Color G", () =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Color G", nameof(propertyValueG)).SetAsFlexibleFloat();
|
||||
});
|
||||
var colorBButton = inspector.GenerateButton(this, settings, "Color B", () =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Color B", nameof(propertyValueB)).SetAsFlexibleFloat();
|
||||
});
|
||||
var colorAButton = inspector.GenerateButton(this, settings, "Color A", () =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Color A", nameof(propertyValueA)).SetAsFlexibleFloat();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 347fe83b8c1550849a67f97f1e8d5e88
|
||||
@@ -0,0 +1,38 @@
|
||||
using Ichni.Editor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class PropertyAnimationFloat
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.PropertyAnimationFloat_BM(elementName, elementGuid, tags,
|
||||
animatedObject.matchedBM as Beatmap.GameElement_BM, componentName, propertyName,
|
||||
propertyValue?.ConvertToBM());
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
base.SetUpInspector();
|
||||
|
||||
var container = inspector.GenerateContainer("Property Animation Float");
|
||||
var settings = container.GenerateSubcontainer(3);
|
||||
|
||||
inspector.GenerateInputField(this, settings, "Component Name", nameof(componentName));
|
||||
inspector.GenerateInputField(this, settings, "Property Name", nameof(propertyName));
|
||||
|
||||
var graphicEditor = inspector.GenerateButton(this, settings, "GraphicEditor", () =>
|
||||
{
|
||||
inspector.GenerateGraphicalFlexibleFloatWindow(this, "Property Float",
|
||||
new FlexibleFloat[] { propertyValue }, new string[] { "Value" });
|
||||
});
|
||||
|
||||
var floatButton = inspector.GenerateButton(this, settings, "Float Value", () =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Float Value", nameof(propertyValue)).SetAsFlexibleFloat();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6f4212005b83d04db8c961e5ce3ad47
|
||||
@@ -0,0 +1,46 @@
|
||||
using Ichni.Editor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class PropertyAnimationVector3
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.PropertyAnimationVector3_BM(elementName, elementGuid, tags,
|
||||
animatedObject.matchedBM as Beatmap.GameElement_BM, componentName, propertyName,
|
||||
propertyValueX?.ConvertToBM(), propertyValueY?.ConvertToBM(), propertyValueZ?.ConvertToBM());
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
base.SetUpInspector();
|
||||
|
||||
var container = inspector.GenerateContainer("Property Animation Vector3");
|
||||
var settings = container.GenerateSubcontainer(3);
|
||||
|
||||
inspector.GenerateInputField(this, settings, "Component Name", nameof(componentName));
|
||||
inspector.GenerateInputField(this, settings, "Property Name", nameof(propertyName));
|
||||
|
||||
var graphicEditor = inspector.GenerateButton(this, settings, "GraphicEditor", () =>
|
||||
{
|
||||
inspector.GenerateGraphicalFlexibleFloatWindow(this, "Property Vector3",
|
||||
new FlexibleFloat[] { propertyValueX, propertyValueY, propertyValueZ }, new string[] { "X", "Y", "Z" });
|
||||
});
|
||||
|
||||
var xButton = inspector.GenerateButton(this, settings, "Vector X", () =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Vector X", nameof(propertyValueX)).SetAsFlexibleFloat();
|
||||
});
|
||||
var yButton = inspector.GenerateButton(this, settings, "Vector Y", () =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Vector Y", nameof(propertyValueY)).SetAsFlexibleFloat();
|
||||
});
|
||||
var zButton = inspector.GenerateButton(this, settings, "Vector Z", () =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Vector Z", nameof(propertyValueZ)).SetAsFlexibleFloat();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cd6fdb2873ded84bbe56750d761f423
|
||||
@@ -47,6 +47,18 @@ namespace Ichni.RhythmGame
|
||||
this, new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
}
|
||||
|
||||
var generatePropertyAnimationColor = inspector.GenerateButton(this, generateAnimation, "Property Animation Color",
|
||||
() => PropertyAnimationColor.GenerateElement("New Property Animation Color", Guid.NewGuid(), new List<string>(), true,
|
||||
this, "", "", new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
|
||||
var generatePropertyAnimationFloat = inspector.GenerateButton(this, generateAnimation, "Property Animation Float",
|
||||
() => PropertyAnimationFloat.GenerateElement("New Property Animation Float", Guid.NewGuid(), new List<string>(), true,
|
||||
this, "", "", new FlexibleFloat()));
|
||||
|
||||
var generatePropertyAnimationVector3 = inspector.GenerateButton(this, generateAnimation, "Property Animation Vector3",
|
||||
() => PropertyAnimationVector3.GenerateElement("New Property Animation Vector3", Guid.NewGuid(), new List<string>(), true,
|
||||
this, "", "", new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -89,9 +89,16 @@ namespace Ichni.RhythmGame
|
||||
floatSetterDelegate = (Action<float>)Delegate.CreateDelegate(typeof(Action<float>), targetComponent, setMethod);
|
||||
return; // 建立快速委托成功!
|
||||
}
|
||||
catch { /* 回落 */ }
|
||||
catch
|
||||
{
|
||||
Debug.LogWarning($"[PropertyAnimationFloat] Failed to create delegate for Property '{propertyName}' on '{componentName}'. Falling back to reflection SetValue.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"[PropertyAnimationFloat] Cannot find target Property '{propertyName}' strictly on '{componentName}'. Trying Field fallback.");
|
||||
}
|
||||
|
||||
// 2. 尝试寻找 Field (直接包含公有/私有)
|
||||
targetField = type.GetField(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
@@ -99,6 +106,10 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
Debug.LogWarning($"[PropertyAnimationFloat] Cannot find target Property or Field '{propertyName}' strictly on '{componentName}'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[PropertyAnimationFloat] Successfully bound to '{propertyName}' on '{componentName}' using {(targetProperty != null ? "Property" : "Field")}.");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -123,6 +134,8 @@ namespace Ichni.RhythmGame
|
||||
targetField.SetValue(targetComponent, value);
|
||||
}
|
||||
|
||||
Debug.Log($"[PropertyAnimationFloat] Set '{propertyName}' to {value} on '{componentName}' at song time {songTime}.");
|
||||
|
||||
if (animatedObject is IHaveDirtyMarkSubmodule dirtyTarget)
|
||||
{
|
||||
dirtyTarget.dirtyMarkSubmodule.MarkDirty(propertyName);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
if (HaveSameSubmodule)
|
||||
{
|
||||
Debug.LogAssertion($"存在重复的Submodule: {GetType()},此操作无效");
|
||||
Debug.LogAssertion($"存在重复的Submodule: {GetType()},此操作无效,物体:{attachedGameElement.elementGuid}");
|
||||
LogWindow.Log($"There are repeated submodule {GetType()} on Game Element {attachedGameElement.elementName}", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,19 @@ namespace Ichni.RhythmGame
|
||||
public override void SetDefaultSubmodules()
|
||||
{
|
||||
base.SetDefaultSubmodules();
|
||||
dirtyMarkSubmodule = new DirtyMarkSubmodule(this);
|
||||
if (dirtyMarkSubmodule == null)
|
||||
{
|
||||
dirtyMarkSubmodule = new DirtyMarkSubmodule(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
if (dirtyMarkSubmodule == null)
|
||||
{
|
||||
dirtyMarkSubmodule = new DirtyMarkSubmodule(this);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using DG.Tweening;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
|
||||
@@ -2,9 +2,6 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -17,6 +14,8 @@ namespace Ichni.RhythmGame
|
||||
public float amplitudeX;
|
||||
public float amplitudeY;
|
||||
public float amplitudeZ;
|
||||
|
||||
private Transform _cameraTransform;
|
||||
#endregion
|
||||
|
||||
#region [生成与初始化] Generation & Initialization
|
||||
@@ -44,16 +43,39 @@ namespace Ichni.RhythmGame
|
||||
#endregion
|
||||
|
||||
#region [处理与更新] Update & Processing
|
||||
public override void Adjust()
|
||||
public override void PreExecute()
|
||||
{
|
||||
MMF_Player effect = LeanPool.Spawn(EditorManager.instance.basePrefabs.cameraShakeEffect).GetComponent<MMF_Player>();
|
||||
effect.GetFeedbackOfType<MMF_CameraShake>().CameraShakeProperties.Duration = duration;
|
||||
effect.GetFeedbackOfType<MMF_CameraShake>().CameraShakeProperties.Frequency = 1f / frequency;
|
||||
effect.GetFeedbackOfType<MMF_CameraShake>().CameraShakeProperties.AmplitudeX = amplitudeX;
|
||||
effect.GetFeedbackOfType<MMF_CameraShake>().CameraShakeProperties.AmplitudeY = amplitudeY;
|
||||
effect.GetFeedbackOfType<MMF_CameraShake>().CameraShakeProperties.AmplitudeZ = amplitudeZ;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, duration);
|
||||
if (_cameraTransform == null)
|
||||
{
|
||||
_cameraTransform = EditorManager.instance.cameraManager.gameCamera.cam.transform;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
if (_cameraTransform != null)
|
||||
{
|
||||
float timeFactor = effectProgressPercent * frequency;
|
||||
float dampening = 1.0f - effectProgressPercent;
|
||||
|
||||
float offsetX = (Mathf.PerlinNoise(timeFactor, 0) - 0.5f) * 2f * amplitudeX * dampening;
|
||||
float offsetY = (Mathf.PerlinNoise(0, timeFactor) - 0.5f) * 2f * amplitudeY * dampening;
|
||||
float offsetZ = (Mathf.PerlinNoise(timeFactor, timeFactor) - 0.5f) * 2f * amplitudeZ * dampening;
|
||||
|
||||
_cameraTransform.localPosition = new Vector3(offsetX, offsetY, offsetZ);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Adjust() { ResetEffect(); }
|
||||
public override void Recover() { ResetEffect(); }
|
||||
public override void Disrupt() { ResetEffect(); }
|
||||
|
||||
private void ResetEffect()
|
||||
{
|
||||
if (_cameraTransform != null)
|
||||
{
|
||||
_cameraTransform.localPosition = Vector3.zero;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -16,9 +14,9 @@ namespace Ichni.RhythmGame
|
||||
public float duration;
|
||||
public Vector3 tiltValue;
|
||||
public AnimationCurve tiltCurve;
|
||||
|
||||
Transform gameCameraTransform => EditorManager.instance.cameraManager.gameCamera.cam.transform;
|
||||
Tweener tiltTweener;
|
||||
Tweener tiltBackTweener;
|
||||
#endregion
|
||||
|
||||
#region [生成与初始化] Generation & Initialization
|
||||
@@ -50,6 +48,7 @@ namespace Ichni.RhythmGame
|
||||
return;
|
||||
}
|
||||
tiltTweener?.Kill(true);
|
||||
tiltBackTweener?.Kill(true);
|
||||
gameCameraTransform.localEulerAngles = Vector3.zero;
|
||||
}
|
||||
|
||||
@@ -80,7 +79,7 @@ namespace Ichni.RhythmGame
|
||||
public override void Disrupt()
|
||||
{
|
||||
tiltTweener?.Kill();
|
||||
EditorManager.instance.cameraManager.gameCamera.cam.transform.DOLocalRotate(Vector3.zero, 0.4f);
|
||||
tiltBackTweener = EditorManager.instance.cameraManager.gameCamera.cam.transform.DOLocalRotate(Vector3.zero, 0.4f).SetEase(Ease.OutSine).Play();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -15,7 +13,8 @@ namespace Ichni.RhythmGame
|
||||
public float relativeZoom;
|
||||
public AnimationCurve zoomCurve;
|
||||
|
||||
Camera gameCamera => EditorManager.instance.cameraManager.gameCamera.cam;
|
||||
private Camera _mainCamera;
|
||||
private float _startFOV = 60f;
|
||||
#endregion
|
||||
|
||||
#region [生成与初始化] Generation & Initialization
|
||||
@@ -39,14 +38,32 @@ namespace Ichni.RhythmGame
|
||||
#endregion
|
||||
|
||||
#region [处理与更新] Update & Processing
|
||||
public override void Adjust()
|
||||
public override void PreExecute()
|
||||
{
|
||||
MMF_Player effect = LeanPool.Spawn(EditorManager.instance.basePrefabs.cameraZoomEffect).GetComponent<MMF_Player>();
|
||||
effect.GetFeedbackOfType<MMF_CameraFieldOfView>().Duration = duration;
|
||||
effect.GetFeedbackOfType<MMF_CameraFieldOfView>().RemapFieldOfViewOne = relativeZoom;
|
||||
effect.GetFeedbackOfType<MMF_CameraFieldOfView>().ShakeFieldOfView = zoomCurve;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, duration);
|
||||
if (_mainCamera == null)
|
||||
{
|
||||
_mainCamera = EditorManager.instance.cameraManager.gameCamera.cam;
|
||||
}
|
||||
|
||||
_startFOV = _mainCamera.fieldOfView;
|
||||
}
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
if (_mainCamera != null)
|
||||
{
|
||||
float offset = zoomCurve.Evaluate(effectProgressPercent) * relativeZoom;
|
||||
_mainCamera.fieldOfView = _startFOV - offset;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Adjust() { ResetEffect(); }
|
||||
public override void Recover() { ResetEffect(); }
|
||||
public override void Disrupt() { ResetEffect(); }
|
||||
|
||||
private void ResetEffect()
|
||||
{
|
||||
if (_mainCamera != null) _mainCamera.fieldOfView = _startFOV;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -39,16 +36,38 @@ namespace Ichni.RhythmGame
|
||||
|
||||
#region [处理与更新] Update & Processing
|
||||
|
||||
public override void Adjust()
|
||||
public override void PreExecute()
|
||||
{
|
||||
MMF_Player effect = LeanPool.Spawn(EditorManager.instance.basePrefabs.highPassFilterEffect).GetComponent<MMF_Player>();
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterHighPass>().Duration = duration;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterHighPass>().RemapHighPassZero = 10;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterHighPass>().RemapHighPassOne = peak;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterHighPass>().ShakeHighPass = intensityCurve;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, duration);
|
||||
}
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
if (EditorManager.instance.musicPlayer.highPassFilter != null)
|
||||
{
|
||||
float intensity = intensityCurve != null ? intensityCurve.Evaluate(effectProgressPercent) : 0f;
|
||||
EditorManager.instance.musicPlayer.highPassFilter.cutoffFrequency = Mathf.Lerp(10f, peak, intensity);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Recover()
|
||||
{
|
||||
ResetEffect();
|
||||
}
|
||||
|
||||
public override void Disrupt()
|
||||
{
|
||||
ResetEffect();
|
||||
}
|
||||
|
||||
private void ResetEffect()
|
||||
{
|
||||
if (EditorManager.instance.musicPlayer.highPassFilter != null)
|
||||
{
|
||||
EditorManager.instance.musicPlayer.highPassFilter.cutoffFrequency = 10f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Adjust() { ResetEffect(); }
|
||||
#endregion
|
||||
|
||||
#region [保存与序列化] Serialize & BM
|
||||
|
||||
@@ -2,9 +2,6 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -39,16 +36,38 @@ namespace Ichni.RhythmGame
|
||||
|
||||
#region [处理与更新] Update & Processing
|
||||
|
||||
public override void Adjust()
|
||||
public override void PreExecute()
|
||||
{
|
||||
MMF_Player effect = LeanPool.Spawn(EditorManager.instance.basePrefabs.lowPassFilterEffect).GetComponent<MMF_Player>();
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterLowPass>().Duration = duration;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterLowPass>().RemapLowPassZero = 22000;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterLowPass>().RemapLowPassOne = bottom;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterLowPass>().ShakeLowPass = intensityCurve;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, duration);
|
||||
}
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
if (EditorManager.instance.musicPlayer.lowPassFilter != null)
|
||||
{
|
||||
float intensity = intensityCurve != null ? intensityCurve.Evaluate(effectProgressPercent) : 0f;
|
||||
EditorManager.instance.musicPlayer.lowPassFilter.cutoffFrequency = Mathf.Lerp(22000f, bottom, intensity);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Recover()
|
||||
{
|
||||
ResetEffect();
|
||||
}
|
||||
|
||||
public override void Disrupt()
|
||||
{
|
||||
ResetEffect();
|
||||
}
|
||||
|
||||
private void ResetEffect()
|
||||
{
|
||||
if (EditorManager.instance.musicPlayer.lowPassFilter != null)
|
||||
{
|
||||
EditorManager.instance.musicPlayer.lowPassFilter.cutoffFrequency = 22000f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Adjust() { ResetEffect(); }
|
||||
#endregion
|
||||
|
||||
#region [保存与序列化] Serialize & BM
|
||||
|
||||
@@ -193,6 +193,11 @@ namespace Ichni
|
||||
timeHost.timeDurationSubmodule?.UpdateTimeDuration(songTime);
|
||||
}
|
||||
|
||||
if(element is IHaveDirtyMarkSubmodule dirtyHost)
|
||||
{
|
||||
dirtyHost.dirtyMarkSubmodule?.ExecuteDeferredRefresh();
|
||||
}
|
||||
|
||||
if (element.gameObject.activeSelf)
|
||||
{
|
||||
if (element is IHaveTransformSubmodule transformHost)
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Ichni.Editor
|
||||
{
|
||||
#region [ISongTimeProvider 实现] ISongTimeProvider Implementation
|
||||
/// <summary>当前播放进度(秒),已扣除 offset,供 CoreServices.TimeProvider 使用</summary>
|
||||
public float SongTime => EditorManager.instance.songInformation.songTime;
|
||||
public float SongTime => EditorManager.instance != null ? EditorManager.instance.songInformation.songTime : 0;
|
||||
|
||||
/// <summary>当前是否正在播放</summary>
|
||||
public bool IsPlaying => isPlaying;
|
||||
@@ -25,6 +25,10 @@ namespace Ichni.Editor
|
||||
public bool isPlaying;
|
||||
public AudioSource audioSource;
|
||||
private float DspTime => (float)AudioSettings.dspTime;
|
||||
|
||||
public AudioHighPassFilter highPassFilter;
|
||||
public AudioLowPassFilter lowPassFilter;
|
||||
|
||||
#endregion
|
||||
|
||||
#region [生命周期] Lifecycle
|
||||
|
||||
Reference in New Issue
Block a user