Mobile Controls
This commit is contained in:
@@ -22,6 +22,9 @@ const WORLD_TILE_SIZE := TILE_SIZE * TILE_SCALE # 32 pixels per tile in world
|
||||
@onready var inventory_panel = $Inventory
|
||||
@onready var chat_panel = $Chat
|
||||
|
||||
# Crafting panel (loaded dynamically)
|
||||
var crafting_panel = null
|
||||
|
||||
# Visual tile renderer (for V2 dungeons)
|
||||
var visual_renderer: VisualTileMapRenderer = null
|
||||
|
||||
@@ -41,6 +44,9 @@ var projectiles: Dictionary = {} # id -> projectile node
|
||||
var aim_angle: float = 0.0
|
||||
|
||||
func _ready():
|
||||
# Add to group for HUD to access
|
||||
add_to_group("dungeon_manager")
|
||||
|
||||
# Load entity scenes
|
||||
if ResourceLoader.exists("res://scenes/dungeon/other_player.tscn"):
|
||||
player_scene = load("res://scenes/dungeon/other_player.tscn")
|
||||
@@ -59,16 +65,23 @@ func _ready():
|
||||
if ResourceLoader.exists("res://scenes/dungeon/damage_number.tscn"):
|
||||
damage_number_scene = load("res://scenes/dungeon/damage_number.tscn")
|
||||
|
||||
# Load crafting UI
|
||||
if ResourceLoader.exists("res://scenes/ui/crafting_ui.tscn"):
|
||||
var crafting_scene = load("res://scenes/ui/crafting_ui.tscn")
|
||||
crafting_panel = crafting_scene.instantiate()
|
||||
crafting_panel.visible = false
|
||||
add_child(crafting_panel)
|
||||
|
||||
# Create visual tile renderer
|
||||
visual_renderer = VisualTileMapRenderer.new()
|
||||
visual_renderer.name = "VisualTileRenderer"
|
||||
add_child(visual_renderer)
|
||||
# Move it behind entities
|
||||
move_child(visual_renderer, 0)
|
||||
|
||||
|
||||
# Defer GameState connections
|
||||
call_deferred("_connect_gamestate")
|
||||
|
||||
|
||||
# Initially hidden
|
||||
visible = false
|
||||
|
||||
@@ -93,10 +106,13 @@ func _on_game_state_changed(state: String):
|
||||
if hud:
|
||||
hud.visible = is_playing
|
||||
|
||||
# Hide inventory when leaving dungeon
|
||||
if not is_playing and inventory_panel:
|
||||
inventory_panel.visible = false
|
||||
|
||||
# Hide inventory and crafting when leaving dungeon
|
||||
if not is_playing:
|
||||
if inventory_panel:
|
||||
inventory_panel.visible = false
|
||||
if crafting_panel:
|
||||
crafting_panel.visible = false
|
||||
|
||||
# Clear visual tiles when leaving dungeon
|
||||
if not is_playing and visual_renderer:
|
||||
visual_renderer.clear_tiles()
|
||||
@@ -185,10 +201,32 @@ func _build_tiles():
|
||||
|
||||
print("[DungeonManager] Tilemap built: %dx%d" % [width, height])
|
||||
|
||||
func _input(event: InputEvent):
|
||||
# Handle touch screen taps for attacking
|
||||
if event is InputEventScreenTouch and event.pressed:
|
||||
var ui_open = (inventory_panel and inventory_panel.visible) or (chat_panel and chat_panel.visible)
|
||||
|
||||
# Don't attack if UI is open
|
||||
if ui_open:
|
||||
return
|
||||
|
||||
# Calculate attack direction from touch position to player
|
||||
var touch_world_pos = camera.get_global_mouse_position()
|
||||
var player_pos = Vector2(GameState.self_player.get("x", 0), GameState.self_player.get("y", 0))
|
||||
var attack_angle = (touch_world_pos - player_pos).angle()
|
||||
|
||||
# Update aim angle for visual feedback
|
||||
aim_angle = attack_angle
|
||||
if player_node and player_node.has_method("set_aim_angle"):
|
||||
player_node.set_aim_angle(aim_angle)
|
||||
|
||||
# Perform attack
|
||||
_perform_attack(attack_angle)
|
||||
|
||||
func _process(delta):
|
||||
if not GameState or GameState.current_state != GameState.STATE_PLAYING:
|
||||
return
|
||||
|
||||
|
||||
_handle_input()
|
||||
_update_camera(delta)
|
||||
|
||||
@@ -201,47 +239,23 @@ func _physics_process(_delta):
|
||||
func _handle_input():
|
||||
if not camera:
|
||||
return
|
||||
|
||||
|
||||
# Don't process game input if inventory or chat is open
|
||||
var ui_open = (inventory_panel and inventory_panel.visible) or (chat_panel and chat_panel.visible)
|
||||
|
||||
# Calculate aim angle from mouse
|
||||
|
||||
# Calculate aim angle from mouse/touch position
|
||||
var mouse_pos = get_global_mouse_position()
|
||||
var player_screen_pos = camera.get_screen_center_position()
|
||||
aim_angle = (mouse_pos - player_screen_pos).angle()
|
||||
|
||||
|
||||
# Update player aim visual
|
||||
if player_node and player_node.has_method("set_aim_angle"):
|
||||
player_node.set_aim_angle(aim_angle)
|
||||
|
||||
# Attack on click (only if UI not open)
|
||||
|
||||
# Attack on click/touch (only if UI not open)
|
||||
# This handles both mouse clicks and touch taps
|
||||
if not ui_open and Input.is_action_just_pressed("attack"):
|
||||
# Check if player has a ranged weapon equipped
|
||||
var equipped_weapon = GameState.equipment.get("weapon", null)
|
||||
if equipped_weapon != null and not equipped_weapon.is_empty():
|
||||
# Server sends camelCase properties
|
||||
var requires_ammo = equipped_weapon.get("requiresAmmunition", false)
|
||||
var is_throwable = equipped_weapon.get("isThrowable", false)
|
||||
var projectile_speed = equipped_weapon.get("projectileSpeed", 0)
|
||||
|
||||
print("[DungeonManager] Attack - Weapon: ", equipped_weapon.get("name", "Unknown"))
|
||||
print("[DungeonManager] RequiresAmmo: ", requires_ammo, ", IsThrowable: ", is_throwable, ", Speed: ", projectile_speed)
|
||||
|
||||
# If weapon fires projectiles (bow, crossbow, throwable), send projectile fire
|
||||
if (requires_ammo or is_throwable) and projectile_speed > 0:
|
||||
print("[DungeonManager] Firing projectile!")
|
||||
# Calculate direction vector from aim angle
|
||||
var direction_x = cos(aim_angle)
|
||||
var direction_y = sin(aim_angle)
|
||||
GameState.send_fire_projectile(direction_x, direction_y)
|
||||
else:
|
||||
print("[DungeonManager] Using melee attack")
|
||||
# Melee weapon - use normal attack
|
||||
GameState.send_attack(aim_angle)
|
||||
else:
|
||||
print("[DungeonManager] No weapon equipped, using fists")
|
||||
# No weapon or empty slot - use normal attack (fists)
|
||||
GameState.send_attack(aim_angle)
|
||||
_perform_attack(aim_angle)
|
||||
|
||||
# Inventory toggle (I key)
|
||||
if Input.is_action_just_pressed("inventory"):
|
||||
@@ -250,8 +264,10 @@ func _handle_input():
|
||||
|
||||
# Escape handling - close UI panels, or show hint about portals
|
||||
if Input.is_action_just_pressed("escape_menu"):
|
||||
# Close UI first
|
||||
if inventory_panel and inventory_panel.visible:
|
||||
# Close UI first (in priority order)
|
||||
if crafting_panel and crafting_panel.visible:
|
||||
crafting_panel.visible = false
|
||||
elif inventory_panel and inventory_panel.visible:
|
||||
inventory_panel.visible = false
|
||||
elif chat_panel and chat_panel.visible:
|
||||
chat_panel.visible = false
|
||||
@@ -269,6 +285,34 @@ func _handle_input():
|
||||
if Input.is_action_just_pressed("hotbar_%d" % i):
|
||||
_use_hotbar_slot(i - 1)
|
||||
|
||||
func _perform_attack(attack_angle: float):
|
||||
# Check if player has a ranged weapon equipped
|
||||
var equipped_weapon = GameState.equipment.get("weapon", null)
|
||||
if equipped_weapon != null and not equipped_weapon.is_empty():
|
||||
# Server sends camelCase properties
|
||||
var requires_ammo = equipped_weapon.get("requiresAmmunition", false)
|
||||
var is_throwable = equipped_weapon.get("isThrowable", false)
|
||||
var projectile_speed = equipped_weapon.get("projectileSpeed", 0)
|
||||
|
||||
print("[DungeonManager] Attack - Weapon: ", equipped_weapon.get("name", "Unknown"))
|
||||
print("[DungeonManager] RequiresAmmo: ", requires_ammo, ", IsThrowable: ", is_throwable, ", Speed: ", projectile_speed)
|
||||
|
||||
# If weapon fires projectiles (bow, crossbow, throwable), send projectile fire
|
||||
if (requires_ammo or is_throwable) and projectile_speed > 0:
|
||||
print("[DungeonManager] Firing projectile!")
|
||||
# Calculate direction vector from aim angle
|
||||
var direction_x = cos(attack_angle)
|
||||
var direction_y = sin(attack_angle)
|
||||
GameState.send_fire_projectile(direction_x, direction_y)
|
||||
else:
|
||||
print("[DungeonManager] Using melee attack")
|
||||
# Melee weapon - use normal attack
|
||||
GameState.send_attack(attack_angle)
|
||||
else:
|
||||
print("[DungeonManager] No weapon equipped, using fists")
|
||||
# No weapon or empty slot - use normal attack (fists)
|
||||
GameState.send_attack(attack_angle)
|
||||
|
||||
func _send_movement():
|
||||
# Don't move if UI is open
|
||||
var ui_open = (inventory_panel and inventory_panel.visible) or (chat_panel and chat_panel.visible)
|
||||
@@ -362,6 +406,15 @@ func _toggle_inventory():
|
||||
if inventory_panel.visible and Network:
|
||||
Network.send_message(OpCodes.INVENTORY_REQUEST, {})
|
||||
|
||||
func _toggle_crafting():
|
||||
if crafting_panel:
|
||||
if crafting_panel.visible:
|
||||
crafting_panel.visible = false
|
||||
else:
|
||||
crafting_panel.show_crafting()
|
||||
else:
|
||||
print("[DungeonManager] Crafting UI not loaded")
|
||||
|
||||
func _open_chat():
|
||||
if chat_panel:
|
||||
chat_panel.visible = true
|
||||
|
||||
+198
-1
@@ -25,11 +25,23 @@ extends CanvasLayer
|
||||
@onready var char_sheet_ui = $CharSheetUI
|
||||
@onready var char_sheet_btn = $Control/CharSheetBtn
|
||||
|
||||
# Settings panel
|
||||
var settings_panel: Panel = null
|
||||
var settings_btn: TextureButton = null
|
||||
var mobile_controls_toggle: CheckBox = null
|
||||
var logout_btn: Button = null
|
||||
|
||||
var selected_tier: int = 1
|
||||
|
||||
func _ready():
|
||||
_create_settings_panel()
|
||||
enter_btn.pressed.connect(_on_enter_dungeon)
|
||||
|
||||
|
||||
# Connect to UpdateManager to refresh settings icon when downloaded
|
||||
if UpdateManager:
|
||||
UpdateManager.file_downloaded.connect(_on_settings_file_downloaded)
|
||||
UpdateManager.update_completed.connect(_on_update_completed)
|
||||
|
||||
# Setup browse button if it exists
|
||||
if browse_btn:
|
||||
browse_btn.pressed.connect(_on_browse_dungeons)
|
||||
@@ -109,3 +121,188 @@ func _on_stash_pressed():
|
||||
func _toggle_char_sheet():
|
||||
if char_sheet_ui:
|
||||
char_sheet_ui.visible = not char_sheet_ui.visible
|
||||
|
||||
func _create_settings_panel():
|
||||
# Create settings button (top right corner, smaller)
|
||||
settings_btn = TextureButton.new()
|
||||
settings_btn.custom_minimum_size = Vector2(16, 16)
|
||||
|
||||
# Load settings icon from CDN
|
||||
var texture_loaded = false
|
||||
if UpdateManager:
|
||||
var settings_texture = UpdateManager.load_texture("textures/ui/buttons/settings.png")
|
||||
if settings_texture:
|
||||
settings_btn.texture_normal = settings_texture
|
||||
settings_btn.scale = Vector2(.5,.5)
|
||||
texture_loaded = true
|
||||
|
||||
# Fallback: add a visible background if texture doesn't load
|
||||
if not texture_loaded:
|
||||
var fallback_style = StyleBoxFlat.new()
|
||||
fallback_style.bg_color = Color(0.3, 0.3, 0.35, 0.9)
|
||||
fallback_style.border_color = Color(0.5, 0.5, 0.6)
|
||||
fallback_style.set_border_width_all(2)
|
||||
fallback_style.set_corner_radius_all(8)
|
||||
settings_btn.add_theme_stylebox_override("normal", fallback_style)
|
||||
|
||||
|
||||
# Add a label to show "⚙" gear icon
|
||||
var label = Label.new()
|
||||
label.text = "⚙"
|
||||
label.add_theme_font_size_override("font_size", 18)
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
label.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
settings_btn.add_child(label)
|
||||
|
||||
settings_btn.pressed.connect(_toggle_settings_panel)
|
||||
add_child(settings_btn)
|
||||
|
||||
# Position top right corner (moved further left)
|
||||
settings_btn.set_anchors_and_offsets_preset(Control.PRESET_TOP_RIGHT)
|
||||
settings_btn.offset_left = -100
|
||||
settings_btn.offset_top = 10
|
||||
settings_btn.offset_right = -118
|
||||
settings_btn.offset_bottom = 42
|
||||
|
||||
# Create settings panel (initially hidden)
|
||||
settings_panel = Panel.new()
|
||||
settings_panel.custom_minimum_size = Vector2(300, 250)
|
||||
settings_panel.visible = false
|
||||
add_child(settings_panel)
|
||||
|
||||
# Position center of screen
|
||||
settings_panel.set_anchors_and_offsets_preset(Control.PRESET_CENTER)
|
||||
settings_panel.offset_left = -150
|
||||
settings_panel.offset_top = -125
|
||||
settings_panel.offset_right = 150
|
||||
settings_panel.offset_bottom = 125
|
||||
|
||||
# Panel styling
|
||||
var panel_style = StyleBoxFlat.new()
|
||||
panel_style.bg_color = Color(0.15, 0.15, 0.2, 0.95)
|
||||
panel_style.border_color = Color(0.4, 0.4, 0.5)
|
||||
panel_style.set_border_width_all(2)
|
||||
panel_style.set_corner_radius_all(8)
|
||||
settings_panel.add_theme_stylebox_override("panel", panel_style)
|
||||
|
||||
# Settings panel content
|
||||
var vbox = VBoxContainer.new()
|
||||
vbox.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
vbox.offset_left = 10
|
||||
vbox.offset_top = 10
|
||||
vbox.offset_right = -10
|
||||
vbox.offset_bottom = -10
|
||||
settings_panel.add_child(vbox)
|
||||
|
||||
# Title
|
||||
var title = Label.new()
|
||||
title.text = "Settings"
|
||||
title.add_theme_font_size_override("font_size", 24)
|
||||
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
vbox.add_child(title)
|
||||
|
||||
# Spacer
|
||||
var spacer1 = Control.new()
|
||||
spacer1.custom_minimum_size = Vector2(0, 20)
|
||||
vbox.add_child(spacer1)
|
||||
|
||||
# Mobile controls toggle
|
||||
mobile_controls_toggle = CheckBox.new()
|
||||
mobile_controls_toggle.text = "Enable Mobile Controls"
|
||||
mobile_controls_toggle.button_pressed = _get_mobile_controls_enabled()
|
||||
mobile_controls_toggle.toggled.connect(_on_mobile_controls_toggled)
|
||||
vbox.add_child(mobile_controls_toggle)
|
||||
|
||||
# Spacer
|
||||
var spacer2 = Control.new()
|
||||
spacer2.custom_minimum_size = Vector2(0, 20)
|
||||
vbox.add_child(spacer2)
|
||||
|
||||
# Logout button
|
||||
logout_btn = Button.new()
|
||||
logout_btn.text = "Logout"
|
||||
logout_btn.custom_minimum_size = Vector2(0, 40)
|
||||
|
||||
var logout_style = StyleBoxFlat.new()
|
||||
logout_style.bg_color = Color(0.8, 0.2, 0.2, 0.9)
|
||||
logout_style.border_color = Color(1.0, 0.4, 0.4)
|
||||
logout_style.set_border_width_all(2)
|
||||
logout_style.set_corner_radius_all(4)
|
||||
logout_btn.add_theme_stylebox_override("normal", logout_style)
|
||||
|
||||
logout_btn.pressed.connect(_on_logout_pressed)
|
||||
vbox.add_child(logout_btn)
|
||||
|
||||
# Spacer (push close button to bottom)
|
||||
var spacer3 = Control.new()
|
||||
spacer3.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
vbox.add_child(spacer3)
|
||||
|
||||
# Close button
|
||||
var close_btn = Button.new()
|
||||
close_btn.text = "Close"
|
||||
close_btn.custom_minimum_size = Vector2(0, 40)
|
||||
close_btn.pressed.connect(_toggle_settings_panel)
|
||||
vbox.add_child(close_btn)
|
||||
|
||||
func _toggle_settings_panel():
|
||||
if settings_panel:
|
||||
settings_panel.visible = not settings_panel.visible
|
||||
|
||||
func _get_mobile_controls_enabled() -> bool:
|
||||
# Check if mobile controls are enabled (stored in config or default to true on mobile)
|
||||
if OS.has_feature("mobile"):
|
||||
return ProjectSettings.get_setting("application/config/mobile_controls_enabled", true)
|
||||
return ProjectSettings.get_setting("application/config/mobile_controls_enabled", false)
|
||||
|
||||
func _on_mobile_controls_toggled(enabled: bool):
|
||||
# Save setting
|
||||
ProjectSettings.set_setting("application/config/mobile_controls_enabled", enabled)
|
||||
|
||||
# Apply to current HUD if in dungeon
|
||||
var hud = get_tree().get_first_node_in_group("hud")
|
||||
if hud and hud.has_method("set_mobile_controls_visible"):
|
||||
hud.set_mobile_controls_visible(enabled)
|
||||
|
||||
print("[Settings] Mobile controls ", "enabled" if enabled else "disabled")
|
||||
|
||||
func _on_logout_pressed():
|
||||
print("[Settings] Logging out...")
|
||||
|
||||
# Hide settings panel
|
||||
if settings_panel:
|
||||
settings_panel.visible = false
|
||||
|
||||
# Disconnect from server
|
||||
if Network:
|
||||
Network.disconnect_from_server()
|
||||
|
||||
# Reset GameState
|
||||
if GameState:
|
||||
GameState.reset_state()
|
||||
|
||||
# Return to login screen
|
||||
get_tree().change_scene_to_file("res://scenes/ui/login.tscn")
|
||||
|
||||
func _on_settings_file_downloaded(file_path: String):
|
||||
# Check if the settings icon was downloaded
|
||||
if file_path == "textures/ui/buttons/settings.png" and settings_btn:
|
||||
var settings_texture = UpdateManager.load_texture("textures/ui/buttons/settings.png")
|
||||
if settings_texture:
|
||||
settings_btn.texture_normal = settings_texture
|
||||
# Remove fallback styling if it was applied
|
||||
if settings_btn.get_child_count() > 0:
|
||||
for child in settings_btn.get_children():
|
||||
child.queue_free()
|
||||
|
||||
func _on_update_completed(_count: int):
|
||||
# Try to load settings icon after all updates complete
|
||||
if settings_btn and UpdateManager:
|
||||
var settings_texture = UpdateManager.load_texture("textures/ui/buttons/settings.png")
|
||||
if settings_texture:
|
||||
settings_btn.texture_normal = settings_texture
|
||||
# Remove fallback styling if it was applied
|
||||
if settings_btn.get_child_count() > 0:
|
||||
for child in settings_btn.get_children():
|
||||
child.queue_free()
|
||||
|
||||
@@ -23,14 +23,24 @@ var hotbar_slots: Array = []
|
||||
var minimap_image: Image = null
|
||||
var minimap_tex: ImageTexture = null
|
||||
|
||||
# Mobile UI buttons
|
||||
var inventory_button: Button = null
|
||||
var crafting_button: Button = null
|
||||
|
||||
const MINIMAP_SIZE := 120
|
||||
const MINIMAP_SCALE := 3 # How many world pixels per minimap pixel
|
||||
|
||||
func _ready():
|
||||
add_to_group("hud")
|
||||
_setup_hotbar()
|
||||
_setup_minimap()
|
||||
_setup_mobile_buttons()
|
||||
call_deferred("_connect_gamestate")
|
||||
|
||||
# Apply mobile controls visibility based on settings
|
||||
var mobile_enabled = _get_mobile_controls_enabled()
|
||||
set_mobile_controls_visible(mobile_enabled)
|
||||
|
||||
func _connect_gamestate():
|
||||
if GameState:
|
||||
GameState.dungeon_state_updated.connect(_update_resources)
|
||||
@@ -117,6 +127,63 @@ func _setup_minimap():
|
||||
if minimap_texture:
|
||||
minimap_texture.texture = minimap_tex
|
||||
|
||||
func _setup_mobile_buttons():
|
||||
# Create inventory button (bottom right)
|
||||
inventory_button = Button.new()
|
||||
inventory_button.text = "Inv"
|
||||
inventory_button.custom_minimum_size = Vector2(60, 60)
|
||||
|
||||
var inv_style = StyleBoxFlat.new()
|
||||
inv_style.bg_color = Color(0.2, 0.3, 0.5, 0.9)
|
||||
inv_style.border_color = Color(0.4, 0.5, 0.7)
|
||||
inv_style.set_border_width_all(2)
|
||||
inv_style.set_corner_radius_all(8)
|
||||
inventory_button.add_theme_stylebox_override("normal", inv_style)
|
||||
|
||||
inventory_button.pressed.connect(_on_mobile_inventory_pressed)
|
||||
add_child(inventory_button)
|
||||
|
||||
# Position bottom right, above joystick
|
||||
inventory_button.set_anchors_and_offsets_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
inventory_button.offset_left = -70
|
||||
inventory_button.offset_top = -140
|
||||
inventory_button.offset_right = -10
|
||||
inventory_button.offset_bottom = -80
|
||||
|
||||
# Create crafting button (bottom right, above inventory)
|
||||
crafting_button = Button.new()
|
||||
crafting_button.text = "Craft"
|
||||
crafting_button.custom_minimum_size = Vector2(60, 60)
|
||||
|
||||
var craft_style = StyleBoxFlat.new()
|
||||
craft_style.bg_color = Color(0.5, 0.3, 0.2, 0.9)
|
||||
craft_style.border_color = Color(0.7, 0.5, 0.4)
|
||||
craft_style.set_border_width_all(2)
|
||||
craft_style.set_corner_radius_all(8)
|
||||
crafting_button.add_theme_stylebox_override("normal", craft_style)
|
||||
|
||||
crafting_button.pressed.connect(_on_mobile_crafting_pressed)
|
||||
add_child(crafting_button)
|
||||
|
||||
# Position bottom right, above inventory button
|
||||
crafting_button.set_anchors_and_offsets_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
crafting_button.offset_left = -70
|
||||
crafting_button.offset_top = -210
|
||||
crafting_button.offset_right = -10
|
||||
crafting_button.offset_bottom = -150
|
||||
|
||||
func _on_mobile_inventory_pressed():
|
||||
# Toggle inventory visibility
|
||||
var dungeon_manager = get_tree().get_first_node_in_group("dungeon_manager")
|
||||
if dungeon_manager and dungeon_manager.has_method("_toggle_inventory"):
|
||||
dungeon_manager._toggle_inventory()
|
||||
|
||||
func _on_mobile_crafting_pressed():
|
||||
# Toggle crafting UI visibility
|
||||
var dungeon_manager = get_tree().get_first_node_in_group("dungeon_manager")
|
||||
if dungeon_manager and dungeon_manager.has_method("_toggle_crafting"):
|
||||
dungeon_manager._toggle_crafting()
|
||||
|
||||
func _generate_minimap():
|
||||
if not GameState or GameState.dungeon.tiles.is_empty():
|
||||
return
|
||||
@@ -356,3 +423,20 @@ func add_log_entry(text: String, color: Color):
|
||||
var child = event_log.get_child(0)
|
||||
if is_instance_valid(child):
|
||||
child.queue_free()
|
||||
|
||||
func _get_mobile_controls_enabled() -> bool:
|
||||
if OS.has_feature("mobile"):
|
||||
return ProjectSettings.get_setting("application/config/mobile_controls_enabled", true)
|
||||
return ProjectSettings.get_setting("application/config/mobile_controls_enabled", false)
|
||||
|
||||
func set_mobile_controls_visible(visible: bool):
|
||||
# Show/hide mobile UI buttons
|
||||
if inventory_button:
|
||||
inventory_button.visible = visible
|
||||
if crafting_button:
|
||||
crafting_button.visible = visible
|
||||
|
||||
# Show/hide touch joystick
|
||||
var joystick = get_node_or_null("TouchJoystick")
|
||||
if joystick:
|
||||
joystick.visible = visible
|
||||
|
||||
Reference in New Issue
Block a user