From 200933d41d7e188d78b7dec5e6222d7be96a36d9 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Fri, 29 Jul 2022 12:26:08 -0400 Subject: [PATCH] Add location to nomai text info --- NewHorizons/Builder/Props/NomaiTextBuilder.cs | 8 ++++++++ NewHorizons/External/Modules/PropModule.cs | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/NomaiTextBuilder.cs b/NewHorizons/Builder/Props/NomaiTextBuilder.cs index bc6da1a6..55514704 100644 --- a/NewHorizons/Builder/Props/NomaiTextBuilder.cs +++ b/NewHorizons/Builder/Props/NomaiTextBuilder.cs @@ -2,6 +2,7 @@ using NewHorizons.External.Modules; using NewHorizons.Handlers; using NewHorizons.Utility; using OWML.Common; +using Enum = System.Enum; using System.Collections.Generic; using System.IO; using System.Linq; @@ -259,6 +260,7 @@ namespace NewHorizons.Builder.Props var computer = computerObject.GetComponent(); 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._nomaiTextAsset = new TextAsset(xmlPath); computer._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile); @@ -305,6 +307,7 @@ namespace NewHorizons.Builder.Props var computer = computerObject.GetComponent(); 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._nomaiTextAsset = new TextAsset(xmlPath); 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.SetSector(sector); + nomaiWallText._location = (NomaiText.Location)Enum.Parse(typeof(NomaiText.Location), Enum.GetName(typeof(PropModule.NomaiTextInfo.NomaiTextLocation), info.location)); nomaiWallText._dictNomaiTextData = MakeNomaiTextDict(xmlPath); nomaiWallText._nomaiTextAsset = new TextAsset(xmlPath); nomaiWallText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile); @@ -431,6 +435,7 @@ namespace NewHorizons.Builder.Props var nomaiText = recorderObject.GetComponentInChildren(); 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._nomaiTextAsset = new TextAsset(xmlPath); nomaiText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile); @@ -463,8 +468,11 @@ namespace NewHorizons.Builder.Props box.isTrigger = true; nomaiWallTextObj.AddComponent(); + var nomaiWallText = nomaiWallTextObj.AddComponent(); + nomaiWallText._location = (NomaiText.Location)Enum.Parse(typeof(NomaiText.Location), Enum.GetName(typeof(PropModule.NomaiTextInfo.NomaiTextLocation), info.location)); + var text = new TextAsset(xmlPath); // Text assets need a name to be used with VoiceMod diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 70454a8f..5b56fc5b 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -476,12 +476,22 @@ namespace NewHorizons.External.Modules [EnumMember(Value = @"cairn")] Cairn = 3, [EnumMember(Value = @"recorder")] Recorder = 4, - + [EnumMember(Value = @"preCrashRecorder")] PreCrashRecorder = 5, [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 + } + /// /// Additional information about each arc in the text /// @@ -513,6 +523,11 @@ namespace NewHorizons.External.Modules /// [DefaultValue("wall")] public NomaiTextType type = NomaiTextType.Wall; + /// + /// The location of this object. + /// + [DefaultValue("unspecified")] public NomaiTextLocation location = NomaiTextLocation.UNSPECIFIED; + /// /// The relative path to the xml file for this object. ///