File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System . IO ;
1
2
using NeoModLoader . api ;
2
3
using ExampleMod . UI ;
3
4
using ExampleMod . Content ;
4
5
using NeoModLoader . api . attributes ;
6
+ using NeoModLoader . General ;
5
7
6
8
namespace ExampleMod ;
7
9
@@ -17,13 +19,23 @@ public static void Called(){
17
19
}
18
20
19
21
private static bool _reload_switch ;
22
+ [ Hotfixable ]
20
23
public void Reload ( )
21
24
{
25
+ // Reload locales when mod loaded, it's optional.
26
+ // 重载模组时重新加载语言文件, 不是必需的
27
+ var locale_dir = GetLocaleFilesDirectory ( GetDeclaration ( ) ) ;
28
+ foreach ( var file in Directory . GetFiles ( locale_dir , "*.json" ) ) {
29
+ LM . LoadLocale ( Path . GetFileNameWithoutExtension ( file ) , file ) ;
30
+ }
31
+
32
+ // 实现了重载切换ExampleTrait的action_special_effect
22
33
_reload_switch = ! _reload_switch ;
23
34
var example_trait_to_update = AssetManager . traits . get ( "ExampleTrait" ) ;
24
35
example_trait_to_update . action_special_effect = _reload_switch ? ExampleActions . example_trait_special_effect : null ;
25
36
example_trait_to_update . special_effect_interval = 1f ;
26
37
38
+ // 将特质的效果更新即时应用于所有单位.
27
39
foreach ( var actor in World . world . units ) {
28
40
if ( actor != null && actor . isAlive ( ) && actor . hasTrait ( "ExampleTrait" ) ) {
29
41
actor . setStatsDirty ( ) ;
You can’t perform that action at this time.
0 commit comments