mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-20 21:07:17 +01:00
Also implement edit buttons in the Zone editor tab.
This commit is contained in:
parent
8a3ac51e86
commit
50505035e8
@ -11,6 +11,10 @@ func _ready():
|
||||
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")
|
||||
|
||||
var zone : Control = get_node("TabContainer/Zone")
|
||||
if !zone.is_connected("request_item_edit", self, "on_zone_request_item_edit"):
|
||||
zone.connect("request_item_edit", self, "on_zone_request_item_edit")
|
||||
|
||||
func set_plugin(plugin : EditorPlugin) -> void:
|
||||
$TabContainer/World.set_plugin(plugin)
|
||||
@ -46,3 +50,12 @@ func on_continent_request_item_edit(continent : WorldGenBaseResource, resource :
|
||||
tc.current_tab = zone.get_position_in_parent()
|
||||
|
||||
zone.switch_to(continent, resource)
|
||||
|
||||
func on_zone_request_item_edit(continent : WorldGenBaseResource, zone : WorldGenBaseResource, subzone : WorldGenBaseResource) -> void:
|
||||
var sz : Control = get_node("TabContainer/SubZone")
|
||||
|
||||
var tc : TabContainer = get_node("TabContainer")
|
||||
tc.current_tab = sz.get_position_in_parent()
|
||||
|
||||
sz.switch_to(continent, zone, subzone)
|
||||
|
||||
|
@ -117,6 +117,37 @@ func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||
|
||||
refresh()
|
||||
|
||||
func switch_to(continent : WorldGenBaseResource, zone : WorldGenBaseResource, subzone : 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 == zone):
|
||||
zoneob.select(i)
|
||||
on_zone_item_selected(i)
|
||||
break
|
||||
|
||||
var subzoneob : OptionButton = $HSplitContainer/VBoxContainer/SubZoneOptionButton
|
||||
|
||||
for i in range(subzoneob.get_item_count()):
|
||||
var cszone : SubZone = subzoneob.get_item_metadata(i)
|
||||
|
||||
if (cszone == subzone):
|
||||
subzoneob.select(i)
|
||||
set_sub_zone(subzone)
|
||||
return
|
||||
|
||||
func on_continent_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
|
||||
|
@ -5,7 +5,7 @@ var edited_world : WorldGenWorld = null
|
||||
var edited_continent : Continent = null
|
||||
var edited_zone : Zone = null
|
||||
|
||||
signal request_item_edit(world_gen_base_resource)
|
||||
signal request_item_edit(continent, zone, subzone)
|
||||
|
||||
func _ready():
|
||||
var coption_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
@ -119,5 +119,4 @@ func on_zone_item_selected(idx : int) -> void:
|
||||
set_zone(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, edited_zone, resource)
|
||||
|
Loading…
Reference in New Issue
Block a user