DTM Trail
This commit is contained in:
@@ -34,6 +34,10 @@ namespace Ichni.Editor
|
||||
sliderG.value=baseColor.g;
|
||||
sliderB.value=baseColor.b;
|
||||
sliderA.value=baseColor.a;
|
||||
sliderR.onValueChanged.AddListener(SliderChange);
|
||||
sliderG.onValueChanged.AddListener(SliderChange);
|
||||
sliderB.onValueChanged.AddListener(SliderChange);
|
||||
sliderA.onValueChanged.AddListener(SliderChange);
|
||||
inputFieldBaseR.onEndEdit.AddListener(_ => ApplyParameters());
|
||||
inputFieldBaseG.onEndEdit.AddListener(_ => ApplyParameters());
|
||||
inputFieldBaseB.onEndEdit.AddListener(_ => ApplyParameters());
|
||||
|
||||
@@ -44,6 +44,9 @@ namespace Ichni.Editor
|
||||
sliderR.value=emissionColor.r;
|
||||
sliderG.value=emissionColor.g;
|
||||
sliderB.value=emissionColor.b;
|
||||
sliderR.onValueChanged.AddListener(SliderChange);
|
||||
sliderG.onValueChanged.AddListener(SliderChange);
|
||||
sliderB.onValueChanged.AddListener(SliderChange);
|
||||
|
||||
|
||||
toggleEnableEmission.onValueChanged.AddListener(_ => ApplyParameters());
|
||||
@@ -66,17 +69,21 @@ namespace Ichni.Editor
|
||||
connectedBaseElement.GetType().GetField(colorParameterName).SetValue(connectedBaseElement, emissionColor);
|
||||
connectedBaseElement.GetType().GetField(emissionIntensityName).SetValue(connectedBaseElement, emissionIntensity);
|
||||
colorPreview.color = emissionColor;
|
||||
connectedBaseElement.Refresh();
|
||||
//connectedBaseElement.Refresh();
|
||||
}
|
||||
public void SliderChange(float value){
|
||||
inputFieldEmissionR.text=sliderR.value.ToString();
|
||||
inputFieldEmissionG.text=sliderG.value.ToString();
|
||||
inputFieldEmissionB.text=sliderB.value.ToString();
|
||||
|
||||
public void SliderChange(float value)
|
||||
{
|
||||
inputFieldEmissionR.text = sliderR.value.ToString();
|
||||
inputFieldEmissionG.text = sliderG.value.ToString();
|
||||
inputFieldEmissionB.text = sliderB.value.ToString();
|
||||
ApplyParameters();
|
||||
}
|
||||
|
||||
|
||||
public override void AddListenerFunction(UnityAction action)
|
||||
{
|
||||
toggleEnableEmission.onValueChanged.AddListener(_ => action());
|
||||
|
||||
inputFieldEmissionR.onEndEdit.AddListener(_ => action());
|
||||
inputFieldEmissionG.onEndEdit.AddListener(_ => action());
|
||||
inputFieldEmissionB.onEndEdit.AddListener(_ => action());
|
||||
|
||||
@@ -65,6 +65,11 @@ namespace Ichni.RhythmGame
|
||||
// }
|
||||
//
|
||||
|
||||
public interface IHaveInteraction
|
||||
{
|
||||
public void TriggerInteraction();
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
|
||||
@@ -61,11 +61,21 @@ namespace Ichni.RhythmGame
|
||||
/// <returns>返回距离当前时间最近的前一个AnimatedBool</returns>
|
||||
AnimatedBool GetAnimatedBool(float nowTime)
|
||||
{
|
||||
if (nowTime < animations[0].time)
|
||||
{
|
||||
return animations[0];
|
||||
}
|
||||
|
||||
if (nowTime > animations[animations.Count - 1].time)
|
||||
{
|
||||
return animations[animations.Count - 1];
|
||||
}
|
||||
|
||||
for (int i = 0; i < animations.Count; i++)
|
||||
{
|
||||
if (nowTime >= animations[i].time)
|
||||
if (nowTime < animations[i].time)
|
||||
{
|
||||
return animations[i];
|
||||
return animations[i - 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,14 @@ namespace Ichni.RhythmGame
|
||||
public bool baseColorDirtyMark;
|
||||
public bool emissionColorDirtyMark;
|
||||
|
||||
public Color GetCurrentEmissionColor()
|
||||
{
|
||||
float intensity = Mathf.Pow(2, currentEmissionIntensity);
|
||||
Color emissionColor = currentEmissionColor * intensity;
|
||||
emissionColor.a = 1;
|
||||
return emissionColor;
|
||||
}
|
||||
|
||||
public ColorSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
this.originalBaseColor = Color.white;
|
||||
@@ -117,6 +125,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
currentBaseColor = originalBaseColor;
|
||||
currentEmissionColor = originalEmissionColor;
|
||||
currentEmissionIntensity = originalEmissionIntensity;
|
||||
baseColorDirtyMark = true;
|
||||
emissionColorDirtyMark = true;
|
||||
}
|
||||
@@ -125,7 +134,7 @@ namespace Ichni.RhythmGame
|
||||
public interface IHaveColorSubmodule
|
||||
{
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveEmission { get; }
|
||||
public bool haveEmission => false;
|
||||
|
||||
public void SetColorObserver()
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace Ichni.RhythmGame
|
||||
public TimeDurationSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
isOverridingDuration = false;
|
||||
startTime = -EditorManager.instance.songInformation.delay;//TODO: 换为-delay
|
||||
endTime = EditorManager.instance.songInformation.songTime;//TODO: 换为songLength
|
||||
startTime = -32767;//TODO: 换为-delay
|
||||
endTime = 32767;//TODO: 换为songLength
|
||||
|
||||
(attachedGameElement as IHaveTimeDurationSubmodule).timeDurationSubmodule = this;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ namespace Ichni.RhythmGame
|
||||
() => EmissionColorChange.GenerateElement("New Emission Color Change", Guid.NewGuid(), new List<string>(), true,
|
||||
this, new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Ichni.RhythmGame
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveEmission => false;
|
||||
public virtual bool haveEmission => false;
|
||||
|
||||
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
string themeBundleName, string objectName, GameElement parentElement)
|
||||
|
||||
@@ -7,9 +7,9 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class Trail : GameElement, IHaveTransformSubmodule
|
||||
public partial class Trail : GameElement, IHaveTransformSubmodule, IHaveTrail
|
||||
{
|
||||
public TrailRenderer trailRenderer;
|
||||
public TrailRenderer trailRenderer { get; set; }
|
||||
public Material renderMaterial;
|
||||
|
||||
public float visibleTimeLength;
|
||||
@@ -88,7 +88,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
foreach (GameElement x in EditorManager.instance.beatmapContainer.gameElementList)
|
||||
{
|
||||
if (x is Trail t)
|
||||
if (x is IHaveTrail t)
|
||||
{
|
||||
t.trailRenderer.emitting = emitting;
|
||||
if(willClear) t.trailRenderer.Clear();
|
||||
@@ -96,6 +96,11 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveTrail
|
||||
{
|
||||
TrailRenderer trailRenderer { get; set; }
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
|
||||
@@ -26,7 +26,10 @@ namespace Ichni.Editor
|
||||
currentSelectedElements.Add(gameElement);
|
||||
|
||||
gameElement.connectedTab.isSelected = true;
|
||||
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0.2f);
|
||||
if (gameElement.connectedTab.BgImage != null)
|
||||
{
|
||||
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveSelectElement(GameElement gameElement)
|
||||
@@ -34,7 +37,10 @@ namespace Ichni.Editor
|
||||
currentSelectedElements.Remove(gameElement);
|
||||
|
||||
gameElement.connectedTab.isSelected = false;
|
||||
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0);
|
||||
if (gameElement.connectedTab.BgImage != null)
|
||||
{
|
||||
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearSelectedElements()
|
||||
@@ -42,7 +48,10 @@ namespace Ichni.Editor
|
||||
currentSelectedElements.ForEach(gameElement =>
|
||||
{
|
||||
gameElement.connectedTab.isSelected = false;
|
||||
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0);
|
||||
if (gameElement.connectedTab.BgImage != null)
|
||||
{
|
||||
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0);
|
||||
}
|
||||
});
|
||||
|
||||
currentSelectedElements.Clear();
|
||||
|
||||
Reference in New Issue
Block a user