Skip to content

Commit 0c8b6d9

Browse files
committed
upload
1 parent dd42526 commit 0c8b6d9

File tree

7 files changed

+106
-13
lines changed

7 files changed

+106
-13
lines changed

docs/dev/advance/_category_.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "高级",
3+
"position": 5,
4+
"link": {
5+
"type": "generated-index"
6+
}
7+
}

docs/dev/look-persudo.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
sidebar_position: 100
3+
---
4+
5+
# 查看游戏代码
6+
7+
本教程将指导你游戏代码流程。
8+
9+
:::info
10+
11+
**Dead Cells** 使用 **Haxe** 编写并运行在 **HashLink 虚拟机**上,而不是 **.NET 虚拟机**
12+
13+
:::
14+
15+
:::tip
16+
17+
在开始之前,建议阅读 [wiki](https://github.com/HaxeFoundation/hashlink/wiki) 了解 **HashLink 虚拟机** 的基本信息。
18+
19+
:::
20+
21+
## 使用 crashlink
22+
23+
详见 [crashlink 文档](https://n3rdl0rd.github.io/crashlink/)
24+
25+
## 使用 hlbc-gui
26+
27+
详见 [README](https://github.com/Gui-Yom/hlbc)
28+
29+
## 使用 GamePseudocode
30+
31+
:::warning
32+
33+
- **GamePseudocode** 是由 **Dead Cells****HashLink Bytecode** 转换而来。仅仅用于查看游戏代码流程。
34+
- 为了反编译结果的可读性, **GamePseudocode****HashLink Bytecode** 并非一一对应关系。
35+
- **GamePseudocode** 的结果可能是错误的,请结合 [crashlink](#使用-crashlink)[hlbc](#使用-hlbc-gui) 使用。
36+
37+
:::
38+
39+
### 修改配置文件
40+
41+
:::tip
42+
43+
配置文件的位置:`coremod/config/modcore.json`
44+
45+
初次启动后该文件会自动生成。
46+
47+
:::
48+
49+
- 打开配置文件,找到 `GeneratePseudocodeAssembly` 将其值修改为 `true`
50+
- 保存配置文件。
51+
52+
### 启动游戏
53+
54+
- 启动游戏,游戏会自动生成 **GamePseudocode** ,请耐心等待。
55+
- 等待进入主菜单后,关闭游戏。
56+
57+
### 打开 GamePseudocode
58+
59+
- 进入目录 `coremod/cache` 应该可以发现 `GamePseudocode.dll` 文件。
60+
- 如果不存在,请确认操作是否正确。
61+
- 使用你喜欢的 **.NET 反编译器** 打开 `GamePseudocode.dll`
62+
- 推荐使用 [DnSpy](https://github.com/dnSpyEx/dnSpy)

docs/dev/tutorial/_category_.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "开始制作 Mod",
3+
"position": 1,
4+
"link": {
5+
"type": "generated-index"
6+
}
7+
}

docs/dev/first-mod.md renamed to docs/dev/tutorial/first-mod.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ sidebar_position: 2
66

77
本教程将指导你创建一个简单的 Mod ,实现修改游戏内某个基础功能的功能。
88

9+
:::warning
10+
11+
虽然编写 **Mod** 时使用 **C#** ,但请记住 **Dead Cells** 使用 **Haxe** 编写并运行在 **HashLink 虚拟机**上,而不是 **.NET 虚拟机**
12+
13+
本教程假设你拥有以下技能:
14+
15+
- C# 编程基础
16+
- Dead Cells 基础 Mod 制作 ([教程](https://www.bilibili.com/opus/681293864647000128))
17+
18+
:::
19+
20+
:::tip
21+
22+
在开始之前,建议阅读 [wiki](https://github.com/HaxeFoundation/hashlink/wiki) 了解 **HashLink 虚拟机** 的基本信息。
23+
24+
:::
25+
926
:::info
1027
本教程的 Mod 代码储存在 [Github](https://github.com/dead-cells-core-modding/docs-zh/blob/main/modproject/FirstDeadCellsMod) 上。
1128
:::
@@ -111,10 +128,11 @@ dotnet build
111128
- 确保已安装 .NET 9 SDK
112129
- 检查项目引用的 NuGet 包是否可用
113130
- 尝试清理解决方案后重新构建:
114-
'''powershell
131+
132+
```powershell
115133
dotnet clean
116134
dotnet build
117-
'''
135+
```
118136

119137
### Q2: Mod 不加载
120138

docs/dev/first-weapon.md renamed to docs/dev/tutorial/first-weapon.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 3
33
---
44

5-
# 创造第一个武器
5+
# 创造第一把武器
66

77
本教程将指导你创建一个简单的 Mod ,实现修改游戏内某个基础功能的功能。
88

@@ -12,14 +12,6 @@ sidebar_position: 3
1212
本章节大部分代码来自 **Frostbite**。感谢 Frostbite 对本教程的帮助。
1313
:::
1414

15-
:::warning
16-
本教程假设你拥有以下技能:
17-
18-
- C# 编程基础
19-
- 死亡细胞基础 Mod 制作 ([教程](https://www.bilibili.com/opus/681293864647000128))
20-
21-
:::
22-
2315
## 创建 Mod 项目
2416

2517
按照[教程](./first-mod.md)创造名为 **FirstWeapon** 的 Mod 项目。
File renamed without changes.

modproject/FirstWeapon/OtherDashSwordWeapon.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
using dc.en;
1+
using dc;
2+
using dc.en;
23
using dc.tool;
34
using dc.tool.weap;
5+
using HaxeProxy.Runtime;
46
using ModCore.Storage;
57
using System;
68
using System.Collections.Generic;
@@ -38,7 +40,12 @@ public override void fixedUpdate()
3840
{
3941
base.fixedUpdate();
4042
bool noStats = false;
41-
this.owner.addCells(10, new HaxeProxy.Runtime.Ref<bool>(ref noStats));
43+
owner.addCells(10, new Ref<bool>(ref noStats));
44+
}
45+
46+
public override bool onExecute()
47+
{
48+
return base.onExecute();
4249
}
4350
}
4451
}

0 commit comments

Comments
 (0)