File tree 2 files changed +20
-3
lines changed
2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,26 @@ namespace ExampleMod.Content;
5
5
internal static class ExampleActions
6
6
{
7
7
[ Hotfixable ]
8
- public static bool example_trait_special_effect ( BaseSimObject pTarget , WorldTile pTile ) {
8
+ public static bool example_trait_special_effect ( BaseSimObject pTarget , WorldTile pTile )
9
+ {
9
10
if ( pTarget == null || ! pTarget . isAlive ( ) ) return false ;
10
11
// You can modify the method when game running. And click the reload button in the mod menu to reload the method.
11
12
// 你可以在游戏运行时修改方法,然后点击mod菜单中的reload按钮来重新加载方法。
12
13
ExampleModMain . LogInfo ( $ "{ pTarget . base_data . name } is being affected by ExampleTrait") ;
13
14
return true ;
14
15
}
16
+
17
+ // This method will be called when config value set. ATTENTION: It might be called when game start.
18
+ // 这个方法会在配置值被设置时调用。注意:这个方法会在模组被加载时调用。
19
+ public static void ExampleSwitchConfigCallBack ( bool pCurrentValue )
20
+ {
21
+ ExampleModMain . LogInfo ( $ "Current value of a switch config is '{ pCurrentValue } '") ;
22
+ }
23
+
24
+ // This method will be called when config value set. ATTENTION: It might be called when game start.
25
+ // 这个方法会在配置值被设置时调用。注意:这个方法会在模组被加载时调用。
26
+ public static void ExampleSliderConfigCallback ( float pCurrentValue )
27
+ {
28
+ ExampleModMain . LogInfo ( $ "Current value of a slider config is '{ pCurrentValue } '") ;
29
+ }
15
30
}
Original file line number Diff line number Diff line change 4
4
"Id" : " Example Switch" ,
5
5
"Type" : " SWITCH" ,
6
6
"IconPath" : " ui/icons/iconHideUI" ,
7
- "BoolVal" : true
7
+ "BoolVal" : true ,
8
+ "Callback" : " ExampleActions:ExampleSwitchConfigCallBack"
8
9
},
9
10
{
10
11
"Id" : " Example Slider" ,
11
12
"Type" : " SLIDER" ,
12
13
"IconPath" : " ui/icons/iconKingdomZones" ,
13
- "FloatVal" : 0.5
14
+ "FloatVal" : 0.5 ,
15
+ "Callback" : " ExampleActions:ExampleSliderConfigCallback"
14
16
},
15
17
{
16
18
"Id" : " Example TextInput" ,
You can’t perform that action at this time.
0 commit comments