fix
This commit is contained in:
@@ -123,7 +123,7 @@ namespace Ichni.RhythmGame
|
||||
var generateTrailButton = inspector.GenerateButton(this, generation, "Trail",
|
||||
() => Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(),
|
||||
true, this, 1, true, 1,
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient()));
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", ""));
|
||||
var environmentObjectButton = inspector.GenerateButton(this, generation, "Environment Object",
|
||||
() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
|
||||
true, this));
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
|
||||
this, 1, true, 1,
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient());
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", "");
|
||||
});
|
||||
var environmentObjectButton = inspector.GenerateButton(this, generation, "Environment Object",
|
||||
() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
|
||||
this, 1, true, 1,
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient());
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient(), "", "");
|
||||
});
|
||||
var environmentObjectButton = inspector.GenerateButton(this, generation, "Environment Object",
|
||||
() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
|
||||
|
||||
@@ -29,10 +29,14 @@ namespace Ichni.RhythmGame
|
||||
get => visibleTimeLength;
|
||||
set => visibleTimeLength = value;
|
||||
}
|
||||
public bool emissionEnabled = false;
|
||||
public float emissionIntensity = 1f; // 发光强度
|
||||
|
||||
|
||||
|
||||
public static Trail GenerateElement(string name, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
GameElement parentElement, float visibleTimeLength, bool isAutoOrient, float widthMultiplier,
|
||||
AnimationCurve widthCurve, Gradient gradient, Material material = null)
|
||||
AnimationCurve widthCurve, Gradient gradient, string materialThemeBundleName, string materialName, Material material = null)
|
||||
{
|
||||
gradient ??= ColorExtensions.DefaultGradient();
|
||||
|
||||
@@ -47,6 +51,8 @@ namespace Ichni.RhythmGame
|
||||
trail.widthMultiplier = widthMultiplier;
|
||||
trail.widthCurve = widthCurve;
|
||||
trail.gradient = gradient;
|
||||
trail.materialThemeBundleName = materialThemeBundleName;
|
||||
trail.materialName = materialName;
|
||||
|
||||
trail.trailRenderer.material = trail.renderMaterial;
|
||||
trail.trailRenderer.time = visibleTimeLength;
|
||||
@@ -114,22 +120,23 @@ namespace Ichni.RhythmGame
|
||||
// ----------- 新增:材质设置 -----------
|
||||
var materialSettings = container.GenerateSubcontainer(3);
|
||||
|
||||
|
||||
// 主题包下拉框
|
||||
if (ThemeBundleManager.instance != null)
|
||||
{
|
||||
var themeBundleDropdown = inspector
|
||||
.GenerateDropdown(this, materialSettings, "Theme Bundle", ThemeBundleManager.instance.selectedThemeBundleList, "materialThemeBundleName")
|
||||
.GenerateDropdown(this, materialSettings, "Theme Bundle", ThemeBundleManager.instance.selectedThemeBundleList, nameof(materialThemeBundleName))
|
||||
.AddListenerFunction(() => inspectorMain.SetInspector(this));
|
||||
// 材质名下拉框
|
||||
if (!string.IsNullOrEmpty(materialThemeBundleName) && ThemeBundleManager.instance.TryGetThemeBundle(materialThemeBundleName, out ThemeBundle themeBundle))
|
||||
{
|
||||
List<string> materialNameList = themeBundle.assetList_Material.ConvertAll(x => x.name);
|
||||
var objectNameDropdown = inspector.GenerateDropdown(this, materialSettings, "Material Name", materialNameList, "materialName")
|
||||
var objectNameDropdown = inspector.GenerateDropdown(this, materialSettings, "Material Name", materialNameList, nameof(materialName))
|
||||
.AddListenerFunction(() => inspectorMain.SetInspector(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
var objectNameDropdown = inspector.GenerateDropdown(this, materialSettings, "Material Name", new List<string>(), "materialName");
|
||||
var objectNameDropdown = inspector.GenerateDropdown(this, materialSettings, "Material Name", new List<string>(), nameof(materialName));
|
||||
objectNameDropdown.dropdown.interactable = false;
|
||||
}
|
||||
// 应用材质按钮
|
||||
@@ -162,6 +169,23 @@ namespace Ichni.RhythmGame
|
||||
gradientWindow.SetAsGradientAlphaKeys();
|
||||
gradientWindow.closeButton.onClick.AddListener(() => trailRenderer.colorGradient = gradient);
|
||||
});
|
||||
var emissionSettings = container.GenerateSubcontainer(3);
|
||||
var emissionToggle = inspector.GenerateToggle(this, emissionSettings, "Emission Enabled", nameof(emissionEnabled))
|
||||
.AddListenerFunction(() =>
|
||||
{
|
||||
if (emissionEnabled)
|
||||
{
|
||||
trailRenderer.material.EnableKeyword("_EMISSION_ON");
|
||||
}
|
||||
else
|
||||
{
|
||||
trailRenderer.material.DisableKeyword("_EMISSION_ON");
|
||||
}
|
||||
}
|
||||
);
|
||||
var emissionIntensityInputField = inspector.GenerateInputField(this, emissionSettings, "Emission Intensity", nameof(emissionIntensity))
|
||||
.AddListenerFunction(() => trailRenderer.material.SetFloat("_EmissionIntensity", emissionIntensity));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +286,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
matchedElement = Trail.GenerateElement(elementName, elementGuid, tags,
|
||||
false, GetElement(attachedElementGuid),
|
||||
visibleTimeLength, isAutoOrient, widthMultiplier, widthCurve, gradient, mat);
|
||||
visibleTimeLength, isAutoOrient, widthMultiplier, widthCurve, gradient, materialThemeBundleName, materialName, mat);
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
@@ -275,7 +299,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
return Trail.GenerateElement(elementName, Guid.NewGuid(), tags,
|
||||
false, parent, visibleTimeLength,
|
||||
isAutoOrient, widthMultiplier, widthCurve, gradient, mat);
|
||||
isAutoOrient, widthMultiplier, widthCurve, gradient, materialThemeBundleName, materialName, mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user