about summary refs log tree commit diff stats
path: root/apworld/client/pauseMenu.gd
blob: 72b45e80e54b0861768ccf9da5d76f2b9ee4068d (plain) (blame)
pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl
extends "res://scripts/ui/pauseMenu.gd"

var compass_button
var locations_button
var minimap_button


func _ready():
	var ap_panel = Panel.new()
	ap_panel.name = "Archipelago"
	get_node("menu/settings/settingsInner/TabContainer").add_child(ap_panel)

	var ap = global.get_node("Archipelago")

	compass_button = CheckBox.new()
	compass_button.text = "show compass"
	compass_button.button_pressed = ap.show_compass
	compass_button.position = Vector2(65, 100)
	compass_button.theme = preload("res://assets/themes/baseUI.tres")
	compass_button.add_theme_font_size_override("font_size", 60)
	compass_button.pressed.connect(_toggle_compass)
	ap_panel.add_child(compass_button)

	locations_button = CheckBox.new()
	locations_button.text = "show locations overlay"
	locations_button.button_pressed = ap.show_locations
	locations_button.position = Vector2(65, 200)
	locations_button.theme = preload("res://assets/themes/baseUI.tres")
	locations_button.add_theme_font_size_override("font_size", 60)
	locations_button.pressed.connect(_toggle_locations)
	ap_panel.add_child(locations_button)

	minimap_button = CheckBox.new()
	minimap_button.text = "show minimap"
	minimap_button.button_pressed = ap.show_minimap
	minimap_button.position = Vector2(65, 300)
	minimap_button.theme = preload("res://assets/themes/baseUI.tres")
	minimap_button.add_theme_font_size_override("font_size", 60)
	minimap_button.pressed.connect(_toggle_minimap)
	ap_panel.add_child(minimap_button)

	super._ready()


func _pause_game():
	global.get_node("Textclient").dismiss()
	super._pause_game()


func _main_menu():
	global.loaded = false
	global.get_node("Archipelago").disconnect_from_ap()
	global.get_node("Messages").clear()
	global.get_node("Compass").visible = false
	global.get_node("Textclient").reset()

	autosplitter.reset()
	_unpause_game()
	Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
	musicPlayer.stop()

	var runtime = global.get_node("Runtime")
	runtime.load_script_as_scene.call_deferred("settings_screen.gd", "settings_screen")


func _toggle_compass():
	var ap = global.get_node("Archipelago")
	ap.show_compass = compass_button.button_pressed
	ap.saveSettings()

	var compass = global.get_node("Compass")
	compass.visible = compass_button.button_pressed


func _toggle_locations():
	var ap = global.get_node("Archipelago")
	ap.show_locations = locations_button.button_pressed
	ap.saveSettings()

	var textclient = global.get_node("Textclient")
	textclient.update_locations_visibility()


func _toggle_minimap():
	var ap = global.get_node("Archipelago")
	ap.show_minimap = minimap_button.button_pressed
	ap.saveSettings()

	var minimap = get_tree().get_root().get_node("scene/Minimap")
	if minimap != null:
		minimap.visible = ap.show_minimap