File tree 5 files changed +1788
-0
lines changed
5 files changed +1788
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ public static void Postfix()
91
91
Vocabulary . keyWords = ApplyLocalization ( Vocabulary . keyWords ) ;
92
92
Vocabulary . keyWordsExp = ApplyLocalization ( Vocabulary . keyWordsExp ) ;
93
93
Vocabulary . categoryToStr = ApplyLocalization ( Vocabulary . categoryToStr ) ;
94
+ Vocabulary . VrbToStr = ApplyLocalization ( Vocabulary . VrbToStr ) ;
95
+ Vocabulary . AuxToStr = ApplyLocalization ( Vocabulary . AuxToStr ) ;
94
96
}
95
97
96
98
var fi = AccessTools . Field ( typeof ( GameProgress ) , "values" ) ;
@@ -128,6 +130,24 @@ public static void Postfix(ref string __result)
128
130
}
129
131
}
130
132
}
133
+
134
+ [ HarmonyPatch ( typeof ( Lang ) , nameof ( Lang . LoadResource ) ) ]
135
+ public static class LangFix2
136
+ {
137
+ public static void Postfix ( )
138
+ {
139
+ var fi = AccessTools . Field ( typeof ( Lang ) , "dictionary" ) ;
140
+ var val = fi . GetValue ( null ) as Dictionary < string , string > ;
141
+ if ( val == null )
142
+ {
143
+ Logger . Error ( $ "Failed to Get Field dictionary") ;
144
+ }
145
+ foreach ( var ele in TranslationDB . VocabularyInfo2 )
146
+ {
147
+ val [ ele . Key ] = ele . Value ;
148
+ }
149
+ }
150
+ }
131
151
132
152
[ HarmonyPatch ( typeof ( PlayableCharacter ) , nameof ( PlayableCharacter . LoadResource ) ) ]
133
153
public static class CharacterFix
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ public static class TranslationDB
12
12
public static Dictionary < string , TranslationItem > CardInfo = null ;
13
13
public static Dictionary < string , TranslationItem > EnchantInfo = null ;
14
14
public static Dictionary < string , string > VocabularyInfo = null ;
15
+ public static Dictionary < string , string > VocabularyInfo2 = null ;
15
16
public static Dictionary < string , string > ScenarioInfo = null ;
16
17
public static Dictionary < string , TranslationItem > LangDescription = null ;
17
18
public static Dictionary < string , string > EntityInfo = null ;
@@ -139,6 +140,26 @@ public static void Init()
139
140
140
141
EntityInfo = dst ;
141
142
}
143
+
144
+ {
145
+ // 读取 JSON 文件内容
146
+ string jsonContent = File . ReadAllText (
147
+ Path . Join ( modPath , "vocabulary2_translated.json" ) ) ;
148
+
149
+ // 反序列化 JSON 字符串为 TranslationItem 结构体的列表
150
+ var items = JsonConvert . DeserializeObject < List < TranslationItem > > ( jsonContent ) ;
151
+ var dst = new Dictionary < string , string > ( ) ;
152
+ foreach ( var item in items )
153
+ {
154
+ if ( ! dst . TryAdd ( item . Key , item . Translation ) )
155
+ {
156
+ Logger . Log ( $ "Find Duplicated Item { item . Key } { item . Original } , content { item . Translation } ") ;
157
+ continue ;
158
+ }
159
+ }
160
+
161
+ VocabularyInfo2 = dst ;
162
+ }
142
163
}
143
164
144
165
You can’t perform that action at this time.
0 commit comments