mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Set up the zone editor.
This commit is contained in:
parent
200a030882
commit
0b74e33fc8
@ -1,4 +1,4 @@
|
||||
[gd_resource type="Resource" load_steps=16 format=2]
|
||||
[gd_resource type="Resource" load_steps=17 format=2]
|
||||
|
||||
[ext_resource path="res://addons/world_generator/resources/world_gen_world.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/world_generator/resources/continent.gd" type="Script" id=2]
|
||||
@ -7,7 +7,14 @@
|
||||
[sub_resource type="Resource" id=8]
|
||||
resource_name = "asdasr"
|
||||
script = ExtResource( 3 )
|
||||
rect = Rect2( 29, 23, 63.4, 72.8 )
|
||||
rect = Rect2( 25, 19, 191.4, 127.8 )
|
||||
locked = false
|
||||
subzones = [ ]
|
||||
|
||||
[sub_resource type="Resource" id=13]
|
||||
resource_name = "qqq"
|
||||
script = ExtResource( 3 )
|
||||
rect = Rect2( 0, 0, 200.4, 61.8 )
|
||||
locked = false
|
||||
subzones = [ ]
|
||||
|
||||
@ -16,7 +23,7 @@ resource_name = "wwww"
|
||||
script = ExtResource( 2 )
|
||||
rect = Rect2( 133, 63, 224, 158 )
|
||||
locked = false
|
||||
zones = [ SubResource( 8 ) ]
|
||||
zones = [ SubResource( 8 ), SubResource( 13 ) ]
|
||||
|
||||
[sub_resource type="Resource" id=2]
|
||||
resource_name = "efefef"
|
||||
@ -56,7 +63,7 @@ zones = [ SubResource( 9 ), SubResource( 10 ) ]
|
||||
[sub_resource type="Resource" id=11]
|
||||
resource_name = "q"
|
||||
script = ExtResource( 3 )
|
||||
rect = Rect2( 10, 0, 13, 13 )
|
||||
rect = Rect2( 14, 11, 53, 59 )
|
||||
locked = false
|
||||
subzones = [ ]
|
||||
|
||||
|
@ -6,6 +6,7 @@ var edited_world
|
||||
func refresh() -> void:
|
||||
$TabContainer/World.set_wgworld(edited_world)
|
||||
$TabContainer/Continent.set_wgworld(edited_world)
|
||||
$TabContainer/Zone.set_wgworld(edited_world)
|
||||
|
||||
func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||
edited_world = wgw
|
||||
|
@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://addons/world_generator/ui/MainScreen.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/World.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/Continent.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/Zone.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="WorldGenerator" type="PanelContainer"]
|
||||
anchor_right = 1.0
|
||||
@ -30,32 +31,12 @@ margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="Zone" type="VBoxContainer" parent="TabContainer"]
|
||||
[node name="Zone" parent="TabContainer" instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Zone"]
|
||||
margin_right = 1002.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="AddButton" type="Button" parent="TabContainer/Zone/HBoxContainer"]
|
||||
margin_right = 37.0
|
||||
margin_bottom = 20.0
|
||||
text = "Add"
|
||||
|
||||
[node name="DeleteButton" type="Button" parent="TabContainer/Zone/HBoxContainer"]
|
||||
margin_left = 41.0
|
||||
margin_right = 96.0
|
||||
margin_bottom = 20.0
|
||||
text = "Delete"
|
||||
|
||||
[node name="SubZone" type="VBoxContainer" parent="TabContainer"]
|
||||
visible = false
|
||||
|
82
game/addons/world_generator/ui/tabs/Zone.gd
Normal file
82
game/addons/world_generator/ui/tabs/Zone.gd
Normal file
@ -0,0 +1,82 @@
|
||||
tool
|
||||
extends HBoxContainer
|
||||
|
||||
var edited_world : WorldGenWorld = null
|
||||
var edited_continent : Continent = null
|
||||
var edited_zone : Zone = null
|
||||
|
||||
func _ready():
|
||||
var coption_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
coption_button.connect("item_selected", self, "on_continent_item_selected")
|
||||
|
||||
var zoption_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
||||
zoption_button.connect("item_selected", self, "on_zone_item_selected")
|
||||
|
||||
func refresh_continent() -> void:
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
||||
option_button.clear()
|
||||
|
||||
if !edited_continent:
|
||||
return
|
||||
|
||||
var content : Array = edited_continent.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_zone:
|
||||
edited_zone = c
|
||||
|
||||
func refresh_zone() -> void:
|
||||
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.edit_resource(edited_zone)
|
||||
$HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList.set_edited_resource(edited_zone)
|
||||
$HSplitContainer/RectEditor.set_edited_resource(edited_zone)
|
||||
|
||||
func refresh() -> void:
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
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:
|
||||
edited_world = wgw
|
||||
edited_continent = null
|
||||
edited_zone = null
|
||||
|
||||
refresh()
|
||||
|
||||
func set_continent(continent : Continent) -> void:
|
||||
edited_continent = continent
|
||||
edited_zone = null
|
||||
|
||||
refresh_continent()
|
||||
|
||||
func set_zone(zone : Zone) -> void:
|
||||
edited_zone = zone
|
||||
|
||||
refresh_zone()
|
||||
|
||||
func on_continent_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
|
||||
set_continent(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_zone_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
||||
|
||||
set_zone(option_button.get_item_metadata(idx))
|
102
game/addons/world_generator/ui/tabs/Zone.tscn
Normal file
102
game/addons/world_generator/ui/tabs/Zone.tscn
Normal file
@ -0,0 +1,102 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/Zone.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/world_generator/ui/ResourcePropertyList.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/world_generator/ui/DataList.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/world_generator/ui/RectEditor.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="Zone" type="HBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="RectEditor" parent="HSplitContainer" instance=ExtResource( 4 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 735.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer"]
|
||||
margin_left = 747.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
|
||||
[node name="ContinentOptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer"]
|
||||
margin_right = 277.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="ZoneOptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="HSplitContainer/VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ResourcePropertyList" parent="HSplitContainer/VBoxContainer/HBoxContainer2" instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 100.0
|
||||
margin_bottom = 552.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/HBoxContainer2"]
|
||||
margin_left = 104.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 552.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_right = 173.0
|
||||
margin_bottom = 14.0
|
||||
text = "Zones"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 38.0
|
||||
|
||||
[node name="AddButton" type="Button" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_right = 37.0
|
||||
margin_bottom = 20.0
|
||||
text = "Add"
|
||||
|
||||
[node name="DeleteButton" type="Button" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 41.0
|
||||
margin_right = 96.0
|
||||
margin_bottom = 20.0
|
||||
text = "Delete"
|
||||
|
||||
[node name="Duplicate" type="Button" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 100.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 20.0
|
||||
text = "Duplicate"
|
||||
|
||||
[node name="DataList" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer" instance=ExtResource( 3 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 42.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 552.0
|
||||
|
||||
[connection signal="pressed" from="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/AddButton" to="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList" method="add_button_pressed"]
|
Loading…
Reference in New Issue
Block a user