skybox subsetter
This commit is contained in:
@@ -9,27 +9,39 @@ using UnityEngine.Serialization;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class ParticleTracker : GameElement
|
||||
public partial class ParticleTracker : GameElement, IHaveColorSubmodule
|
||||
{
|
||||
|
||||
public Track track;
|
||||
public ParticleController particleController;
|
||||
public ParticleSystem particle;
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveBaseColor => true;
|
||||
public bool haveEmissionColor => true;
|
||||
|
||||
public float playTime;
|
||||
public float stopTime;
|
||||
public float width;
|
||||
public float density;
|
||||
public bool prewarm;
|
||||
public bool isAutoOrient;
|
||||
public Vector3 particleRotation;
|
||||
public string themeBundleName;
|
||||
public string materialName;
|
||||
|
||||
public bool prewarm;
|
||||
public float playTime;
|
||||
public float stopTime;
|
||||
|
||||
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,
|
||||
float playTime, float stopTime,
|
||||
float width, float density, bool prewarm, bool isAutoOrient, Vector3 particleRotation)
|
||||
bool prewarm, float playTime, float stopTime,
|
||||
bool is3D, float width, Vector3 extendDirection,
|
||||
float density, float lifeTime,
|
||||
bool isAutoOrient, Vector3 particleRotation)
|
||||
{
|
||||
ParticleTracker particleTracker = Instantiate(EditorManager.instance.basePrefabs.particleTracker, track.transform)
|
||||
.GetComponent<ParticleTracker>();
|
||||
@@ -41,27 +53,43 @@ namespace Ichni.RhythmGame
|
||||
particleTracker.themeBundleList = ThemeBundleManager.instance.loadedThemeBundleList.ConvertAll(x => x.themeBundleName);
|
||||
particleTracker.materialNameList = new List<string>();
|
||||
particleTracker.SetParticleMaterial(themeBundleName, materialName);
|
||||
particleTracker.SetParticleSettings(width, density, prewarm, isAutoOrient, particleRotation);
|
||||
particleTracker.SetParticleSettings(prewarm, is3D, width, extendDirection, density, lifeTime, isAutoOrient, particleRotation);
|
||||
return particleTracker;
|
||||
}
|
||||
|
||||
public override void SetDefaultSubmodules()
|
||||
{
|
||||
colorSubmodule = new ColorSubmodule(this, Color.white, true, Color.white, 0);
|
||||
}
|
||||
|
||||
public void SetParticleMaterial(string themeBundleName, string materialName)
|
||||
{
|
||||
Material material = ThemeBundleManager.instance.GetObject<Material>(themeBundleName, materialName) ??
|
||||
EditorManager.instance.basePrefabs.defaultParticleMaterial;
|
||||
particle.GetComponent<Renderer>().material = Instantiate(material);
|
||||
Renderer particleRenderer = particle.GetComponent<Renderer>();
|
||||
particleRenderer.material = Instantiate(material);
|
||||
particleRenderer.InitializeShader();
|
||||
|
||||
}
|
||||
|
||||
public void SetParticleSettings(float width, float density, bool prewarm, bool isAutoOrient, Vector3 particleRotation)
|
||||
public void SetParticleSettings(bool prewarm,
|
||||
bool is3D, float width, Vector3 extendDirection,
|
||||
float density, float lifeTime,
|
||||
bool isAutoOrient, Vector3 particleRotation)
|
||||
{
|
||||
this.prewarm = prewarm;
|
||||
this.is3D = is3D;
|
||||
this.width = width;
|
||||
this.extendDirection = extendDirection;
|
||||
this.density = density;
|
||||
this.lifeTime = lifeTime;
|
||||
this.prewarm = prewarm;
|
||||
this.isAutoOrient = isAutoOrient;
|
||||
this.particleRotation = particleRotation;
|
||||
|
||||
SetWidth();
|
||||
SetShape();
|
||||
SetDensity();
|
||||
SetLifeTime();
|
||||
SetAlignment();
|
||||
}
|
||||
}
|
||||
@@ -88,7 +116,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
matchedBM = new ParticleTracker_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM,
|
||||
playTime, stopTime, width, density, prewarm, isAutoOrient, particleRotation,
|
||||
prewarm, playTime, stopTime, is3D, width, extendDirection, density, lifeTime, isAutoOrient, particleRotation,
|
||||
themeBundleName, materialName);
|
||||
}
|
||||
|
||||
@@ -97,22 +125,31 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
base.SetUpInspector();
|
||||
|
||||
IHaveInspection inspector = 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));
|
||||
inspector.GenerateInputField(this, particleSettings0, "Width", nameof(width)).AddListenerFunction(SetWidth);
|
||||
|
||||
inspector.GenerateInputField(this, particleSettings0, "Density", nameof(density)).AddListenerFunction(SetDensity);
|
||||
inspector.GenerateToggle(this, particleSettings0, "Prewarm", nameof(prewarm)).AddListenerFunction(SetPrewarm);
|
||||
inspector.GenerateToggle(this, particleSettings0, "Is Auto Orient", nameof(isAutoOrient)).AddListenerFunction(SetAlignment);
|
||||
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 particleSettings1 = container.GenerateSubcontainer(1);
|
||||
inspector.GenerateVector3InputField(this, particleSettings1, "Particle Rotation", nameof(particleRotation)).AddListenerFunction(SetParticleRotation);
|
||||
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 =
|
||||
@@ -120,7 +157,7 @@ namespace Ichni.RhythmGame
|
||||
.AddListenerFunction(() => inspectorMain.SetInspector(this));
|
||||
if (themeBundleName != String.Empty && ThemeBundleManager.instance.TryGetThemeBundle(themeBundleName, out ThemeBundle themeBundle))
|
||||
{
|
||||
materialNameList = themeBundle.assetList_GameObject.ConvertAll(x => x.name);
|
||||
materialNameList = themeBundle.assetList_Material.ConvertAll(x => x.name);
|
||||
var objectNameDropdown =
|
||||
inspector.GenerateDropdown(this, materialSettings, "Material Name", materialNameList, nameof(materialName))
|
||||
.AddListenerFunction(() => inspectorMain.SetInspector(this));
|
||||
@@ -146,9 +183,11 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public partial class ParticleTracker
|
||||
{
|
||||
private void SetWidth()
|
||||
private void SetShape()
|
||||
{
|
||||
particleController.is3D = is3D;
|
||||
particleController.width = width;
|
||||
particleController.extendDirection = extendDirection;
|
||||
particleController.Rebuild();
|
||||
}
|
||||
|
||||
@@ -158,6 +197,12 @@ namespace Ichni.RhythmGame
|
||||
emission.rateOverTime = density;
|
||||
}
|
||||
|
||||
private void SetLifeTime()
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
mainModule.startLifetime = lifeTime;
|
||||
}
|
||||
|
||||
private void SetPrewarm()
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
@@ -188,21 +233,44 @@ namespace Ichni.RhythmGame
|
||||
mainModule.startRotationY = particleRotation.y;
|
||||
mainModule.startRotationZ = particleRotation.z;
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
ParticleSystemRenderer particleSystemRenderer = particle.GetComponent<ParticleSystemRenderer>();
|
||||
particleSystemRenderer.material.SetColor("_BaseColor", colorSubmodule.currentBaseColor);
|
||||
if (colorSubmodule.emissionEnabled)
|
||||
{
|
||||
particleSystemRenderer.material.EnableKeyword("_EMISSION_ON");
|
||||
particleSystemRenderer.material.SetColor("_EmissionColor", colorSubmodule.GetCurrentEmissionColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
particleSystemRenderer.material.DisableKeyword("_EMISSION_ON");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class ParticleTracker_BM : GameElement_BM
|
||||
{
|
||||
public float playTime;
|
||||
public float stopTime;
|
||||
public float width;
|
||||
public float density;
|
||||
public bool prewarm;
|
||||
public bool isAutoOrient;
|
||||
public Vector3 particleRotation;
|
||||
public string materialThemeBundleName;
|
||||
public string materialName;
|
||||
public bool prewarm = false;
|
||||
public float playTime = 0f;
|
||||
public float stopTime = 1f;
|
||||
|
||||
public bool is3D = false;
|
||||
public float width = 10f;
|
||||
public Vector3 extendDirection = Vector3.right;
|
||||
|
||||
public float density = 10;
|
||||
public float lifeTime = 5;
|
||||
|
||||
public bool isAutoOrient = true;
|
||||
public Vector3 particleRotation = Vector3.zero;
|
||||
|
||||
public string materialThemeBundleName = string.Empty;
|
||||
public string materialName = string.Empty;
|
||||
|
||||
public ParticleTracker_BM()
|
||||
{
|
||||
@@ -210,18 +278,23 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public ParticleTracker_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
float playTime, float stopTime,
|
||||
float width, float density, bool prewarm, bool isAutoOrient, Vector3 particleRotation,
|
||||
string materialThemeBundleName, string materialName)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
bool prewarm, float playTime, float stopTime,
|
||||
bool is3D, float width, Vector3 extendDirection,
|
||||
float density, float lifeTime,
|
||||
bool isAutoOrient, Vector3 particleRotation,
|
||||
string materialThemeBundleName, string materialName) : base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.prewarm = prewarm;
|
||||
this.playTime = playTime;
|
||||
this.stopTime = stopTime;
|
||||
this.width = width;
|
||||
this.density = density;
|
||||
this.prewarm = prewarm;
|
||||
this.is3D = is3D;
|
||||
this.extendDirection = extendDirection;
|
||||
this.lifeTime = lifeTime;
|
||||
this.isAutoOrient = isAutoOrient;
|
||||
this.particleRotation = particleRotation;
|
||||
|
||||
this.materialThemeBundleName = materialThemeBundleName;
|
||||
this.materialName = materialName;
|
||||
}
|
||||
@@ -230,17 +303,16 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
matchedElement = ParticleTracker.GenerateElement(
|
||||
elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track,
|
||||
materialThemeBundleName, materialName,
|
||||
playTime, stopTime, width, density, prewarm, isAutoOrient, particleRotation);
|
||||
GetElement(attachedElementGuid) as Track, materialThemeBundleName, materialName,
|
||||
prewarm, playTime, stopTime, is3D, width, extendDirection, density, lifeTime, isAutoOrient, particleRotation);
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement attached)
|
||||
{
|
||||
return ParticleTracker.GenerateElement(
|
||||
elementName, Guid.NewGuid(), tags, false, attached as Track,
|
||||
materialThemeBundleName, materialName,
|
||||
playTime, stopTime, width, density, prewarm, isAutoOrient, particleRotation);
|
||||
elementName, Guid.NewGuid(), tags, false,
|
||||
attached as Track, materialThemeBundleName, materialName,
|
||||
prewarm, playTime, stopTime, is3D, width, extendDirection, density, lifeTime, isAutoOrient, particleRotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Ichni.RhythmGame
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveEmission => false;
|
||||
public bool haveEmissionColor => false;
|
||||
public override int HierarchyPriority => -100;
|
||||
|
||||
[Title("Editor独有参数")]
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
var particleTrackerButton = inspector.GenerateButton(this, particleSubcontainer, "Particle Tracker",
|
||||
() => { ParticleTracker.GenerateElement("New Particle Tracker", Guid.NewGuid(), new List<string>(), true, this,
|
||||
string.Empty, string.Empty, 0, 1, 10, 10, true, true, Vector3.zero); }); //Particle Tracker
|
||||
string.Empty, string.Empty, false, 0, 1, false, 10, Vector3.right, 10, 5, true, Vector3.zero); }); //Particle Tracker
|
||||
|
||||
StandardInspectionElement.GenerateForTransform(this, generateContainer); //关于有Transform的元素
|
||||
// var animationSubcontainer = generateContainer.GenerateSubcontainer(3);
|
||||
|
||||
Reference in New Issue
Block a user