Строка 159: |
Строка 159: |
| | | |
| ===Настраиваемый лист тайлов=== | | ===Настраиваемый лист тайлов=== |
− | Вы можете добавлять на карту пользовательские спрайты, тайлы или изображения. Обязательно [[#Tilesheet order|prefix custom tilesheet IDs with <code>z_</code>]] чтобы избежать смещения индексов ванильных таблиц. | + | Вы можете добавлять на карту пользовательские спрайты, тайлы или изображения. Обязательно [[#Порядок листов тайлов|используйте префикс <code>z_</code> перед ID]] чтобы избежать смещения индексов ванильных таблиц. |
| | | |
− | If you're using SMAPI:
| + | Если вы используете SMAPI: |
| :<syntaxhighlight lang="c#"> | | :<syntaxhighlight lang="c#"> |
| public override void Entry(IModHelper helper) | | public override void Entry(IModHelper helper) |
Строка 170: |
Строка 170: |
| private void OnSaveLoaded(object sender, SaveLoadedEventArgs args) | | private void OnSaveLoaded(object sender, SaveLoadedEventArgs args) |
| { | | { |
− | // This gets the asset key for a tilesheet.png file from your mod's folder. You can also load a game tilesheet like | + | // Это позволяет получить ключ ресурса для файла tilesheet.png из папки вашего мода. Вы также можете загрузить таблицу игровых листов, например |
− | // this: helper.Content.GetActualAssetKey("spring_town", ContentSource.GameContent). | + | // helper.Content.GetActualAssetKey("spring_town", ContentSource.GameContent). |
| string tilesheetPath = this.Helper.Content.GetActualAssetKey("tilesheet.png", ContentSource.ModFolder); | | string tilesheetPath = this.Helper.Content.GetActualAssetKey("tilesheet.png", ContentSource.ModFolder); |
| | | |
− | // Get an instance of the in-game location you want to patch. For the farm, use Game1.getFarm() instead. | + | // Получить экземпляр игрового местоположения, которое вы хотите исправить. Для фермы вместо этого используйте Game1.getFarm (). |
| GameLocation location = Game1.getLocationFromName("Town"); | | GameLocation location = Game1.getLocationFromName("Town"); |
| | | |
− | // Add the tilesheet. | + | // Добавить лист тайлов |
| TileSheet tilesheet = new TileSheet( | | TileSheet tilesheet = new TileSheet( |
− | id: "z_your-custom-spritesheet", // a unique ID for the tilesheet | + | id: "z_your-custom-spritesheet", // уникальный ID для таблицы тайлов |
| map: location.map, | | map: location.map, |
| imageSource: tilesheetPath, | | imageSource: tilesheetPath, |
− | sheetSize: new xTile.Dimensions.Size(32, 64), // the tile size of your tilesheet image. | + | sheetSize: new xTile.Dimensions.Size(32, 64), // размер тайла вашего изображения в таблице тайлов. |
− | tileSize: new xTile.Dimensions.Size(16, 16) // should always be 16x16 for maps | + | tileSize: new xTile.Dimensions.Size(16, 16) // для карт всегда должно быть 16x16 |
| ); | | ); |
| location.map.AddTileSheet(tilesheet); | | location.map.AddTileSheet(tilesheet); |
Строка 189: |
Строка 189: |
| } | | } |
| </syntaxhighlight> | | </syntaxhighlight> |
− | : To change tiles using the new tilesheet, see [[#Tiles]] below. | + | : Чтобы изменить тайлы с помощью новой таблицы тайлов, смотри [[#Тайлы]]. |
| | | |
− | If you're using Tiled:
| + | Если вы используете Tiled: |
| :# Create your spritesheet and place it in the same folder as your <tt>.tbin</tt> or <tt>.tmx</tt> map file. This should be a PNG image with images divided into 16x16 tiles (see [[Modding:Editing XNB files#Intro]] for examples). | | :# Create your spritesheet and place it in the same folder as your <tt>.tbin</tt> or <tt>.tmx</tt> map file. This should be a PNG image with images divided into 16x16 tiles (see [[Modding:Editing XNB files#Intro]] for examples). |
| :# Open the map in Tiled. | | :# Open the map in Tiled. |