mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-05-07 05:51:36 +02:00
Set up continent select dropdown.
This commit is contained in:
parent
65562c6523
commit
b30016bc28
@ -1,15 +1,51 @@
|
|||||||
tool
|
tool
|
||||||
extends HBoxContainer
|
extends HBoxContainer
|
||||||
|
|
||||||
var edited_world
|
var edited_world : WorldGenWorld = null
|
||||||
|
var edited_continent : Continent = null
|
||||||
|
|
||||||
func refresh() -> void:
|
func _ready():
|
||||||
pass
|
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
|
||||||
|
option_button.connect("item_selected", self, "on_item_selected")
|
||||||
|
|
||||||
|
func refresh_continent() -> void:
|
||||||
# $HSplitContainer/ResourcePropertyList.edit_resource(edited_world)
|
# $HSplitContainer/ResourcePropertyList.edit_resource(edited_world)
|
||||||
# $VBoxContainer/DataList.set_edited_resource(edited_world)
|
# $VBoxContainer/DataList.set_edited_resource(edited_world)
|
||||||
# $HSplitContainer/RectEditor.set_edited_resource(edited_world)
|
# $HSplitContainer/RectEditor.set_edited_resource(edited_world)
|
||||||
|
|
||||||
|
if !edited_continent:
|
||||||
|
return
|
||||||
|
|
||||||
|
func refresh() -> void:
|
||||||
|
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
|
||||||
|
option_button.clear()
|
||||||
|
|
||||||
|
if !edited_world:
|
||||||
|
return
|
||||||
|
|
||||||
|
var content : Array = edited_world.get_content()
|
||||||
|
|
||||||
|
for c in content:
|
||||||
|
if c:
|
||||||
|
option_button.add_item(c.resource_name)
|
||||||
|
option_button.set_item_metadata(option_button.get_item_count() - 1, c)
|
||||||
|
|
||||||
|
if !edited_continent:
|
||||||
|
edited_continent = c
|
||||||
|
|
||||||
|
refresh_continent()
|
||||||
|
|
||||||
func set_wgworld(wgw : WorldGenWorld) -> void:
|
func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||||
edited_world = wgw
|
edited_world = wgw
|
||||||
|
|
||||||
refresh()
|
refresh()
|
||||||
|
|
||||||
|
func set_continent(continent : Continent) -> void:
|
||||||
|
edited_continent = continent
|
||||||
|
|
||||||
|
refresh_continent()
|
||||||
|
|
||||||
|
func on_item_selected(idx : int) -> void:
|
||||||
|
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
|
||||||
|
|
||||||
|
set_continent(option_button.get_item_metadata(idx))
|
||||||
|
@ -32,7 +32,7 @@ margin_left = 747.0
|
|||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
margin_bottom = 600.0
|
margin_bottom = 600.0
|
||||||
|
|
||||||
[node name="MenuButton" type="OptionButton" parent="HSplitContainer/VBoxContainer"]
|
[node name="OptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer"]
|
||||||
margin_right = 277.0
|
margin_right = 277.0
|
||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
selected = 0
|
selected = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user