mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Set up the subzone editor.
This commit is contained in:
parent
0b74e33fc8
commit
900f402370
@ -1,15 +1,28 @@
|
||||
[gd_resource type="Resource" load_steps=17 format=2]
|
||||
[gd_resource type="Resource" load_steps=20 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]
|
||||
[ext_resource path="res://addons/world_generator/resources/zone.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/world_generator/resources/subzone.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="Resource" id=14]
|
||||
resource_name = "qwe"
|
||||
script = ExtResource( 4 )
|
||||
rect = Rect2( 12, 17, 159.14, 87.78 )
|
||||
locked = false
|
||||
|
||||
[sub_resource type="Resource" id=15]
|
||||
resource_name = "we"
|
||||
script = ExtResource( 4 )
|
||||
rect = Rect2( 0, 0, 19.14, 12.78 )
|
||||
locked = false
|
||||
|
||||
[sub_resource type="Resource" id=8]
|
||||
resource_name = "asdasr"
|
||||
script = ExtResource( 3 )
|
||||
rect = Rect2( 25, 19, 191.4, 127.8 )
|
||||
locked = false
|
||||
subzones = [ ]
|
||||
subzones = [ SubResource( 14 ), SubResource( 15 ) ]
|
||||
|
||||
[sub_resource type="Resource" id=13]
|
||||
resource_name = "qqq"
|
||||
|
@ -7,6 +7,7 @@ func refresh() -> void:
|
||||
$TabContainer/World.set_wgworld(edited_world)
|
||||
$TabContainer/Continent.set_wgworld(edited_world)
|
||||
$TabContainer/Zone.set_wgworld(edited_world)
|
||||
$TabContainer/SubZone.set_wgworld(edited_world)
|
||||
|
||||
func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||
edited_world = wgw
|
||||
|
@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 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]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/SubZone.tscn" type="PackedScene" id=5]
|
||||
|
||||
[node name="WorldGenerator" type="PanelContainer"]
|
||||
anchor_right = 1.0
|
||||
@ -38,29 +39,9 @@ margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="SubZone" type="VBoxContainer" parent="TabContainer"]
|
||||
[node name="SubZone" parent="TabContainer" instance=ExtResource( 5 )]
|
||||
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/SubZone"]
|
||||
margin_right = 1002.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="AddButton" type="Button" parent="TabContainer/SubZone/HBoxContainer"]
|
||||
margin_right = 37.0
|
||||
margin_bottom = 20.0
|
||||
text = "Add"
|
||||
|
||||
[node name="DeleteButton" type="Button" parent="TabContainer/SubZone/HBoxContainer"]
|
||||
margin_left = 41.0
|
||||
margin_right = 96.0
|
||||
margin_bottom = 20.0
|
||||
text = "Delete"
|
||||
|
112
game/addons/world_generator/ui/tabs/SubZone.gd
Normal file
112
game/addons/world_generator/ui/tabs/SubZone.gd
Normal file
@ -0,0 +1,112 @@
|
||||
tool
|
||||
extends HBoxContainer
|
||||
|
||||
var edited_world : WorldGenWorld = null
|
||||
var edited_continent : Continent = null
|
||||
var edited_zone : Zone = null
|
||||
var edited_sub_zone : SubZone = null
|
||||
|
||||
func _ready():
|
||||
var coption_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||
coption_button.connect("item_selected", self, "on_continent_item_selected")
|
||||
|
||||
var zoption_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||
zoption_button.connect("item_selected", self, "on_zone_item_selected")
|
||||
|
||||
var szoption_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
szoption_button.connect("item_selected", self, "on_sub_zone_item_selected")
|
||||
|
||||
func refresh_continent() -> void:
|
||||
var option_button : OptionButton = $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:
|
||||
var option_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
option_button.clear()
|
||||
|
||||
if !edited_zone:
|
||||
return
|
||||
|
||||
var content : Array = edited_zone.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_sub_zone() -> void:
|
||||
$VBoxContainer/HBoxContainer2/ResourcePropertyList.edit_resource(edited_sub_zone)
|
||||
|
||||
func refresh() -> void:
|
||||
var option_button : OptionButton = $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 set_sub_zone(sub_zone : SubZone) -> void:
|
||||
edited_sub_zone = sub_zone
|
||||
|
||||
refresh_sub_zone()
|
||||
|
||||
func on_continent_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||
|
||||
set_continent(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_zone_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||
|
||||
set_zone(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_sub_zone_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
|
||||
set_sub_zone(option_button.get_item_metadata(idx))
|
49
game/addons/world_generator/ui/tabs/SubZone.tscn
Normal file
49
game/addons/world_generator/ui/tabs/SubZone.tscn
Normal file
@ -0,0 +1,49 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/SubZone.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/world_generator/ui/ResourcePropertyList.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="SubZone" 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="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ContinentOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="ZoneOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="SubZoneOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 72.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ResourcePropertyList" parent="VBoxContainer/HBoxContainer2" instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 528.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
Loading…
Reference in New Issue
Block a user