mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-04-02 05:05:39 +02:00
Implemented edit buttons for the SubZone editor tab.
This commit is contained in:
parent
50505035e8
commit
9e4bd47103
@ -15,6 +15,11 @@ func _ready():
|
|||||||
var zone : Control = get_node("TabContainer/Zone")
|
var zone : Control = get_node("TabContainer/Zone")
|
||||||
if !zone.is_connected("request_item_edit", self, "on_zone_request_item_edit"):
|
if !zone.is_connected("request_item_edit", self, "on_zone_request_item_edit"):
|
||||||
zone.connect("request_item_edit", self, "on_zone_request_item_edit")
|
zone.connect("request_item_edit", self, "on_zone_request_item_edit")
|
||||||
|
|
||||||
|
var subzone : Control = get_node("TabContainer/SubZone")
|
||||||
|
if !subzone.is_connected("request_item_edit", self, "on_subzone_request_item_edit"):
|
||||||
|
subzone.connect("request_item_edit", self, "on_subzone_request_item_edit")
|
||||||
|
|
||||||
|
|
||||||
func set_plugin(plugin : EditorPlugin) -> void:
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
$TabContainer/World.set_plugin(plugin)
|
$TabContainer/World.set_plugin(plugin)
|
||||||
@ -59,3 +64,10 @@ func on_zone_request_item_edit(continent : WorldGenBaseResource, zone : WorldGen
|
|||||||
|
|
||||||
sz.switch_to(continent, zone, subzone)
|
sz.switch_to(continent, zone, subzone)
|
||||||
|
|
||||||
|
func on_subzone_request_item_edit(continent : WorldGenBaseResource, zone : WorldGenBaseResource, subzone : WorldGenBaseResource, subzone_prop : WorldGenBaseResource) -> void:
|
||||||
|
var sz : Control = get_node("TabContainer/SubZoneProp")
|
||||||
|
|
||||||
|
var tc : TabContainer = get_node("TabContainer")
|
||||||
|
tc.current_tab = sz.get_position_in_parent()
|
||||||
|
|
||||||
|
sz.switch_to(continent, zone, subzone, subzone_prop)
|
||||||
|
@ -6,7 +6,7 @@ var edited_continent : Continent = null
|
|||||||
var edited_zone : Zone = null
|
var edited_zone : Zone = null
|
||||||
var edited_sub_zone : SubZone = null
|
var edited_sub_zone : SubZone = null
|
||||||
|
|
||||||
signal request_item_edit(world_gen_base_resource)
|
signal request_item_edit(continent, zone, subzone, subzone_prop)
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
var coption_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
var coption_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||||
@ -164,5 +164,5 @@ func on_sub_zone_item_selected(idx : int) -> void:
|
|||||||
set_sub_zone(option_button.get_item_metadata(idx))
|
set_sub_zone(option_button.get_item_metadata(idx))
|
||||||
|
|
||||||
func on_request_item_edit(resource : WorldGenBaseResource) -> void:
|
func on_request_item_edit(resource : WorldGenBaseResource) -> void:
|
||||||
emit_signal("request_item_edit", resource)
|
emit_signal("request_item_edit", edited_continent, edited_zone, edited_sub_zone, resource)
|
||||||
|
|
||||||
|
@ -135,12 +135,54 @@ func set_sub_zone(sub_zone : SubZone) -> void:
|
|||||||
edited_sub_zone_prop = null
|
edited_sub_zone_prop = null
|
||||||
|
|
||||||
sub_zone_changed()
|
sub_zone_changed()
|
||||||
|
|
||||||
func set_sub_zone_prop(sub_zone_prop : SubZoneProp) -> void:
|
func set_sub_zone_prop(sub_zone_prop : SubZoneProp) -> void:
|
||||||
edited_sub_zone_prop = sub_zone_prop
|
edited_sub_zone_prop = sub_zone_prop
|
||||||
|
|
||||||
sub_zone_prop_changed()
|
sub_zone_prop_changed()
|
||||||
|
|
||||||
|
func switch_to(continent : WorldGenBaseResource, zone : WorldGenBaseResource, subzone : WorldGenBaseResource, subzone_prop : WorldGenBaseResource) -> void:
|
||||||
|
var contob : OptionButton = $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 = $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 = $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)
|
||||||
|
break
|
||||||
|
|
||||||
|
var subzonepropob : OptionButton = $VBoxContainer/SubZonePropOptionButton
|
||||||
|
|
||||||
|
for i in range(subzonepropob.get_item_count()):
|
||||||
|
var cszoneprop : SubZoneProp = subzonepropob.get_item_metadata(i)
|
||||||
|
|
||||||
|
if (cszoneprop == subzone_prop):
|
||||||
|
subzonepropob.select(i)
|
||||||
|
set_sub_zone_prop(subzone_prop)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func on_continent_item_selected(idx : int) -> void:
|
func on_continent_item_selected(idx : int) -> void:
|
||||||
var option_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
var option_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user