选择可显示项
本来想做启闭的懒得做了
This commit is contained in:
@@ -13,6 +13,8 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class TrackRendererSubmodule : TrackSubmodule
|
||||
{
|
||||
protected int submoduleNameIndex = 0;
|
||||
protected readonly string[] submoduleName = { "Auto Orient", "Path Generator", "Tube Generator", "Surface" };
|
||||
public MeshGenerator meshGenerator;
|
||||
public MeshRenderer meshRenderer;
|
||||
public Material renderMaterial;
|
||||
@@ -42,7 +44,7 @@ namespace Ichni.RhythmGame
|
||||
this.materialThemeBundleName = materialThemeBundleName;
|
||||
this.materialName = materialName;
|
||||
Material mat = ThemeBundleManager.instance.GetObject<Material>(materialThemeBundleName, materialName);
|
||||
if(mat != null)
|
||||
if (mat != null)
|
||||
{
|
||||
renderMaterial = mat;
|
||||
meshRenderer.material = renderMaterial;
|
||||
@@ -54,7 +56,7 @@ namespace Ichni.RhythmGame
|
||||
SetEnableZWrite();
|
||||
SetEnableEmission();
|
||||
SetEmissionIntensity();
|
||||
|
||||
|
||||
if (track.trackTimeSubmodule is TrackTimeSubmoduleMovable)
|
||||
{
|
||||
meshGenerator.clipFrom = 0;
|
||||
@@ -86,9 +88,11 @@ namespace Ichni.RhythmGame
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
|
||||
|
||||
var container = inspector.GenerateContainer("Track Renderer Auto Orient");
|
||||
|
||||
var container = inspector.GenerateContainer("Track Renderer " + submoduleName[submoduleNameIndex]);
|
||||
var zWriteSettings = container.GenerateSubcontainer(3);
|
||||
|
||||
|
||||
|
||||
var zWriteToggle =
|
||||
inspector.GenerateToggle(this, zWriteSettings, "Enable ZWrite", nameof(zWrite))
|
||||
.AddListenerFunction(SetEnableZWrite);
|
||||
@@ -99,7 +103,7 @@ namespace Ichni.RhythmGame
|
||||
var emissionIntensityInputField =
|
||||
inspector.GenerateInputField(this, emissionSettings, "Emission Intensity", nameof(emissionIntensity))
|
||||
.AddListenerFunction(SetEmissionIntensity);
|
||||
|
||||
|
||||
var materialSettings = container.GenerateSubcontainer(3);
|
||||
var themeBundleDropdown = inspector
|
||||
.GenerateDropdown(this, materialSettings, "Theme Bundle", ThemeBundleManager.instance.selectedThemeBundleList, nameof(materialThemeBundleName))
|
||||
@@ -132,12 +136,12 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
meshRenderer.material.SetInt("_Emission", enableEmission ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
protected void SetEnableZWrite()
|
||||
{
|
||||
meshRenderer.material.SetInt("_ZWrite", zWrite ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
protected void SetEmissionIntensity()
|
||||
{
|
||||
meshRenderer.material.SetColor("_EmissionColor", Color.white * Mathf.Pow(2, emissionIntensity));
|
||||
@@ -164,6 +168,7 @@ namespace Ichni.RhythmGame
|
||||
this.meshRenderer.material = renderMaterial;
|
||||
this.splineRenderer.color = Color.white;
|
||||
this.splineRenderer.uvRotation = 90;
|
||||
this.submoduleNameIndex = 0; // Auto Orient is the first submodule
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
@@ -194,6 +199,7 @@ namespace Ichni.RhythmGame
|
||||
materialName = trackRendererSubmodule.materialName;
|
||||
enableEmission = trackRendererSubmodule.enableEmission;
|
||||
emissionIntensity = trackRendererSubmodule.emissionIntensity;
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
@@ -241,6 +247,7 @@ namespace Ichni.RhythmGame
|
||||
this.meshRenderer.material = renderMaterial;
|
||||
this.pathGenerator.color = Color.white;
|
||||
this.pathGenerator.uvRotation = 90;
|
||||
this.submoduleNameIndex = 1; // Path Generator is the second submodule
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
@@ -305,7 +312,7 @@ namespace Ichni.RhythmGame
|
||||
public TubeGenerator tubeGenerator;
|
||||
public int sideCount;
|
||||
|
||||
public TrackRendererSubmoduleTubeGenerator(Track track, bool enableEmission, float emissionIntensity, bool zWrite,
|
||||
public TrackRendererSubmoduleTubeGenerator(Track track, bool enableEmission, float emissionIntensity, bool zWrite,
|
||||
int sideCount, Material material = null) :
|
||||
base(track, enableEmission, emissionIntensity, zWrite)
|
||||
{
|
||||
@@ -323,6 +330,7 @@ namespace Ichni.RhythmGame
|
||||
this.tubeGenerator.color = Color.white;
|
||||
this.tubeGenerator.uvRotation = 90;
|
||||
this.tubeGenerator.sides = sideCount;
|
||||
this.submoduleNameIndex = 2; // Tube Generator is the third submodule
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
@@ -349,6 +357,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public class TrackRendererSubmoduleTubeGenerator_BM : Submodule_BM
|
||||
{
|
||||
|
||||
public string materialThemeBundleName;
|
||||
public string materialName;
|
||||
public bool enableEmission;
|
||||
@@ -412,10 +421,11 @@ namespace Ichni.RhythmGame
|
||||
this.surface.spline = track.trackPathSubmodule.path;
|
||||
this.surface.clipFrom = 0;
|
||||
this.surface.clipTo = 1;
|
||||
this.surface.updateMethod = SplineUser.UpdateMethod.LateUpdate;
|
||||
this.surface.updateMethod = SplineUser.UpdateMethod.Update;
|
||||
this.meshRenderer.material = renderMaterial;
|
||||
this.surface.color = Color.white;
|
||||
this.surface.uvRotation = 90;
|
||||
this.submoduleNameIndex = 3; // Surface is the fourth submodule
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
|
||||
Reference in New Issue
Block a user