Add location to nomai text info

This commit is contained in:
Noah Pilarski 2022-07-29 12:26:08 -04:00
parent 24c43ae747
commit 200933d41d
2 changed files with 24 additions and 1 deletions

View File

@ -2,6 +2,7 @@ using NewHorizons.External.Modules;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using Enum = System.Enum;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -259,6 +260,7 @@ namespace NewHorizons.Builder.Props
var computer = computerObject.GetComponent<NomaiComputer>(); var computer = computerObject.GetComponent<NomaiComputer>();
computer.SetSector(sector); computer.SetSector(sector);
computer._location = (NomaiText.Location)Enum.Parse(typeof(NomaiText.Location), Enum.GetName(typeof(PropModule.NomaiTextInfo.NomaiTextLocation), info.location));
computer._dictNomaiTextData = MakeNomaiTextDict(xmlPath); computer._dictNomaiTextData = MakeNomaiTextDict(xmlPath);
computer._nomaiTextAsset = new TextAsset(xmlPath); computer._nomaiTextAsset = new TextAsset(xmlPath);
computer._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile); computer._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile);
@ -305,6 +307,7 @@ namespace NewHorizons.Builder.Props
var computer = computerObject.GetComponent<NomaiVesselComputer>(); var computer = computerObject.GetComponent<NomaiVesselComputer>();
computer.SetSector(sector); computer.SetSector(sector);
computer._location = (NomaiText.Location)Enum.Parse(typeof(NomaiText.Location), Enum.GetName(typeof(PropModule.NomaiTextInfo.NomaiTextLocation), info.location));
computer._dictNomaiTextData = MakeNomaiTextDict(xmlPath); computer._dictNomaiTextData = MakeNomaiTextDict(xmlPath);
computer._nomaiTextAsset = new TextAsset(xmlPath); computer._nomaiTextAsset = new TextAsset(xmlPath);
computer._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile); computer._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile);
@ -380,6 +383,7 @@ namespace NewHorizons.Builder.Props
var nomaiWallText = cairnObject.transform.Find("Props_TH_ClutterSmall/Arc_Short").GetComponent<NomaiWallText>(); var nomaiWallText = cairnObject.transform.Find("Props_TH_ClutterSmall/Arc_Short").GetComponent<NomaiWallText>();
nomaiWallText.SetSector(sector); nomaiWallText.SetSector(sector);
nomaiWallText._location = (NomaiText.Location)Enum.Parse(typeof(NomaiText.Location), Enum.GetName(typeof(PropModule.NomaiTextInfo.NomaiTextLocation), info.location));
nomaiWallText._dictNomaiTextData = MakeNomaiTextDict(xmlPath); nomaiWallText._dictNomaiTextData = MakeNomaiTextDict(xmlPath);
nomaiWallText._nomaiTextAsset = new TextAsset(xmlPath); nomaiWallText._nomaiTextAsset = new TextAsset(xmlPath);
nomaiWallText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile); nomaiWallText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile);
@ -431,6 +435,7 @@ namespace NewHorizons.Builder.Props
var nomaiText = recorderObject.GetComponentInChildren<NomaiText>(); var nomaiText = recorderObject.GetComponentInChildren<NomaiText>();
nomaiText.SetSector(sector); nomaiText.SetSector(sector);
nomaiText._location = (NomaiText.Location)Enum.Parse(typeof(NomaiText.Location), Enum.GetName(typeof(PropModule.NomaiTextInfo.NomaiTextLocation), info.location));
nomaiText._dictNomaiTextData = MakeNomaiTextDict(xmlPath); nomaiText._dictNomaiTextData = MakeNomaiTextDict(xmlPath);
nomaiText._nomaiTextAsset = new TextAsset(xmlPath); nomaiText._nomaiTextAsset = new TextAsset(xmlPath);
nomaiText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile); nomaiText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile);
@ -463,8 +468,11 @@ namespace NewHorizons.Builder.Props
box.isTrigger = true; box.isTrigger = true;
nomaiWallTextObj.AddComponent<OWCollider>(); nomaiWallTextObj.AddComponent<OWCollider>();
var nomaiWallText = nomaiWallTextObj.AddComponent<NomaiWallText>(); var nomaiWallText = nomaiWallTextObj.AddComponent<NomaiWallText>();
nomaiWallText._location = (NomaiText.Location)Enum.Parse(typeof(NomaiText.Location), Enum.GetName(typeof(PropModule.NomaiTextInfo.NomaiTextLocation), info.location));
var text = new TextAsset(xmlPath); var text = new TextAsset(xmlPath);
// Text assets need a name to be used with VoiceMod // Text assets need a name to be used with VoiceMod

View File

@ -476,12 +476,22 @@ namespace NewHorizons.External.Modules
[EnumMember(Value = @"cairn")] Cairn = 3, [EnumMember(Value = @"cairn")] Cairn = 3,
[EnumMember(Value = @"recorder")] Recorder = 4, [EnumMember(Value = @"recorder")] Recorder = 4,
[EnumMember(Value = @"preCrashRecorder")] PreCrashRecorder = 5, [EnumMember(Value = @"preCrashRecorder")] PreCrashRecorder = 5,
[EnumMember(Value = @"preCrashComputer")] PreCrashComputer = 6 [EnumMember(Value = @"preCrashComputer")] PreCrashComputer = 6
} }
[JsonConverter(typeof(StringEnumConverter))]
public enum NomaiTextLocation
{
[EnumMember(Value = @"unspecified")] UNSPECIFIED = 0,
[EnumMember(Value = @"a")] A = 1,
[EnumMember(Value = @"b")] B = 2
}
/// <summary> /// <summary>
/// Additional information about each arc in the text /// Additional information about each arc in the text
/// </summary> /// </summary>
@ -513,6 +523,11 @@ namespace NewHorizons.External.Modules
/// </summary> /// </summary>
[DefaultValue("wall")] public NomaiTextType type = NomaiTextType.Wall; [DefaultValue("wall")] public NomaiTextType type = NomaiTextType.Wall;
/// <summary>
/// The location of this object.
/// </summary>
[DefaultValue("unspecified")] public NomaiTextLocation location = NomaiTextLocation.UNSPECIFIED;
/// <summary> /// <summary>
/// The relative path to the xml file for this object. /// The relative path to the xml file for this object.
/// </summary> /// </summary>