@@ -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 . 5 f , 0 . 5 f , 1 f );
@@ -31,8 +33,10 @@ public class TestCardPool : CustomCardPoolModel
3133``` csharp
3234public 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
4246public 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```
194199TestEnergyCounter (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"]
242260base_font = ExtResource("kreon_bold_shared_font")
243261spacing_glyph = 2
244262```
245263
246- * 然后往下,找到` [node name="Label" type="Label" parent="."] ` 这一行,添加以下两行 。
264+ * 然后往下,找到` [node name="Label" type="Label" parent="."] ` 这一行,添加以下这一行 。
247265
248266``` tscn
249267theme_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"]
439451spacing_glyph = 2
440452
441453[node name="TestEnergyCounter" type="Control"]
442454layout_mode = 3
443455anchors_preset = 0
444456offset_right = 128.0
445457offset_bottom = 128.0
446- script = ExtResource("energy_counter ")
458+ script = ExtResource("1_tmfxn ")
447459metadata/_edit_lock_ = true
448460
449- [node name="BurstBack " type="CPUParticles2D " parent="."]
461+ [node name="EnergyVfxBack " type="Node2D " parent="."]
450462unique_name_in_owner = true
451463position = 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="."]
467467unique_name_in_owner = true
@@ -472,6 +472,12 @@ anchor_bottom = 1.0
472472grow_horizontal = 2
473473grow_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"]
476482layout_mode = 1
477483anchors_preset = 15
@@ -482,31 +488,10 @@ grow_vertical = 2
482488texture = ExtResource("1_85qf2")
483489expand_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="."]
492492unique_name_in_owner = true
493493position = 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="."]
512497layout_mode = 1
@@ -521,17 +506,15 @@ grow_horizontal = 2
521506grow_vertical = 2
522507theme_override_colors/font_color = Color(1, 0.9647059, 0.8862745, 1)
523508theme_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)
525510theme_override_constants/shadow_offset_x = 3
526511theme_override_constants/shadow_offset_y = 2
527512theme_override_constants/outline_size = 16
528513theme_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 ")
530515theme_override_font_sizes/font_size = 36
531- script = ExtResource("mega_label")
516+ text = "3/3"
532517horizontal_alignment = 1
533518vertical_alignment = 1
534- text = "3/3"
535- MinFontSize = 32
536- MaxFontSize = 36
519+ script = ExtResource("4_6cpd0")
537520```
0 commit comments