1616namespace VModer . Core . Services . GameResource ;
1717
1818public sealed class GeneralTraitsService
19- : CommonResourcesService < GeneralTraitsService , FrozenDictionary < string , CharacterTrait > >
19+ : CommonResourcesService < GeneralTraitsService , FrozenDictionary < string , GeneralTrait > >
2020{
2121 private readonly LocalizationFormatService _localizationFormatService ;
2222 private readonly ModifierDisplayService _modifierDisplayService ;
2323 private readonly GameResourcesPathService _gameResourcesPathService ;
2424 private readonly ModifierService _modifierService ;
25- private ICollection < FrozenDictionary < string , CharacterTrait > > Traits => Resources . Values ;
25+ private ICollection < FrozenDictionary < string , GeneralTrait > > Traits => Resources . Values ;
2626
2727 /// <summary>
2828 /// 特质修饰符节点名称
@@ -105,15 +105,15 @@ public List<TraitDto> GetAllTraitDto()
105105 return traits ;
106106 }
107107
108- public IEnumerable < string > GetModifiersDescription ( CharacterTrait trait )
108+ public IEnumerable < string > GetModifiersDescription ( GeneralTrait trait )
109109 {
110110 var descriptions = new List < string > ( 8 ) ;
111111
112112 foreach ( var modifierCollection in trait . ModifiersCollection )
113113 {
114114 if (
115115 modifierCollection . Key . Equals (
116- CharacterTrait . TraitXpFactor ,
116+ GeneralTrait . TraitXpFactor ,
117117 StringComparison . OrdinalIgnoreCase
118118 )
119119 )
@@ -135,7 +135,7 @@ public IEnumerable<string> GetModifiersDescription(CharacterTrait trait)
135135 return descriptions ;
136136 }
137137
138- public bool TryGetTrait ( string name , [ NotNullWhen ( true ) ] out CharacterTrait ? trait )
138+ public bool TryGetTrait ( string name , [ NotNullWhen ( true ) ] out GeneralTrait ? trait )
139139 {
140140 foreach ( var traitMap in Traits )
141141 {
@@ -149,12 +149,12 @@ public bool TryGetTrait(string name, [NotNullWhen(true)] out CharacterTrait? tra
149149 return false ;
150150 }
151151
152- private string GetLocalizationName ( CharacterTrait characterTrait )
152+ private string GetLocalizationName ( GeneralTrait generalTrait )
153153 {
154- return _localizationFormatService . GetFormatText ( characterTrait . Name ) ;
154+ return _localizationFormatService . GetFormatText ( generalTrait . Name ) ;
155155 }
156156
157- protected override FrozenDictionary < string , CharacterTrait > ? ParseFileToContent ( Node rootNode )
157+ protected override FrozenDictionary < string , GeneralTrait > ? ParseFileToContent ( Node rootNode )
158158 {
159159 // Character Traits 和 技能等级修正 在同一个文件夹中, 这里我们只处理 Character Traits 文件
160160 var traitsNodes = Array . FindAll (
@@ -170,7 +170,7 @@ private string GetLocalizationName(CharacterTrait characterTrait)
170170 }
171171
172172 // 在 1.14 版本中, 人物特质文件中大约有 145 个特质
173- var dictionary = new Dictionary < string , CharacterTrait > ( 163 , StringComparer . OrdinalIgnoreCase ) ;
173+ var dictionary = new Dictionary < string , GeneralTrait > ( 163 , StringComparer . OrdinalIgnoreCase ) ;
174174 foreach ( var traitsChild in traitsNodes )
175175 {
176176 traitsChild . TryGetNode ( out var traitsNode ) ;
@@ -189,9 +189,9 @@ private string GetLocalizationName(CharacterTrait characterTrait)
189189 /// </summary>
190190 /// <param name="traitsNode">文件中的 leader_traits 节点</param>
191191 /// <returns></returns>
192- private ReadOnlySpan < CharacterTrait > ParseTraitsNode ( Node traitsNode )
192+ private ReadOnlySpan < GeneralTrait > ParseTraitsNode ( Node traitsNode )
193193 {
194- var traits = new List < CharacterTrait > ( traitsNode . AllArray . Length ) ;
194+ var traits = new List < GeneralTrait > ( traitsNode . AllArray . Length ) ;
195195
196196 foreach ( var child in traitsNode . AllArray )
197197 {
@@ -220,7 +220,7 @@ private ReadOnlySpan<CharacterTrait> ParseTraitsNode(Node traitsNode)
220220 Array . Exists (
221221 ModifierNodeKeys ,
222222 keyword => StringComparer . OrdinalIgnoreCase . Equals ( keyword , key )
223- ) || StringComparer . OrdinalIgnoreCase . Equals ( key , CharacterTrait . TraitXpFactor )
223+ ) || StringComparer . OrdinalIgnoreCase . Equals ( key , GeneralTrait . TraitXpFactor )
224224 )
225225 )
226226 {
@@ -241,7 +241,7 @@ private ReadOnlySpan<CharacterTrait> ParseTraitsNode(Node traitsNode)
241241
242242 if ( skillModifiers . Count != 0 )
243243 {
244- modifiers . Add ( new ModifierCollection ( CharacterTrait . TraitSkillModifiersKey , skillModifiers ) ) ;
244+ modifiers . Add ( new ModifierCollection ( GeneralTrait . TraitSkillModifiersKey , skillModifiers ) ) ;
245245 }
246246
247247 if ( customModifiersTooltip . Count != 0 )
@@ -250,7 +250,7 @@ private ReadOnlySpan<CharacterTrait> ParseTraitsNode(Node traitsNode)
250250 new ModifierCollection ( LeafModifier . CustomEffectTooltipKey , customModifiersTooltip )
251251 ) ;
252252 }
253- traits . Add ( new CharacterTrait ( traitName , traitType , modifiers ) ) ;
253+ traits . Add ( new GeneralTrait ( traitName , traitType , modifiers ) ) ;
254254 }
255255
256256 return CollectionsMarshal . AsSpan ( traits ) ;
0 commit comments