11using Aarthificial . Typewriter ;
22using Aarthificial . Typewriter . Blackboards ;
3- using Aarthificial . Typewriter . Editor . Common ;
4- using Aarthificial . Typewriter . Editor . Localization ;
53using Aarthificial . Typewriter . Entries ;
64using Aarthificial . Typewriter . References ;
75using Interactions ;
86using System ;
97using System . Collections . Generic ;
108using System . Text ;
119using Typewriter ;
12- using UnityEditor . Localization ;
1310using UnityEngine ;
14- using UnityEngine . Localization ;
1511using Object = UnityEngine . Object ;
1612
1713namespace Editor . Typewriter {
@@ -51,7 +47,6 @@ public ParsingException(string message, ParsingContext context) : base(
5147 private static readonly List < BlackboardCriterion > _criteria = new ( ) ;
5248 private static readonly List < BlackboardModification > _modifications = new ( ) ;
5349 private static readonly HashSet < int > _convertedIds = new ( ) ;
54- private static StringTableCollection _collection ;
5550
5651 public static void Convert (
5752 DatabaseTable table ,
@@ -64,17 +59,17 @@ Object context
6459 _lookup . Clear ( ) ;
6560
6661 foreach ( var entry in table . Facts ) {
67- _lookup . Add ( entry . GetKey ( ) , ( EntryReference ) entry ) ;
62+ _lookup . Add ( entry . Key , ( EntryReference ) entry ) ;
6863 }
6964 foreach ( var entry in table . Rules ) {
70- _lookup . Add ( entry . GetKey ( ) , ( EntryReference ) entry ) ;
65+ _lookup . Add ( entry . Key , ( EntryReference ) entry ) ;
7166 }
7267 foreach ( var entry in table . Events ) {
73- _lookup . Add ( entry . GetKey ( ) , ( EntryReference ) entry ) ;
68+ _lookup . Add ( entry . Key , ( EntryReference ) entry ) ;
7469 }
7570
76- _collection =
77- LocalizationEditorSettings . GetStringTableCollection ( "Dialogue" ) ;
71+ // _collection =
72+ // LocalizationEditorSettings.GetStringTableCollection("Dialogue");
7873
7974 _lookup . Add ( "LT" , InteractionContext . LT ) ;
8075 _lookup . Add ( "RT" , InteractionContext . RT ) ;
@@ -89,6 +84,10 @@ Object context
8984 BaseEntry previous = null ;
9085 for ( var i = 1 ; i < rows . Count ; i ++ ) {
9186 var cells = rows [ i ] . Cells ;
87+ if ( cells . Key ( ) == "" ) {
88+ continue ;
89+ }
90+
9291 Type type ;
9392 switch ( cells . Type ( ) ) {
9493 case "event" :
@@ -107,7 +106,7 @@ Object context
107106 type = typeof ( FactEntry ) ;
108107 break ;
109108 default :
110- Debug . LogError ( $ "Unknown type { cells . Type ( ) } ", context ) ;
109+ Debug . LogError ( $ "Row { i + 1 } : Unknown type { cells . Type ( ) } ", context ) ;
111110 continue ;
112111 }
113112
@@ -139,10 +138,15 @@ Object context
139138
140139 for ( var i = 1 ; i < rows . Count ; i ++ ) {
141140 var cells = rows [ i ] . Cells ;
141+ if ( cells . Key ( ) == "" ) {
142+ previous = null ;
143+ continue ;
144+ }
145+
142146 try {
143147 switch ( cells . Type ( ) ) {
144148 case "fact" :
145- previous = CreateFactEntry ( cells , previous ) ;
149+ CreateFactEntry ( cells , previous ) ;
146150 break ;
147151 case "event" :
148152 previous = CreateEventEntry ( cells , previous ) ;
@@ -242,6 +246,7 @@ BaseEntry previous
242246 throw new Exception ( $ "Missing speaker { cells . Speaker ( ) } .") ;
243247 }
244248
249+ /* TODO: Switch to localized strings later
245250 var textEntry = _collection.StringTables[0].GetEntry(entry.Key);
246251 long textId;
247252 if (textEntry == null) {
@@ -262,6 +267,8 @@ BaseEntry previous
262267 _collection.SharedData.TableCollectionName,
263268 textId
264269 );
270+ */
271+ entry . Content = cells . Text ( ) ;
265272
266273 if ( cells . Actions ( ) != "" ) {
267274 _events . Clear ( ) ;
@@ -569,16 +576,15 @@ private static string GetErrorFrame(ParsingContext context) {
569576 }
570577
571578 private static string Key ( this List < string > list ) => list [ 0 ] ;
572- private static string Type ( this List < string > list ) => list [ 1 ] ;
573- private static string Speaker ( this List < string > list ) => list [ 2 ] ;
574- private static bool Once ( this List < string > list ) => list [ 3 ] == "TRUE" ;
575-
576- private static bool Cancel ( this List < string > list ) => list [ 4 ] == "TRUE" ;
577- private static string Text ( this List < string > list ) => list [ 5 ] ;
578- private static string Triggers ( this List < string > list ) => list [ 6 ] ;
579- private static string Criteria ( this List < string > list ) => list [ 7 ] ;
580- private static string Modifications ( this List < string > list ) => list [ 8 ] ;
581- private static string Padding ( this List < string > list ) => list [ 9 ] ;
582- private static string Actions ( this List < string > list ) => list [ 11 ] ;
579+ private static string Type ( this List < string > list ) => list [ 2 ] ;
580+ private static string Speaker ( this List < string > list ) => list [ 3 ] ;
581+ private static bool Once ( this List < string > list ) => list [ 4 ] == "TRUE" ;
582+ private static bool Cancel ( this List < string > list ) => list [ 5 ] == "TRUE" ;
583+ private static string Text ( this List < string > list ) => list [ 6 ] ;
584+ private static string Triggers ( this List < string > list ) => list [ 7 ] ;
585+ private static string Criteria ( this List < string > list ) => list [ 8 ] ;
586+ private static string Modifications ( this List < string > list ) => list [ 9 ] ;
587+ private static string Padding ( this List < string > list ) => list [ 10 ] ;
588+ private static string Actions ( this List < string > list ) => list [ 12 ] ;
583589 }
584590}
0 commit comments