File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ public class Strike extends CustomCard {
118118
119119<br ><br ><br >
120120
121- * 可以先跳过,学习之后的章节*
121+ * 以下进行一些生活质量改进(编写通用代码,ModHelper类)。 可以先跳过,学习之后的章节。 *
122122## 进阶:简化代码
123123
124124### 简化卡牌ID
Original file line number Diff line number Diff line change 44import basemod .abstracts .CustomCard ;
55
66public class Strike extends CustomCard {
7- public static final String ID = ModHelper .makePath (" Strike" );
7+ public static final String ID = ModHelper .makePath (Strike . class . getSimpleName ()); // ID(此处的ModHelper在“04 - 本地化”的进阶中提到)
88 private static final CardStrings CARD_STRINGS = CardCrawlGame .languagePack .getCardStrings (ID ); // 从游戏系统读取本地化资源
99 // private static final String NAME = "打击";
1010 private static final String NAME = CARD_STRINGS .NAME ; // 读取本地化的名字
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ public class MyCharacter extends CustomPlayer {
123123 return new Strike ();
124124 }
125125
126- // 卡牌轨迹颜色
126+ // 卡牌轨迹颜色(和CardColor不是同一个类。使用com.badlogic.gdx.graphics.Color)
127127 @Override
128128 public Color getCardTrailColor () {
129129 return ExampleMod . MY_COLOR ;
@@ -182,7 +182,7 @@ public class MyCharacter extends CustomPlayer {
182182 return characterStrings.TEXT [1 ];
183183 }
184184
185- // 打心脏的颜色,不是很明显
185+ // 打心脏的颜色,不是很明显(和CardColor不是同一个类。使用com.badlogic.gdx.graphics.Color)
186186 @Override
187187 public Color getSlashAttackColor () {
188188 return ExampleMod . MY_COLOR ;
@@ -194,7 +194,7 @@ public class MyCharacter extends CustomPlayer {
194194 return Vampires . DESCRIPTIONS [0 ];
195195 }
196196
197- // 卡牌选择界面选择该牌的颜色
197+ // 卡牌选择界面选择该牌的颜色(和CardColor不是同一个类。使用com.badlogic.gdx.graphics.Color)
198198 @Override
199199 public Color getCardRenderColor () {
200200 return ExampleMod . MY_COLOR ;
@@ -232,6 +232,8 @@ public class MyCharacter extends CustomPlayer {
232232}
233233```
234234
235+ * 注意其中的` AbstractCard.CardColor ` 和` Color ` 不是同一个类。*
236+
235237最下面我们添加了一些必要的枚举,你可以在你之前添加颜色的地方引用它。
236238
237239``` java
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ MyRelic.java:
2828``` java
2929// 继承CustomRelic
3030public class MyRelic extends CustomRelic {
31- // 遗物ID(此处的ModHelper在“04 - 本地化”中提到 )
31+ // 遗物ID(此处的ModHelper在“04 - 本地化”的进阶中提到 )
3232 public static final String ID = ModHelper . makePath(" MyRelic" );
3333 // 图片路径(大小128x128,可参考同目录的图片)
3434 private static final String IMG_PATH = " ExampleModResources/img/relics/MyRelic.png" ;
Original file line number Diff line number Diff line change 11# 介绍
22
3- 这里时不时收录一些mod作者会经常想到的,但是刚开始写的mod作者不会写的东西。
3+ 这里时不时收录一些mod作者会经常想到的,但是刚开始写的mod作者不会写的东西。
4+
5+ # 杂碎知识:
6+
7+ ## 1. 资源覆盖
8+
9+ 如果你把资源放在` resources/ ` 路径下,相同路径下的资源总是被后加载的mod的资源覆盖。
You can’t perform that action at this time.
0 commit comments