diff --git a/NoteTweaks/Configuration/PluginConfig.cs b/NoteTweaks/Configuration/PluginConfig.cs index 88b83aa..4b11b73 100644 --- a/NoteTweaks/Configuration/PluginConfig.cs +++ b/NoteTweaks/Configuration/PluginConfig.cs @@ -31,5 +31,8 @@ internal class PluginConfig public virtual float GlowIntensity { get; set; } = 1.0f; public virtual float GlowScale { get; set; } = 1.0f; + public bool EnableChainDots { get; set; } = true; + public Vector2 ChainDotScale { get; set; } = Vector2.one; + public bool EnableChainDotGlow { get; set; } = true; } } \ No newline at end of file diff --git a/NoteTweaks/Patches/NoteArrowPatch.cs b/NoteTweaks/Patches/NoteArrowPatch.cs index c12e10f..caa33f9 100644 --- a/NoteTweaks/Patches/NoteArrowPatch.cs +++ b/NoteTweaks/Patches/NoteArrowPatch.cs @@ -103,6 +103,8 @@ internal class NoteArrowPatch private static Vector3 _initialPosition = Vector3.zero; private static bool _initialDotPositionDidSet = false; private static Vector3 _initialDotPosition = Vector3.zero; + private static bool _initialChainDotPositionDidSet = false; + private static Vector3 _initialChainDotPosition = Vector3.zero; internal static void Postfix(ColorNoteVisuals __instance, ref MeshRenderer[] ____arrowMeshRenderers, ref MeshRenderer[] ____circleMeshRenderers) { @@ -114,9 +116,10 @@ internal static void Postfix(ColorNoteVisuals __instance, ref MeshRenderer[] ___ if (_replacementDotMaterial == null) { Plugin.Log.Info("Creating replacement dot material"); - _replacementDotMaterial = new Material(Shader.Find("Standard")) + Material arrowMat = Resources.FindObjectsOfTypeAll().ToList().Find(x => x.name == "NoteArrowHD"); + _replacementDotMaterial = new Material(arrowMat.shader) { - color = new Color(1f, 1f, 1f, 0f) + color = new Color(1f, 1f, 1f, 1f) }; } if(_dotGlowMaterial == null) { @@ -165,26 +168,54 @@ internal static void Postfix(ColorNoteVisuals __instance, ref MeshRenderer[] ___ } } + bool isChainLink = __instance.GetComponent() != null; + foreach (MeshRenderer meshRenderer in ____circleMeshRenderers) { if (_dotGlowMesh == null) { _dotGlowMesh = meshRenderer.GetComponent().mesh; } + + Vector3 dotPosition; + Vector3 glowPosition; + Vector3 dotScale; + Vector3 glowScale; + if (isChainLink) + { + dotPosition = new Vector3(_initialChainDotPosition.x, _initialChainDotPosition.y, _initialChainDotPosition.z); + glowPosition = new Vector3(_initialChainDotPosition.x, _initialChainDotPosition.y, _initialChainDotPosition.z + 0.001f); + dotScale = new Vector3(Plugin.Config.ChainDotScale.x / 18f, Plugin.Config.ChainDotScale.y / 18f, 0.0001f); + glowScale = new Vector3((Plugin.Config.ChainDotScale.x / 6f) * Plugin.Config.GlowScale, (Plugin.Config.ChainDotScale.y / 6f) * Plugin.Config.GlowScale, 0.0001f); + } + else + { + dotPosition = new Vector3(_initialDotPosition.x + Plugin.Config.DotPosition.x, _initialDotPosition.y + Plugin.Config.DotPosition.y, _initialDotPosition.z); + glowPosition = new Vector3(_initialDotPosition.x + Plugin.Config.DotPosition.x, _initialDotPosition.y + Plugin.Config.DotPosition.y, _initialDotPosition.z + 0.001f); + dotScale = new Vector3(Plugin.Config.DotScale.x / 5f, Plugin.Config.DotScale.y / 5f, 0.0001f); + glowScale = new Vector3((Plugin.Config.DotScale.x / 1.5f) * Plugin.Config.GlowScale, (Plugin.Config.DotScale.y / 1.5f) * Plugin.Config.GlowScale, 0.0001f); + } - Vector3 dotPosition = new Vector3(_initialDotPosition.x + Plugin.Config.DotPosition.x, _initialDotPosition.y + Plugin.Config.DotPosition.y, _initialDotPosition.z - 0.1f); - Vector3 glowPosition = new Vector3(_initialDotPosition.x + Plugin.Config.DotPosition.x, _initialDotPosition.y + Plugin.Config.DotPosition.y, _initialDotPosition.z - 0.101f); - Vector3 dotScale = new Vector3(Plugin.Config.DotScale.x / 5f, Plugin.Config.DotScale.y / 5f, 0.0001f); - Vector3 glowScale = new Vector3((Plugin.Config.DotScale.x / 1.5f) * Plugin.Config.GlowScale, (Plugin.Config.DotScale.y / 1.5f) * Plugin.Config.GlowScale, 0.0001f); - - Transform originalDot = meshRenderer.transform.parent.Find("NoteCircleGlow"); + Transform originalDot = isChainLink ? meshRenderer.transform.parent.Find("Circle") : meshRenderer.transform.parent.Find("NoteCircleGlow"); if (originalDot) { - originalDot.gameObject.SetActive(Plugin.Config.EnableDots); + if (isChainLink) + { + originalDot.gameObject.SetActive(Plugin.Config.EnableChainDots); - if (!Plugin.Config.EnableDots) + if (!Plugin.Config.EnableChainDots) + { + continue; + } + } + else { - continue; + originalDot.gameObject.SetActive(Plugin.Config.EnableDots); + + if (!Plugin.Config.EnableDots) + { + continue; + } } Transform originalDotTransform = originalDot.transform; @@ -194,6 +225,11 @@ internal static void Postfix(ColorNoteVisuals __instance, ref MeshRenderer[] ___ _initialDotPositionDidSet = true; _initialDotPosition = originalDotTransform.localPosition; } + if (!_initialChainDotPositionDidSet) + { + _initialChainDotPositionDidSet = true; + _initialChainDotPosition = originalDotTransform.localPosition; + } originalDotTransform.localScale = dotScale; originalDotTransform.localPosition = dotPosition; @@ -208,9 +244,19 @@ internal static void Postfix(ColorNoteVisuals __instance, ref MeshRenderer[] ___ meshRenderer.material = _replacementDotMaterial; meshRenderer.sharedMaterial = _replacementDotMaterial; - if (!Plugin.Config.EnableFaceGlow) + if (isChainLink) + { + if (!Plugin.Config.EnableChainDotGlow) + { + continue; + } + } + else { - continue; + if (!Plugin.Config.EnableFaceGlow) + { + continue; + } } GameObject newGlowObject = Object.Instantiate(originalDot.gameObject, originalDot.parent).gameObject; diff --git a/NoteTweaks/UI/BSML/Settings.bsml b/NoteTweaks/UI/BSML/Settings.bsml index 6062875..2c2fc80 100644 --- a/NoteTweaks/UI/BSML/Settings.bsml +++ b/NoteTweaks/UI/BSML/Settings.bsml @@ -13,9 +13,6 @@ - @@ -65,6 +62,23 @@ + + + + + + + + + diff --git a/NoteTweaks/UI/SettingsViewController.cs b/NoteTweaks/UI/SettingsViewController.cs index 40e8f1a..5a7dfcd 100644 --- a/NoteTweaks/UI/SettingsViewController.cs +++ b/NoteTweaks/UI/SettingsViewController.cs @@ -188,5 +188,38 @@ protected float GlowIntensity get => _config.GlowIntensity; set => _config.GlowIntensity = value; } + + protected bool EnableChainDots + { + get => _config.EnableChainDots; + set => _config.EnableChainDots = value; + } + protected float ChainDotScaleX + { + get => _config.ChainDotScale.x; + set + { + Vector3 scale = _config.ChainDotScale; + scale.x = value; + _config.ChainDotScale = scale; + } + } + + protected float ChainDotScaleY + { + get => _config.ChainDotScale.y; + set + { + Vector3 scale = _config.ChainDotScale; + scale.y = value; + _config.ChainDotScale = scale; + } + } + + protected bool EnableChainDotGlow + { + get => _config.EnableChainDotGlow; + set => _config.EnableChainDotGlow = value; + } } } \ No newline at end of file