更改

添加1,627字节 、 2021年6月10日 (四) 05:08
无编辑摘要
第1行: 第1行:  
 ← [[模组:目录|目录]]
 
 ← [[模组:目录|目录]]
 
{{stub}}
 
{{stub}}
 +
{{翻译}}
    
 此页面展示了制作SMAPI模组时常见的任务。在阅读时,请结合参考'''[[模组:创建 SMAPI 模组|模组制作入门]]'''和'''[[模组:制作指南/游戏基本架构|游戏基本架构]]'''。
 
 此页面展示了制作SMAPI模组时常见的任务。在阅读时,请结合参考'''[[模组:创建 SMAPI 模组|模组制作入门]]'''和'''[[模组:制作指南/游戏基本架构|游戏基本架构]]'''。
第118行: 第119行:  
Game1.player.Position.X - Game1.viewport.X
 
Game1.player.Position.X - Game1.viewport.X
 
Game1.player.Position.Y - Game1.viewport.Y
 
Game1.player.Position.Y - Game1.viewport.Y
 +
</syntaxhighlight>
 +
 +
==NPC==
 +
===自定义NPC===
 +
想要自定义NPC,你得修改或添加以下文件:
 +
格式: '''''具体操作''''':'''''(往)目标文件夹或文件名'''''
 +
* 添加新文件:<tt>Characters\Dialogue\<文件名></tt>
 +
* 添加新文件:<tt>Characters\schedules\<文件名></tt>
 +
* 添加新文件:<tt>Portraits\<文件名></tt>
 +
* 添加新文件:<tt>Characters\<文件名></tt>
 +
* 在已有文件中添加新的条目:<tt>Data\EngagementDialogue</tt>(可结婚NPC)
 +
* 在已有文件中添加新的条目:<tt>Data\NPCDispositions</tt>
 +
* 在已有文件中添加新的条目:<tt>Data\NPCGiftTastes</tt>
 +
* 在已有文件中添加新的条目:<tt>Characters\Dialogue\rainy</tt>
 +
* 在已有文件中添加新的条目:<tt>Data\animationDescriptions</tt>(在行程(schedule) 中增加自定义的动画)
 +
 +
以上所有的操作都可以通过<code>IAssetLoaders</code>/<code>IAssetEditors</code>或者<code>Content Patcher</code>做到。
 +
最后,你需要调用<tt>NPC</tt>的构造器来创建实例。
 +
<syntaxhighlight lang='c#'>
 +
public NPC(AnimatedSprite sprite, Vector2 position, int facingDir, string name, LocalizedContentManager content = null);
 +
public NPC(AnimatedSprite sprite, Vector2 position, string defaultMap, int facingDir, string name, Dictionary<int, int[]> schedule, Texture2D portrait, bool eventActor);
 +
public NPC(AnimatedSprite sprite, Vector2 position, string defaultMap, int facingDirection, string name, bool datable, Dictionary<int, int[]> schedule, Texture2D portrait);
 +
 +
// 调用:
 +
Game1.getLocationFromName("Town").addCharacter(npc);
 
</syntaxhighlight>
 
</syntaxhighlight>
    
[[en:Modding:Common tasks]]
 
[[en:Modding:Common tasks]]
 
[[ru:Модификации:Основные возможности]]
 
[[ru:Модификации:Основные возможности]]
50

个编辑