mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-22 02:17:18 +01:00
The edit buttons now work in Continent aswell.
This commit is contained in:
parent
f6eb7b0720
commit
8a3ac51e86
@ -7,6 +7,10 @@ func _ready():
|
||||
var world : Control = get_node("TabContainer/World")
|
||||
if !world.is_connected("request_item_edit", self, "on_world_request_item_edit"):
|
||||
world.connect("request_item_edit", self, "on_world_request_item_edit")
|
||||
|
||||
var continent : Control = get_node("TabContainer/Continent")
|
||||
if !continent.is_connected("request_item_edit", self, "on_continent_request_item_edit"):
|
||||
continent.connect("request_item_edit", self, "on_continent_request_item_edit")
|
||||
|
||||
func set_plugin(plugin : EditorPlugin) -> void:
|
||||
$TabContainer/World.set_plugin(plugin)
|
||||
@ -34,3 +38,11 @@ func on_world_request_item_edit(resource : WorldGenBaseResource) -> void:
|
||||
tc.current_tab = cont.get_position_in_parent()
|
||||
|
||||
cont.switch_to(resource)
|
||||
|
||||
func on_continent_request_item_edit(continent : WorldGenBaseResource, resource : WorldGenBaseResource) -> void:
|
||||
var zone : Control = get_node("TabContainer/Zone")
|
||||
|
||||
var tc : TabContainer = get_node("TabContainer")
|
||||
tc.current_tab = zone.get_position_in_parent()
|
||||
|
||||
zone.switch_to(continent, resource)
|
||||
|
@ -4,7 +4,7 @@ extends HBoxContainer
|
||||
var edited_world : WorldGenWorld = null
|
||||
var edited_continent : Continent = null
|
||||
|
||||
signal request_item_edit(world_gen_base_resource)
|
||||
signal request_item_edit(continent, world_gen_base_resource)
|
||||
|
||||
func _ready():
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
|
||||
@ -74,5 +74,5 @@ func on_item_selected(idx : int) -> void:
|
||||
set_continent(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_request_item_edit(resource : WorldGenBaseResource) -> void:
|
||||
emit_signal("request_item_edit", resource)
|
||||
emit_signal("request_item_edit", edited_continent, resource)
|
||||
|
||||
|
@ -86,6 +86,27 @@ func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||
edited_zone = null
|
||||
|
||||
refresh()
|
||||
|
||||
func switch_to(continent : WorldGenBaseResource, resource : WorldGenBaseResource) -> void:
|
||||
var contob : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
|
||||
for i in range(contob.get_item_count()):
|
||||
var ccont : Continent = contob.get_item_metadata(i)
|
||||
|
||||
if (ccont == continent):
|
||||
contob.select(i)
|
||||
on_continent_item_selected(i)
|
||||
break
|
||||
|
||||
var zoneob : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
||||
|
||||
for i in range(zoneob.get_item_count()):
|
||||
var czone : Zone = zoneob.get_item_metadata(i)
|
||||
|
||||
if (czone == resource):
|
||||
zoneob.select(i)
|
||||
on_zone_item_selected(i)
|
||||
return
|
||||
|
||||
func on_continent_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
|
Loading…
Reference in New Issue
Block a user