Skip to content

Commit dcba58f

Browse files
author
REME
committed
2026-03-27 0.100
1 parent 26151e0 commit dcba58f

9 files changed

Lines changed: 141 additions & 116 deletions

File tree

Basics/02 - 安装、看源码、修改/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ https://github.com/GDRETools/gdsdecomp
2222

2323
![alt text](../../images/image7.png)
2424

25-
4. 等项目导出完,使用godot导入`project.godot`即可。
25+
4. 等项目导出完,使用godot导入`project.godot`即可。做mod并不需要能在godot里运行这个项目。
2626

2727
## ilspy或dnspy,仅反编译游戏代码
2828

@@ -50,8 +50,8 @@ https://github.com/GDRETools/gdsdecomp
5050
尖塔根目录有许多`launch_xxx.bat`,选择一个合适的,右键记事本编辑,在其中加一个`--log`,例如`@echo off
5151
"%~dp0SlayTheSpire2.exe" --log --rendering-driver opengl3 %*`。
5252

53-
然后在根目录创建一个`steam_appid.txt`,里面写`2868840`,然后双击修改的bat文件运行即可以一个能输出log的命令行的方式打开游戏。或者添加`-force-steam=off`参数。
53+
然后在根目录创建一个`steam_appid.txt`,里面写`2868840`,然后双击修改的bat文件运行即可以一个能输出log的命令行的方式打开游戏。或者添加`--force-steam=off`参数。
5454

55-
## 本地&联机测试
55+
## 本地联机测试
5656

57-
复制出两个新的`bat`,其中一个添加`--fastmp=host`参数,作为主机,另一个添加`-fastmp=join -clientId=1001`参数,作为非主机玩家。当然你可以添加更多,记得修改`clientId`
57+
复制出两个新的`bat`,其中一个添加`--fastmp=host`参数,作为主机,另一个添加`--fastmp=join -clientId=1001`参数,作为非主机玩家。当然你可以添加更多,记得修改`clientId`

Basics/03 - BaseLib接口/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Test (你的项目文件夹)
189189
## 自定义模组配置
190190

191191
* 要使用此功能,需要先放一张图片到`{modId}\mod_image.png`作为mod图标,尺寸任意,否则会由于报错不显示配置。
192-
* 添加一个继承`SimpleModConfig`(或者是`ModConfig`如果你想要更复杂的设置)的类,在其中添加`public static bool`变量。支持`bool``double``enum`
192+
* 添加一个继承`SimpleModConfig`(或者是`ModConfig`如果你想要更复杂的设置)的类,在其中添加`public static bool`变量。支持`bool``double``enum``int``string`
193193
* 在初始化函数调用`ModConfigRegistry.Register`。字符串写你的`modId`
194194

195195
```csharp
@@ -374,6 +374,7 @@ public class TestRelic : CustomRelicModel
374374
[SavedProperty]
375375
public int Test_GameTurns { get; set; } = 0;
376376

377+
// 添加新的动态变量
377378
protected override IEnumerable<DynamicVar> CanonicalVars => [new CardsVar(1), new DynamicVar("GameTurns", Test_GameTurns)];
378379

379380
public override async Task AfterPlayerTurnStart(PlayerChoiceContext choiceContext, Player player)
@@ -427,7 +428,7 @@ public class TestPower : CustomPowerModel
427428
}
428429
```
429430

430-
然后使用`PowerCmd.Apply<TestPower>(...)`给予即可。
431+
然后使用`PowerCmd.Apply<TestPower>(...)`给予即可。或者使用控制台`power TEST-TEST_POWER 1 0`
431432

432433
![alt text](../../images/image25.png)
433434

Basics/04 - 添加新人物/README.md

Lines changed: 77 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ public class TestCardPool : CustomCardPoolModel
1515
// 卡池的ID。必须唯一防撞车。
1616
public override string Title => "test";
1717

18-
// 卡池的能量图标。暂时不支持加载,建议暂时使用原版,或者通过更改CardModel的EnergyIcon修改。
19-
public override string EnergyColorName => "ironclad";
18+
// 描述中使用的能量图标。大小为24x24。
19+
public override string? TextEnergyIconPath => "res://test/images/energy_test.png";
20+
// tooltip和卡牌左上角的能量图标。大小为74x74。
21+
public override string? BigEnergyIconPath => "res://test/images/energy_test_big.png";
2022

2123
// 卡池的主题色。
2224
public override Color DeckEntryCardColor => new(0.5f, 0.5f, 1f);
@@ -31,8 +33,10 @@ public class TestCardPool : CustomCardPoolModel
3133
```csharp
3234
public class TestRelicPool : CustomRelicPoolModel
3335
{
34-
// 能量图标。
35-
public override string EnergyColorName => "ironclad";
36+
// 描述中使用的能量图标。大小为24x24。
37+
public override string? TextEnergyIconPath => "res://test/images/energy_test.png";
38+
// tooltip和卡牌左上角的能量图标。大小为74x74。
39+
public override string? BigEnergyIconPath => "res://test/images/energy_test_big.png";
3640
}
3741
```
3842

@@ -41,13 +45,13 @@ public class TestRelicPool : CustomRelicPoolModel
4145
```csharp
4246
public class TestPotionPool : CustomPotionPoolModel
4347
{
44-
// 能量图标。
45-
public override string EnergyColorName => "ironclad";
48+
// 描述中使用的能量图标。大小为24x24。
49+
public override string? TextEnergyIconPath => "res://test/images/energy_test.png";
50+
// tooltip和卡牌左上角的能量图标。大小为74x74。
51+
public override string? BigEnergyIconPath => "res://test/images/energy_test_big.png";
4652
}
4753
```
4854

49-
如果你的卡牌、药水、遗物都使用`CustomxxxModel`,且添加了`Pool`属性,那么不需要override`GenerateAllxxx`了。
50-
5155
## 创建人物
5256

5357
人物需要极其大量的资源,推荐新建类继承`PlaceholderCharacterModel`而不是`CustomCharacterModel`。你没有的资源直接注释掉以使用原版。教程提供的资源在最下方。
@@ -68,17 +72,17 @@ public class TestCharacter : PlaceholderCharacterModel
6872

6973
// 人物模型tscn路径。要自定义见下。
7074
public override string CustomVisualPath => "res://test/scenes/test_character.tscn";
71-
// 卡牌拖尾路径
75+
// 卡牌拖尾场景
7276
// public override string CustomTrailPath => "res://scenes/vfx/card_trail_ironclad.tscn";
7377
// 人物头像路径。
7478
public override string CustomIconTexturePath => "res://icon.svg";
7579
// 人物头像2号。
7680
// public override string CustomIconPath => "res://scenes/ui/character_icons/ironclad_icon.tscn";
7781
// 能量表盘tscn路径。要自定义见下。
7882
public override string CustomEnergyCounterPath => "res://test/scenes/test_energy_counter.tscn";
79-
// 篝火休息动画
83+
// 篝火休息场景
8084
// public override string CustomRestSiteAnimPath => "res://scenes/rest_site/characters/ironclad_rest_site.tscn";
81-
// 商店人物动画
85+
// 商店人物场景
8286
// public override string CustomMerchantAnimPath => "res://scenes/merchant/characters/ironclad_merchant.tscn";
8387
// 多人模式-手指。
8488
// public override string CustomArmPointingTexturePath => null;
@@ -188,21 +192,21 @@ TestCharacter (Node2D)
188192

189193
`public override string CustomEnergyCounterPath => "res://test/scenes/test_energy_counter.tscn";`
190194

195+
* 建议从原版或者下面的附赠资源处复制一份tscn快速开始。
191196
创建一个`Control`类型的新场景,设定以下结构:
192197

193198
```
194199
TestEnergyCounter (Control)
195-
├── BurstBack (CPUParticles2D) %
200+
├── EnergyVfxBack (Node2D) %
196201
├── Layers (Control) %
197202
│ ├── Layer1 (TextureRect,或任意)
198203
│ └── RotationLayers (Control) %
199-
├── BurstFront (CPUParticles2D) %
204+
├── EnergyVfxFront (Node2D) %
200205
└── Label (Label)
201206
```
202207

203208
* 后面标`%`的需要作为唯一名称访问。名字不要改,label也是。
204209
* RotationLayers里放需要旋转的图层。没有也行。
205-
* 粒子动画节点参考原版设置,或者建议你直接复制最下方提供的tscn。
206210

207211
![alt text](../../images/image19.png)
208212

@@ -214,44 +218,57 @@ public partial class NTestEnergyCounter : NEnergyCounter
214218
}
215219
```
216220

217-
保存一下然后关闭这个场景,然后开始<b>神秘操作</b>。在本地,或者是你的ide里打开这个tscn文件,先修改开头,
218-
*`ext_resource`这一组(推荐ext最下面,sub最上面)添加`mega_label`这一行。
219-
* 添加`kreon_bold_shared_font`这一行。
220-
*`sub_resource`这一组添加`FontVariation_kreon_bold_shared_font``base_font``spacing_glyph`这三行。
221-
* 修改`load_steps`,改为原来的数字+3。(ext数量+sub数量+1)
221+
然后创建一个继承`NParticlesContainer`的类,挂载到`EnergyVfxBack``EnergyVfxFront`上。
222222

223-
```tscn
224-
[gd_scene load_steps=8 format=3 uid="uid://cs3a5onikvhi4"]
223+
其中的`_particles`无法使用`Export`设置,所以需要反射设置。当然你也可以往里添加`GpuParticles2D`以添加粒子动画效果。具体参考原版。
225224

226-
[ext_resource type="Texture2D" uid="uid://ddxmxgyyfy8mn" path="res://icon.svg" id="1_85qf2"]
227-
[ext_resource type="Script" uid="uid://b4eaf7kin174o" path="res://Scripts/NTestEnergyCounter.cs" id="energy_counter"]
225+
```csharp
226+
public partial class NTestParticlesContainer : NParticlesContainer
227+
{
228+
public override void _Ready()
229+
{
230+
base._Ready();
231+
Traverse.Create(this).Field("_particles").SetValue(new Array<GpuParticles2D>());
232+
}
233+
}
234+
```
228235

229-
[ext_resource type="Script" path="res://addons/mega_text/MegaLabel.cs" id="mega_label"]
236+
然后创建一个继承`MegaLabel`的类,挂载到`Label`上。
230237

231-
[ext_resource type="FontVariation" path="res://themes/kreon_bold_shared.tres" id="kreon_bold_shared_font"]
238+
```csharp
239+
public partial class TestMegaLabel : MegaLabel
240+
{
241+
}
242+
```
243+
244+
保存一下然后关闭这个场景,然后开始<b>神秘操作</b>。在本地,或者是你的ide里打开这个tscn文件,先修改开头,
245+
*`ext_resource`这一组下添加`kreon_bold_shared_font`这一行。
246+
*`ext_resource`这一组下添加`FontVariation_kreon_bold_shared_font``base_font``spacing_glyph`这三行。
247+
* 修改`load_steps`,改为原来的数字+2。(ext数量+sub数量+1)
232248

233-
[sub_resource type="Curve" id="Curve_85qf2"]
234-
_data = [Vector2(0.006, 0.031), 0.0, 4.464, 0, 0, Vector2(0.298, 0.736), 0.832, 0.832, 0, 0, Vector2(0.99, 0.933), -0.247, 0.0, 0, 0]
235-
point_count = 3
249+
```tscn
250+
[gd_scene load_steps=7 format=3 uid="uid://cs3a5onikvhi4"]
236251
237-
[sub_resource type="Gradient" id="Gradient_1ytbd"]
238-
offsets = PackedFloat32Array(0, 0.35164836, 0.64835167, 1)
239-
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
252+
[ext_resource type="Texture2D" path="res://icon.svg" id="1_85qf2"]
253+
[ext_resource type="Script" path="res://Scripts/NTestEnergyCounter.cs" id="1_tmfxn"]
254+
[ext_resource type="Script" path="res://Scripts/NTestParticlesContainer.cs" id="2_1ytbd"]
255+
[ext_resource type="Script" path="res://Scripts/TestMegaLabel.cs" id="4_6cpd0"]
256+
257+
[ext_resource type="FontVariation" path="res://themes/kreon_bold_shared.tres" id="kreon_bold_shared_font"]
240258
241259
[sub_resource type="FontVariation" id="FontVariation_kreon_bold_shared_font"]
242260
base_font = ExtResource("kreon_bold_shared_font")
243261
spacing_glyph = 2
244262
```
245263

246-
* 然后往下,找到`[node name="Label" type="Label" parent="."]`这一行,添加以下两行
264+
* 然后往下,找到`[node name="Label" type="Label" parent="."]`这一行,添加以下这一行
247265

248266
```tscn
249267
theme_override_fonts/font = SubResource("FontVariation_kreon_bold_shared_font")
250-
script = ExtResource("mega_label")
251268
```
252269

253-
* 然后<b>不要再打开</b>这个文件。如果你想修改,保存以后重复以上内容
254-
* TODO:或者你也可以通过新建一个继承`MegaLabel`的类挂载,把反编译的字体资源复制到本地以省去以上工作
270+
* 然后如果你想修改这个能量表盘,打开场景后需要重复以上工作
271+
* 或者你也可以把反编译的字体资源复制到本地以省去以上工作
255272

256273
## 本地化文件
257274

@@ -306,6 +323,10 @@ script = ExtResource("mega_label")
306323

307324
![alt text](../../images/image22.png)
308325

326+
![alt text](../../images/energy_test.png)
327+
328+
![alt text](../../images/energy_test_big.png)
329+
309330
`test_bg.tscn`:
310331
```tscn
311332
[gd_scene load_steps=2 format=3 uid="uid://cejqjeipgqe0n"]
@@ -417,51 +438,30 @@ position = Vector2(0, -72)
417438
`test_energy_counter.tscn`:
418439

419440
```tscn
420-
[gd_scene load_steps=8 format=3 uid="uid://cs3a5onikvhi4"]
441+
[gd_scene load_steps=7 format=3 uid="uid://cs3a5onikvhi4"]
421442
422443
[ext_resource type="Texture2D" uid="uid://ddxmxgyyfy8mn" path="res://icon.svg" id="1_85qf2"]
423-
[ext_resource type="Script" uid="uid://b4eaf7kin174o" path="res://Scripts/NTestEnergyCounter.cs" id="energy_counter"]
424-
425-
[ext_resource type="Script" path="res://addons/mega_text/MegaLabel.cs" id="mega_label"]
426-
427-
[ext_resource type="FontVariation" uid="uid://bg85h22rkxs6g" path="res://themes/kreon_bold_shared.tres" id="3_jei5p"]
444+
[ext_resource type="Script" uid="uid://b4eaf7kin174o" path="res://Scripts/NTestEnergyCounter.cs" id="1_tmfxn"]
445+
[ext_resource type="Script" uid="uid://b8vmh6070x38m" path="res://Scripts/NTestParticlesContainer.cs" id="2_1ytbd"]
446+
[ext_resource type="Script" uid="uid://camgj4bhk5dps" path="res://Scripts/TestMegaLabel.cs" id="4_6cpd0"]
428447
429-
[sub_resource type="Curve" id="Curve_85qf2"]
430-
_data = [Vector2(0.006, 0.031), 0.0, 4.464, 0, 0, Vector2(0.298, 0.736), 0.832, 0.832, 0, 0, Vector2(0.99, 0.933), -0.247, 0.0, 0, 0]
431-
point_count = 3
432-
433-
[sub_resource type="Gradient" id="Gradient_1ytbd"]
434-
offsets = PackedFloat32Array(0, 0.35164836, 0.64835167, 1)
435-
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
448+
[ext_resource type="FontVariation" path="res://themes/kreon_bold_shared.tres" id="kreon_bold_shared_font"]
436449
437-
[sub_resource type="FontVariation" id="FontVariation_x0k5t"]
438-
base_font = ExtResource("3_jei5p")
450+
[sub_resource type="FontVariation" id="FontVariation_kreon_bold_shared_font"]
439451
spacing_glyph = 2
440452
441453
[node name="TestEnergyCounter" type="Control"]
442454
layout_mode = 3
443455
anchors_preset = 0
444456
offset_right = 128.0
445457
offset_bottom = 128.0
446-
script = ExtResource("energy_counter")
458+
script = ExtResource("1_tmfxn")
447459
metadata/_edit_lock_ = true
448460
449-
[node name="BurstBack" type="CPUParticles2D" parent="."]
461+
[node name="EnergyVfxBack" type="Node2D" parent="."]
450462
unique_name_in_owner = true
451463
position = Vector2(64, 64)
452-
emitting = false
453-
amount = 1
454-
texture = ExtResource("1_85qf2")
455-
one_shot = true
456-
local_coords = true
457-
gravity = Vector2(0, 0)
458-
radial_accel_max = 10.0
459-
angle_max = 260.0
460-
scale_amount_min = 1.5
461-
scale_amount_max = 1.5
462-
scale_amount_curve = SubResource("Curve_85qf2")
463-
color = Color(1, 0.49411765, 0.48235294, 0.6)
464-
color_ramp = SubResource("Gradient_1ytbd")
464+
script = ExtResource("2_1ytbd")
465465
466466
[node name="Layers" type="Control" parent="."]
467467
unique_name_in_owner = true
@@ -472,6 +472,12 @@ anchor_bottom = 1.0
472472
grow_horizontal = 2
473473
grow_vertical = 2
474474
475+
[node name="RotationLayers" type="Control" parent="Layers"]
476+
unique_name_in_owner = true
477+
anchors_preset = 0
478+
offset_right = 40.0
479+
offset_bottom = 40.0
480+
475481
[node name="Layer1" type="TextureRect" parent="Layers"]
476482
layout_mode = 1
477483
anchors_preset = 15
@@ -482,31 +488,10 @@ grow_vertical = 2
482488
texture = ExtResource("1_85qf2")
483489
expand_mode = 1
484490
485-
[node name="RotationLayers" type="Control" parent="Layers"]
486-
unique_name_in_owner = true
487-
anchors_preset = 0
488-
offset_right = 40.0
489-
offset_bottom = 40.0
490-
491-
[node name="BurstFront" type="CPUParticles2D" parent="."]
491+
[node name="EnergyVfxFront" type="Node2D" parent="."]
492492
unique_name_in_owner = true
493493
position = Vector2(64, 64)
494-
emitting = false
495-
amount = 1
496-
texture = ExtResource("1_85qf2")
497-
lifetime = 0.5
498-
one_shot = true
499-
local_coords = true
500-
gravity = Vector2(0, 0)
501-
angular_velocity_min = 30.0
502-
angular_velocity_max = 30.0
503-
radial_accel_max = 10.0
504-
angle_max = 260.0
505-
scale_amount_min = 1.5
506-
scale_amount_max = 1.5
507-
scale_amount_curve = SubResource("Curve_85qf2")
508-
color = Color(1, 0.49411765, 0.48235294, 0.6)
509-
color_ramp = SubResource("Gradient_1ytbd")
494+
script = ExtResource("2_1ytbd")
510495
511496
[node name="Label" type="Label" parent="."]
512497
layout_mode = 1
@@ -521,17 +506,15 @@ grow_horizontal = 2
521506
grow_vertical = 2
522507
theme_override_colors/font_color = Color(1, 0.9647059, 0.8862745, 1)
523508
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.1882353)
524-
theme_override_colors/font_outline_color = Color(0.4, 0.4, 0.8, 1)
509+
theme_override_colors/font_outline_color = Color(0.1, 0.1, 0.8, 1)
525510
theme_override_constants/shadow_offset_x = 3
526511
theme_override_constants/shadow_offset_y = 2
527512
theme_override_constants/outline_size = 16
528513
theme_override_constants/shadow_outline_size = 16
529-
theme_override_fonts/font = SubResource("FontVariation_x0k5t")
514+
theme_override_fonts/font = SubResource("FontVariation_kreon_bold_shared_font")
530515
theme_override_font_sizes/font_size = 36
531-
script = ExtResource("mega_label")
516+
text = "3/3"
532517
horizontal_alignment = 1
533518
vertical_alignment = 1
534-
text = "3/3"
535-
MinFontSize = 32
536-
MaxFontSize = 36
519+
script = ExtResource("4_6cpd0")
537520
```

0 commit comments

Comments
 (0)