@@ -20,7 +20,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public string themeBundleName;
|
||||
public string materialName;
|
||||
|
||||
|
||||
public bool prewarm;
|
||||
public float playTime;
|
||||
public float stopTime;
|
||||
@@ -28,14 +28,14 @@ namespace Ichni.RhythmGame
|
||||
public bool is3D;
|
||||
public float width;
|
||||
public Vector3 extendDirection;
|
||||
|
||||
|
||||
public float density;
|
||||
public float lifeTime;
|
||||
|
||||
|
||||
public bool isAutoOrient;
|
||||
public Vector3 particleRotation;
|
||||
|
||||
|
||||
|
||||
|
||||
public static ParticleTracker GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, Track track, string themeBundleName, string materialName,
|
||||
bool prewarm, float playTime, float stopTime,
|
||||
@@ -69,10 +69,10 @@ namespace Ichni.RhythmGame
|
||||
Renderer particleRenderer = particle.GetComponent<Renderer>();
|
||||
particleRenderer.material = Instantiate(material);
|
||||
particleRenderer.InitializeShader();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void SetParticleSettings(bool prewarm,
|
||||
public void SetParticleSettings(bool prewarm,
|
||||
bool is3D, float width, Vector3 extendDirection,
|
||||
float density, float lifeTime,
|
||||
bool isAutoOrient, Vector3 particleRotation)
|
||||
@@ -102,14 +102,25 @@ namespace Ichni.RhythmGame
|
||||
float songTime = EditorManager.instance.songInformation.songTime;
|
||||
if (playTime > songTime || stopTime < songTime)
|
||||
{
|
||||
particle.Stop();
|
||||
if (particle.isPlaying || particle.isPaused)
|
||||
{
|
||||
particle.Stop();
|
||||
|
||||
particle.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!particle.isPlaying)
|
||||
if (!EditorManager.instance.musicPlayer.isPlaying)
|
||||
{
|
||||
particle.Pause();
|
||||
}
|
||||
else if (!particle.isPlaying)
|
||||
{
|
||||
particle.Play();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,43 +128,43 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
matchedBM = new ParticleTracker_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM,
|
||||
prewarm, playTime, stopTime, is3D, width, extendDirection, density, lifeTime, isAutoOrient, particleRotation,
|
||||
prewarm, playTime, stopTime, is3D, width, extendDirection, density, lifeTime, isAutoOrient, particleRotation,
|
||||
themeBundleName, materialName);
|
||||
}
|
||||
|
||||
|
||||
private List<string> themeBundleList;
|
||||
private List<string> materialNameList;
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
base.SetUpInspector();
|
||||
|
||||
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
|
||||
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Particle Tracker");
|
||||
|
||||
DynamicUISubcontainer particleSettings0 = container.GenerateSubcontainer(3);
|
||||
inspector.GenerateToggle(this, particleSettings0, "Prewarm", nameof(prewarm)).AddListenerFunction(SetPrewarm);
|
||||
inspector.GenerateInputField(this, particleSettings0, "Play Time", nameof(playTime));
|
||||
inspector.GenerateInputField(this, particleSettings0, "Stop Time", nameof(stopTime));
|
||||
|
||||
|
||||
DynamicUISubcontainer particleSettings1_0 = container.GenerateSubcontainer(3);
|
||||
inspector.GenerateToggle(this, particleSettings1_0, "Is 3D", nameof(is3D)).AddListenerFunction(SetShape);
|
||||
inspector.GenerateInputField(this, particleSettings1_0, "Width", nameof(width)).AddListenerFunction(SetShape);
|
||||
DynamicUISubcontainer particleSettings1_1 = container.GenerateSubcontainer(1);
|
||||
inspector.GenerateVector3InputField(this, particleSettings1_1, "Extend Direction", nameof(extendDirection)).AddListenerFunction(SetShape);
|
||||
|
||||
|
||||
DynamicUISubcontainer particleSettings2 = container.GenerateSubcontainer(3);
|
||||
inspector.GenerateInputField(this, particleSettings2, "Density", nameof(density)).AddListenerFunction(SetDensity);
|
||||
inspector.GenerateInputField(this, particleSettings2, "Life Time", nameof(lifeTime)).AddListenerFunction(SetLifeTime);
|
||||
|
||||
|
||||
DynamicUISubcontainer particleSettings3_0 = container.GenerateSubcontainer(3);
|
||||
inspector.GenerateToggle(this, particleSettings3_0, "Is Auto Orient", nameof(isAutoOrient)).AddListenerFunction(SetAlignment);
|
||||
DynamicUISubcontainer particleSettings3_1 = container.GenerateSubcontainer(1);
|
||||
inspector.GenerateVector3InputField(this, particleSettings3_1, "Particle Rotation", nameof(particleRotation)).AddListenerFunction(SetParticleRotation);
|
||||
|
||||
DynamicUISubcontainer materialSettings = container.GenerateSubcontainer(3);
|
||||
var themeBundleDropdown =
|
||||
var themeBundleDropdown =
|
||||
inspector.GenerateDropdown(this, materialSettings, "Theme Bundle", themeBundleList, nameof(themeBundleName))
|
||||
.AddListenerFunction(() => inspectorMain.SetInspector(this));
|
||||
if (themeBundleName != String.Empty && ThemeBundleManager.instance.TryGetThemeBundle(themeBundleName, out ThemeBundle themeBundle))
|
||||
@@ -165,14 +176,14 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
else
|
||||
{
|
||||
var objectNameDropdown =
|
||||
var objectNameDropdown =
|
||||
inspector.GenerateDropdown(this, materialSettings, "Material Name", new List<string>(), nameof(materialName));
|
||||
objectNameDropdown.dropdown.interactable = false;
|
||||
} // 如果没有选择主题包,则材质名称下拉框不可用
|
||||
|
||||
|
||||
var setMaterialButton = inspector.GenerateButton(this, materialSettings, "Set Material", () =>
|
||||
{
|
||||
SetParticleMaterial(themeBundleName, materialName);
|
||||
SetParticleMaterial(themeBundleName, materialName);
|
||||
});
|
||||
|
||||
if (themeBundleName == String.Empty || materialName == String.Empty)
|
||||
@@ -197,19 +208,19 @@ namespace Ichni.RhythmGame
|
||||
var emission = particle.emission;
|
||||
emission.rateOverTime = density;
|
||||
}
|
||||
|
||||
|
||||
private void SetLifeTime()
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
mainModule.startLifetime = lifeTime;
|
||||
}
|
||||
|
||||
|
||||
private void SetPrewarm()
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
mainModule.prewarm = prewarm;
|
||||
}
|
||||
|
||||
|
||||
private void SetAlignment()
|
||||
{
|
||||
ParticleSystemRenderer particleSystemRenderer = particle.GetComponent<ParticleSystemRenderer>();
|
||||
@@ -226,7 +237,7 @@ namespace Ichni.RhythmGame
|
||||
SetParticleRotation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetParticleRotation()
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
@@ -251,7 +262,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class ParticleTracker_BM : GameElement_BM
|
||||
@@ -269,7 +280,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public bool isAutoOrient = true;
|
||||
public Vector3 particleRotation = Vector3.zero;
|
||||
|
||||
|
||||
public string materialThemeBundleName = string.Empty;
|
||||
public string materialName = string.Empty;
|
||||
|
||||
@@ -279,7 +290,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public ParticleTracker_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
bool prewarm, float playTime, float stopTime,
|
||||
bool prewarm, float playTime, float stopTime,
|
||||
bool is3D, float width, Vector3 extendDirection,
|
||||
float density, float lifeTime,
|
||||
bool isAutoOrient, Vector3 particleRotation,
|
||||
@@ -295,7 +306,7 @@ namespace Ichni.RhythmGame
|
||||
this.lifeTime = lifeTime;
|
||||
this.isAutoOrient = isAutoOrient;
|
||||
this.particleRotation = particleRotation;
|
||||
|
||||
|
||||
this.materialThemeBundleName = materialThemeBundleName;
|
||||
this.materialName = materialName;
|
||||
}
|
||||
@@ -311,7 +322,7 @@ namespace Ichni.RhythmGame
|
||||
public override GameElement DuplicateBM(GameElement attached)
|
||||
{
|
||||
return ParticleTracker.GenerateElement(
|
||||
elementName, Guid.NewGuid(), tags, false,
|
||||
elementName, Guid.NewGuid(), tags, false,
|
||||
attached as Track, materialThemeBundleName, materialName,
|
||||
prewarm, playTime, stopTime, is3D, width, extendDirection, density, lifeTime, isAutoOrient, particleRotation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user