Fix Stranger Text Misalignment #924

This commit is contained in:
xen-42 2024-10-04 17:24:32 -04:00
parent dd78f62f33
commit 3de8dabe12
2 changed files with 59 additions and 6 deletions

View File

@ -1,3 +1,4 @@
using NewHorizons.Utility.OWML;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
@ -37,7 +38,6 @@ namespace NewHorizons.Builder.Props.TranslatorText
) )
.ToArray(); .ToArray();
return BuildSpiralGameObject(_points, mesh, goName); return BuildSpiralGameObject(_points, mesh, goName);
} }
@ -67,15 +67,52 @@ namespace NewHorizons.Builder.Props.TranslatorText
public struct SpiralProfile { public struct SpiralProfile {
// all of the Vector2 params here refer to a range of valid values // all of the Vector2 params here refer to a range of valid values
public string profileName; public string profileName;
/// <summary>
/// What is this
/// </summary>
public Vector2 a; public Vector2 a;
/// <summary>
/// What is this
/// </summary>
public Vector2 b; public Vector2 b;
/// <summary>
/// What is this
/// </summary>
public Vector2 startS; public Vector2 startS;
/// <summary>
/// What is this
/// </summary>
public Vector2 endS; public Vector2 endS;
/// <summary>
/// What is this
/// </summary>
public Vector2 skeletonScale; public Vector2 skeletonScale;
/// <summary>
/// What is this
/// </summary>
public int numSkeletonPoints; public int numSkeletonPoints;
/// <summary>
/// What is this
/// </summary>
public float uvScale; public float uvScale;
public float innerWidth; // width at the tip
public float outerWidth; // width at the base /// <summary>
/// Width at tip
/// </summary>
public float innerWidth;
/// <summary>
/// Width at base
/// </summary>
public float outerWidth;
public Material material; public Material material;
} }
@ -119,8 +156,6 @@ namespace NewHorizons.Builder.Props.TranslatorText
innerWidth = 0.75f, innerWidth = 0.75f,
outerWidth = 0.75f, outerWidth = 0.75f,
uvScale = 1f/1.8505f, uvScale = 1f/1.8505f,
}; };

View File

@ -583,7 +583,12 @@ namespace NewHorizons.Builder.Props.TranslatorText
case NomaiTextArcInfo.NomaiTextArcType.Stranger when _ghostArcMaterial != null: case NomaiTextArcInfo.NomaiTextArcType.Stranger when _ghostArcMaterial != null:
profile = NomaiTextArcBuilder.strangerSpiralProfile; profile = NomaiTextArcBuilder.strangerSpiralProfile;
mat = _ghostArcMaterial; mat = _ghostArcMaterial;
overrideMesh = MeshUtilities.RectangleMeshFromCorners(new Vector3[]{ new Vector3(-0.9f, 0.0f, 0.0f), new Vector3(0.9f, 0.0f, 0.0f), new Vector3(-0.9f, 2.0f, 0.0f), new Vector3(0.9f, 2.0f, 0.0f) }); overrideMesh = MeshUtilities.RectangleMeshFromCorners(new Vector3[]{
new Vector3(-0.9f, 0.0f, 0.0f),
new Vector3(0.9f, 0.0f, 0.0f),
new Vector3(-0.9f, 2.0f, 0.0f),
new Vector3(0.9f, 2.0f, 0.0f)
});
overrideColor = new Color(0.0158f, 1.0f, 0.5601f, 1f); overrideColor = new Color(0.0158f, 1.0f, 0.5601f, 1f);
break; break;
case NomaiTextArcInfo.NomaiTextArcType.Adult: case NomaiTextArcInfo.NomaiTextArcType.Adult:
@ -603,6 +608,19 @@ namespace NewHorizons.Builder.Props.TranslatorText
else arc = NomaiTextArcArranger.CreateSpiral(profile, conversationZone).gameObject; else arc = NomaiTextArcArranger.CreateSpiral(profile, conversationZone).gameObject;
} }
// Hardcoded stranger point fix
if (type == NomaiTextArcInfo.NomaiTextArcType.Stranger)
{
Delay.FireOnNextUpdate(() =>
{
var text = arc.GetComponent<NomaiTextLine>();
for (int i = 0; i < text._points.Length; i++)
{
text._points[i] = new Vector3(0f, 2f * i / text._points.Length, 0f);
}
});
}
if (mat != null) arc.GetComponent<MeshRenderer>().sharedMaterial = mat; if (mat != null) arc.GetComponent<MeshRenderer>().sharedMaterial = mat;
arc.transform.parent = conversationZone.transform; arc.transform.parent = conversationZone.transform;