UI ItemList -> GroundMap fix, unselect item after selection
This commit is contained in:
parent
46741f7e52
commit
e2055f7bc7
5 changed files with 24 additions and 14 deletions
|
|
@ -2,12 +2,16 @@ extends TileMapLayer
|
|||
|
||||
signal hex_clicked(cell_pos:Vector2, atlas_coords:Vector2)
|
||||
|
||||
var interaction_enabled:bool = true
|
||||
|
||||
func _ready():
|
||||
print("TileMapLayer is alive")
|
||||
|
||||
|
||||
func _input(event: InputEvent):
|
||||
#print("Unhandled input")
|
||||
if not interaction_enabled: return
|
||||
if %MapMenuContainer.visible==true: return
|
||||
|
||||
if event is InputEventMouseButton:
|
||||
if event.pressed==false: return
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ func _ready():
|
|||
|
||||
ground_map.hex_clicked.connect(_on_hex_clicked)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var atlas_texture = AtlasTexture.new()
|
||||
var atlas_image = Image.new()
|
||||
|
||||
|
|
@ -96,3 +92,13 @@ func _on_map_item_selected(index: int) -> void: # 1 laden, 2 speichern, 3 speich
|
|||
%ResourceSaver.saveMap(Global.settings.current_project_dir + "/" + Global.settings.current_map_name)
|
||||
3: print("Karte speichern als")
|
||||
map_menu_container.hide()
|
||||
|
||||
|
||||
func _on_menu_interaction_started():
|
||||
print("Disabling TileMap clickability")
|
||||
ground_map.interaction_enabled = false
|
||||
|
||||
func _on_menu_interaction_ended():
|
||||
print("Enabling TileMap clickability")
|
||||
ground_map.interaction_enabled = true
|
||||
%MapItemList.deselect_all()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ extends Button
|
|||
@onready var listcontainer = %MapMenuContainer
|
||||
@onready var map_item_list = %MapItemList
|
||||
|
||||
|
||||
func _ready():
|
||||
pressed.connect(_show_item_list)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,15 +16,12 @@ func saveMap(absolute_map_filename:String):
|
|||
var tile_id = %GroundMapLayer.get_cell_source_id(cell_pos)
|
||||
var atlas_coords = %GroundMapLayer.get_cell_atlas_coords(cell_pos)
|
||||
var source_id = %GroundMapLayer.get_cell_source_id(cell_pos)
|
||||
print("Storing %s,%s,%s" % [cell_pos, source_id, atlas_coords])
|
||||
print(cell_pos)
|
||||
print(source_id)
|
||||
print(atlas_coords)
|
||||
|
||||
|
||||
#print("Storing %s,%s,%s" % [cell_pos, source_id, atlas_coords])
|
||||
#print(cell_pos)
|
||||
#print(source_id)
|
||||
#print(atlas_coords)
|
||||
map_data.ground_tiles.append( [cell_pos, source_id, atlas_coords] )
|
||||
print(">>", map_data.ground_tiles)
|
||||
print(map_data.ground_tiles)
|
||||
|
||||
ResourceSaver.save(map_data, absolute_map_filename)
|
||||
print("Saved {0}".format([absolute_map_filename]))
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ func _ready():
|
|||
|
||||
#map_menu.pressed.connect(map_manager._on_map_menu_toggled)
|
||||
map_menu_item_list.item_selected.connect(map_manager._on_map_item_selected)
|
||||
map_menu_item_list.focus_entered.connect(map_manager._on_menu_interaction_started)
|
||||
map_menu_item_list.focus_exited.connect(map_manager._on_menu_interaction_ended)
|
||||
|
||||
palette_panel.mouse_entered.connect(map_cursor_timer.disable_cursor)
|
||||
palette_panel.mouse_exited.connect(map_cursor_timer.enable_cursor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue