mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
Add get_text_info() in TileSetCustom
This commit is contained in:
parent
8346b465b6
commit
a9946099ef
|
@ -2239,6 +2239,10 @@ msgstr ""
|
|||
msgid "Group"
|
||||
msgstr ""
|
||||
|
||||
#. A tilemap is a type of layer, which is divided by grid cells, the size of which is determined by the tileset it uses. Each grid cell is mapped to a tile in the tileset. Tilemaps can be used to create game levels and layouts.
|
||||
msgid "Tilemap"
|
||||
msgstr ""
|
||||
|
||||
msgid "Layers"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3381,6 +3385,7 @@ msgid "Do you want to download the image from %s?"
|
|||
msgstr ""
|
||||
|
||||
#. A tileset is a collection of tiles.
|
||||
#: src/Classes/TileSetCustom.gd
|
||||
#: src/UI/Dialogs/ImportPreviewDialog.gd
|
||||
msgid "Tileset"
|
||||
msgstr ""
|
||||
|
|
|
@ -127,6 +127,15 @@ func clear_tileset(cel: CelTileMap) -> void:
|
|||
set_deferred("_tileset_has_been_cleared", false)
|
||||
|
||||
|
||||
## Returns the tilemap's info, such as its name and tile size and with a given
|
||||
## [param tile_index], in the form of text.
|
||||
func get_text_info(tile_index: int) -> String:
|
||||
var item_string := " %s (%s×%s)" % [tile_index, tile_size.x, tile_size.y]
|
||||
if not name.is_empty():
|
||||
item_string += ": " + name
|
||||
return tr("Tileset") + item_string
|
||||
|
||||
|
||||
## Serializes the data of this class into the form of a [Dictionary],
|
||||
## which is used so the data can be stored in pxo files.
|
||||
func serialize() -> Dictionary:
|
||||
|
|
|
@ -33,10 +33,7 @@ func _on_about_to_popup() -> void:
|
|||
tileset_option_button.add_item("New tileset")
|
||||
for i in project.tilesets.size():
|
||||
var tileset := project.tilesets[i]
|
||||
var item_string := " %s (%s×%s)" % [i, tileset.tile_size.x, tileset.tile_size.y]
|
||||
if not tileset.name.is_empty():
|
||||
item_string += ": " + tileset.name
|
||||
tileset_option_button.add_item(tr("Tileset" + item_string))
|
||||
tileset_option_button.add_item(tileset.get_text_info(i))
|
||||
_on_tileset_option_button_item_selected(tileset_option_button.selected)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue