Строка 63: |
Строка 63: |
| </source> | | </source> |
| | | |
− | ==Items== | + | ==Предметы== |
− | Items are objects which represent things which can be put in an inventory. Tools, Crops, etc.
| + | Предметы - это объекты, которые могут быть помещены в инвентарь. Инструменты, культуры и т.п. |
| | | |
− | ===Create an Item (Object)=== | + | ===Создание предмета (Объекта)=== |
− | All constructors for Object:
| + | Конструкторы класса для создания предмета: |
| | | |
| <source lang='c#'> | | <source lang='c#'> |
Строка 76: |
Строка 76: |
| </source> | | </source> |
| | | |
− | Where '''parentSheetIndex''' is the ID of the item (can be found in ObjectInformation.xnb).
| + | Где '''parentSheetIndex''' это ID предмета (может быть найдено в ObjectInformation.xnb). |
| | | |
− | ===Spawn an item on the ground=== | + | ===Создание предмета на поверхности=== |
| | | |
| <source lang='c#'> | | <source lang='c#'> |
| public virtual bool dropObject(Object obj, Vector2 dropLocation, xTile.Dimensions.Rectangle viewport, bool initialPlacement, Farmer who = null); | | public virtual bool dropObject(Object obj, Vector2 dropLocation, xTile.Dimensions.Rectangle viewport, bool initialPlacement, Farmer who = null); |
| | | |
− | // Concrete code for spawning: | + | // Спавн предмета в локации: |
| Game1.getLocationFromName("Farm").dropObject(new StardewValley.Object(itemId, 1, false, -1, 0), new Vector2(x, y) * 64f, Game1.viewport, true, (Farmer)null); | | Game1.getLocationFromName("Farm").dropObject(new StardewValley.Object(itemId, 1, false, -1, 0), new Vector2(x, y) * 64f, Game1.viewport, true, (Farmer)null); |
| </source> | | </source> |
| | | |
− | ===Add an item to an inventory=== | + | ===Добавление предмета в инвентарь=== |
| //todo | | //todo |
| | | |
− | ===Remove an item from an inventory=== | + | ===Удаление предмета из инвентаря=== |
| | | |
− | This is dependent on the inventory - rarely will you be calling this directly, as the game has functions for this for the Player, located in Farmer (in the main namespace).
| + | Удаление зависит от инвентаря. Чаще всего вызывается метод класса Player, расположенного в пространстве имен Farmer. |
| | | |
− | To do so, in most situations, just call .removeItemFromInventory(Item)
| + | Чтобы удалить предмет в большинстве ситуаций необходимо просто вызвать метод .removeItemFromInventory(Item) |
| | | |
| ==Locations== | | ==Locations== |