debugging spiral prototype changing

This commit is contained in:
FreezeDriedMangoes 2022-06-13 22:23:06 -04:00
parent 18e77c4c7a
commit e1dafe2db0
3 changed files with 43 additions and 22 deletions

View File

@ -307,12 +307,18 @@ namespace NewHorizons.Builder.Props
return nomaiWallText; return nomaiWallText;
} }
private static void BuildArcs(string xml, NomaiWallText nomaiWallText, GameObject conversationZone, PropModule.NomaiTextInfo info) internal static void BuildArcs(string xml, NomaiWallText nomaiWallText, GameObject conversationZone, PropModule.NomaiTextInfo info)
{ {
var dict = MakeNomaiTextDict(xml); var dict = MakeNomaiTextDict(xml);
nomaiWallText._dictNomaiTextData = dict; nomaiWallText._dictNomaiTextData = dict;
RefreshArcs(nomaiWallText, conversationZone, info);
}
internal static void RefreshArcs(NomaiWallText nomaiWallText, GameObject conversationZone, PropModule.NomaiTextInfo info)
{
var dict = nomaiWallText._dictNomaiTextData;
Random.InitState(info.seed); Random.InitState(info.seed);
var arcsByID = new Dictionary<int, GameObject>(); var arcsByID = new Dictionary<int, GameObject>();

View File

@ -20,7 +20,7 @@ namespace NewHorizons.External.Modules
public QuantumGroupInfo[] quantumGroups; public QuantumGroupInfo[] quantumGroups;
public enum QuantumGroupType { "sockets" = 0; "states" = 1 } public enum QuantumGroupType { sockets = 0, states = 1 }
public class QuantumGroupInfo { QuantumGroupType type; string id; QuantumSocketInfo[] sockets; } // QuantumSocketInfo is only used for type = "sockets" public class QuantumGroupInfo { QuantumGroupType type; string id; QuantumSocketInfo[] sockets; } // QuantumSocketInfo is only used for type = "sockets"
class QuantumSocketInfo { MVector3 position; MVector3 rotation; float probability; } class QuantumSocketInfo { MVector3 position; MVector3 rotation; float probability; }

View File

@ -245,26 +245,26 @@ namespace NewHorizons.Utility.DebugMenu
GUILayout.Label("Spiral"); GUILayout.Label("Spiral");
// TODO: implement disabled feature: change spiral type and variation // TODO: implement disabled feature: change spiral type and variation
//GUILayout.Label("Type"); GUILayout.Label("Type");
// GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
// GUI.enabled = spiralMeta.spiral.type != NomaiTextArcInfo.NomaiTextArcType.Adult; GUI.enabled = spiralMeta.spiral.type != NomaiTextArcInfo.NomaiTextArcType.Adult;
// if (GUILayout.Button("Adult")) { spiralMeta.spiral.type = NomaiTextArcInfo.NomaiTextArcType.Adult; changed = true; } if (GUILayout.Button("Adult")) { spiralMeta.spiral.type = NomaiTextArcInfo.NomaiTextArcType.Adult; changed = true; }
// GUI.enabled = spiralMeta.spiral.type != NomaiTextArcInfo.NomaiTextArcType.Child; GUI.enabled = spiralMeta.spiral.type != NomaiTextArcInfo.NomaiTextArcType.Child;
// if (GUILayout.Button("Child")) { spiralMeta.spiral.type = NomaiTextArcInfo.NomaiTextArcType.Child; changed = true; } if (GUILayout.Button("Child")) { spiralMeta.spiral.type = NomaiTextArcInfo.NomaiTextArcType.Child; changed = true; }
// GUI.enabled = spiralMeta.spiral.type != NomaiTextArcInfo.NomaiTextArcType.Stranger; GUI.enabled = spiralMeta.spiral.type != NomaiTextArcInfo.NomaiTextArcType.Stranger;
// if (GUILayout.Button("Stranger")) { spiralMeta.spiral.type = NomaiTextArcInfo.NomaiTextArcType.Stranger; changed = true; } if (GUILayout.Button("Stranger")) { spiralMeta.spiral.type = NomaiTextArcInfo.NomaiTextArcType.Stranger; changed = true; }
// GUI.enabled = true; GUI.enabled = true;
// GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
//GUILayout.Label("Variation"); GUILayout.Label("Variation");
// GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
// var varietyCount = GetVarietyCountForType(spiralMeta.spiral.type); var varietyCount = GetVarietyCountForType(spiralMeta.spiral.type);
// if (GUILayout.Button("Reroll variation")) var newVariation = int.Parse(GUILayout.TextField(spiralMeta.spiral.variation+""));
// { newVariation = Mathf.Min(Mathf.Max(0, newVariation), varietyCount);
// spiralMeta.spiral.variation = UnityEngine.Random.Range(0, varietyCount); if (newVariation != spiralMeta.spiral.variation) changed = true;
// } spiralMeta.spiral.variation = newVariation;
// GUI.enabled = true; GUI.enabled = true;
// GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
// TODO: debug disabled feature: place spiral point on parent // TODO: debug disabled feature: place spiral point on parent
@ -346,9 +346,24 @@ namespace NewHorizons.Utility.DebugMenu
// cache required stuff, destroy spiralMeta.go, call NomaiTextBuilder.MakeArc using spiralMeta.spiral and cached stuff // cache required stuff, destroy spiralMeta.go, call NomaiTextBuilder.MakeArc using spiralMeta.spiral and cached stuff
// PropModule.NomaiTextArcInfo arcInfo, GameObject conversationZone, GameObject parent, int textEntryID, int i // PropModule.NomaiTextArcInfo arcInfo, GameObject conversationZone, GameObject parent, int textEntryID, int i
var conversationZone = spiralMeta.spiralGo.transform.parent.gameObject; var conversationZone = spiralMeta.spiralGo.transform.parent.gameObject;
var textEntryId = spiralMeta.spiralGo.GetComponent<NomaiTextLine>()._entryID; var wallTextComponent = conversationZone.GetComponent<NomaiWallText>();
var oldTextLineComponent = spiralMeta.spiralGo.GetComponent<NomaiTextLine>();
var indexInParent = 0;
for (indexInParent = 0; indexInParent < wallTextComponent._textLines.Length; indexInParent++) if (oldTextLineComponent == wallTextComponent._textLines[indexInParent]) break;
var textEntryId = oldTextLineComponent._entryID;
GameObject.Destroy(spiralMeta.spiralGo); GameObject.Destroy(spiralMeta.spiralGo);
spiralMeta.spiralGo = NomaiTextBuilder.MakeArc(spiralMeta.spiral, conversationZone, null, textEntryId); spiralMeta.spiralGo = NomaiTextBuilder.MakeArc(spiralMeta.spiral, conversationZone, null, textEntryId);
wallTextComponent._textLines[indexInParent] = spiralMeta.spiralGo.GetComponent<NomaiTextLine>();
spiralMeta.spiralGo.name = "Brandnewspiral";
var s = AddDebugShape.AddSphere(wallTextComponent._sector.gameObject, 0.1f, Color.green);
s.transform.localPosition = wallTextComponent._sector.transform.InverseTransformPoint(spiralMeta.spiralGo.transform.position);
//var conversationZone = spiralMeta.spiralGo.transform.parent.gameObject;
//var wallTextComponent = conversationZone.GetComponent<NomaiWallText>();
//foreach(NomaiTextLine l in wallTextComponent._textLines) GameObject.Destroy(l.gameObject);
//NomaiTextBuilder.RefreshArcs(wallTextComponent, conversationZone, spiralMeta.conversation);
} }
GUILayout.Space(10); GUILayout.Space(10);