More UI, fix occlusion
This commit is contained in:
parent
df48c84655
commit
9c3468e94d
5 changed files with 145 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
[gd_resource type="Theme" load_steps=3 format=2]
|
[gd_resource type="Theme" load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Graphics/UI/uifont.tres" type="DynamicFont" id=1]
|
[ext_resource path="res://Graphics/UI/uifont.tres" type="DynamicFont" id=1]
|
||||||
|
|
||||||
|
@ -15,8 +15,47 @@ corner_radius_top_right = 4
|
||||||
corner_radius_bottom_right = 4
|
corner_radius_bottom_right = 4
|
||||||
corner_radius_bottom_left = 4
|
corner_radius_bottom_left = 4
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=2]
|
||||||
|
content_margin_left = 8.0
|
||||||
|
content_margin_right = 8.0
|
||||||
|
content_margin_top = 8.0
|
||||||
|
content_margin_bottom = 8.0
|
||||||
|
bg_color = Color( 0.133333, 0.12549, 0.203922, 1 )
|
||||||
|
border_width_left = 4
|
||||||
|
border_width_top = 4
|
||||||
|
border_width_right = 4
|
||||||
|
border_width_bottom = 4
|
||||||
|
border_color = Color( 0.0941176, 0.0823529, 0.180392, 1 )
|
||||||
|
border_blend = true
|
||||||
|
corner_radius_top_left = 4
|
||||||
|
corner_radius_top_right = 4
|
||||||
|
corner_radius_bottom_right = 4
|
||||||
|
corner_radius_bottom_left = 4
|
||||||
|
expand_margin_left = 8.0
|
||||||
|
expand_margin_right = 8.0
|
||||||
|
expand_margin_top = 8.0
|
||||||
|
expand_margin_bottom = 8.0
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
default_font = ExtResource( 1 )
|
default_font = ExtResource( 1 )
|
||||||
Panel/styles/panel = SubResource( 1 )
|
Panel/styles/panel = SubResource( 1 )
|
||||||
PanelContainer/styles/panel = SubResource( 1 )
|
PanelContainer/styles/panel = SubResource( 1 )
|
||||||
PopupDialog/styles/panel = SubResource( 1 )
|
PopupDialog/styles/panel = SubResource( 1 )
|
||||||
|
PopupMenu/colors/font_color = Color( 0.88, 0.88, 0.88, 1 )
|
||||||
|
PopupMenu/colors/font_color_accel = Color( 0.7, 0.7, 0.7, 0.8 )
|
||||||
|
PopupMenu/colors/font_color_disabled = Color( 0.4, 0.4, 0.4, 0.8 )
|
||||||
|
PopupMenu/colors/font_color_hover = Color( 0.88, 0.88, 0.88, 1 )
|
||||||
|
PopupMenu/constants/hseparation = 16
|
||||||
|
PopupMenu/constants/vseparation = 16
|
||||||
|
PopupMenu/fonts/font = ExtResource( 1 )
|
||||||
|
PopupMenu/icons/checked = null
|
||||||
|
PopupMenu/icons/radio_checked = null
|
||||||
|
PopupMenu/icons/radio_unchecked = null
|
||||||
|
PopupMenu/icons/submenu = null
|
||||||
|
PopupMenu/icons/unchecked = null
|
||||||
|
PopupMenu/styles/hover = null
|
||||||
|
PopupMenu/styles/labeled_separator_left = null
|
||||||
|
PopupMenu/styles/labeled_separator_right = null
|
||||||
|
PopupMenu/styles/panel = SubResource( 2 )
|
||||||
|
PopupMenu/styles/panel_disabled = null
|
||||||
|
PopupMenu/styles/separator = null
|
||||||
|
|
|
@ -10,6 +10,7 @@ script = ExtResource( 5 )
|
||||||
[node name="world" type="Node2D" parent="."]
|
[node name="world" type="Node2D" parent="."]
|
||||||
scale = Vector2( 2, 2 )
|
scale = Vector2( 2, 2 )
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
|
mapToLoad = 1
|
||||||
|
|
||||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
|
23
Scenes/UI.gd
23
Scenes/UI.gd
|
@ -1,3 +1,26 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
signal command(command)
|
signal command(command)
|
||||||
|
|
||||||
|
enum ServerMenuItem {
|
||||||
|
HOST_SERVER,
|
||||||
|
JOIN_SERVER,
|
||||||
|
SERVER_INFO
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
# Add options to menu buttons
|
||||||
|
var serverMenu = $Menu/Margins/Grid/Server.get_popup()
|
||||||
|
serverMenu.add_item("Start hosting", ServerMenuItem.HOST_SERVER)
|
||||||
|
serverMenu.add_item("Join instance", ServerMenuItem.JOIN_SERVER)
|
||||||
|
serverMenu.connect("id_pressed", self, "_server_option_chosen")
|
||||||
|
|
||||||
|
func _server_option_chosen(id) -> void:
|
||||||
|
match id:
|
||||||
|
ServerMenuItem.HOST_SERVER:
|
||||||
|
# TODO HOST
|
||||||
|
$ServerInfoPopup.popup_centered()
|
||||||
|
pass
|
||||||
|
ServerMenuItem.JOIN_SERVER:
|
||||||
|
# TODO JOIN
|
||||||
|
pass
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Scenes/UI/SpaceMap.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://Scenes/UI/SpaceMap.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://Scenes/UI.gd" type="Script" id=2]
|
[ext_resource path="res://Scenes/UI.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://Scenes/UI/Widgets/ResizablePanel.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://Scenes/UI/Widgets/ResizablePanel.tscn" type="PackedScene" id=3]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
|
bg_color = Color( 0.133333, 0.12549, 0.203922, 0.705882 )
|
||||||
|
border_width_left = 4
|
||||||
|
border_width_top = 4
|
||||||
|
border_width_right = 4
|
||||||
|
border_width_bottom = 4
|
||||||
|
border_color = Color( 0.0941176, 0.0823529, 0.180392, 1 )
|
||||||
|
border_blend = true
|
||||||
|
corner_radius_top_left = 4
|
||||||
|
corner_radius_top_right = 4
|
||||||
|
corner_radius_bottom_right = 4
|
||||||
|
corner_radius_bottom_left = 4
|
||||||
|
|
||||||
[node name="ui" type="Control"]
|
[node name="ui" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
@ -16,7 +29,70 @@ __meta__ = {
|
||||||
|
|
||||||
[node name="MapPopup" parent="." instance=ExtResource( 1 )]
|
[node name="MapPopup" parent="." instance=ExtResource( 1 )]
|
||||||
|
|
||||||
[node name="PanelContainer" parent="." instance=ExtResource( 3 )]
|
[node name="Logs" parent="." instance=ExtResource( 3 )]
|
||||||
margin_right = 392.0
|
margin_right = 392.0
|
||||||
margin_bottom = 256.0
|
margin_bottom = 256.0
|
||||||
title = "Log"
|
title = "Log"
|
||||||
|
|
||||||
|
[node name="Menu" type="PanelContainer" parent="."]
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
margin_left = -126.0
|
||||||
|
margin_top = 10.0
|
||||||
|
margin_right = -10.0
|
||||||
|
margin_bottom = 38.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
size_flags_horizontal = 8
|
||||||
|
size_flags_vertical = 8
|
||||||
|
custom_styles/panel = SubResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Margins" type="MarginContainer" parent="Menu"]
|
||||||
|
margin_left = 4.0
|
||||||
|
margin_top = 4.0
|
||||||
|
margin_right = 148.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="Grid" type="GridContainer" parent="Menu/Margins"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 4.0
|
||||||
|
margin_top = 4.0
|
||||||
|
margin_right = 4.0
|
||||||
|
margin_bottom = 4.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
custom_constants/vseparation = 4
|
||||||
|
custom_constants/hseparation = 4
|
||||||
|
columns = 4
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Server" type="MenuButton" parent="Menu/Margins/Grid"]
|
||||||
|
margin_right = 52.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
custom_constants/hseparation = 8
|
||||||
|
text = "Server"
|
||||||
|
|
||||||
|
[node name="Preferences" type="MenuButton" parent="Menu/Margins/Grid"]
|
||||||
|
margin_left = 56.0
|
||||||
|
margin_right = 144.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
text = "Preferences"
|
||||||
|
|
||||||
|
[node name="ServerInfoPopup" type="WindowDialog" parent="."]
|
||||||
|
margin_left = 536.0
|
||||||
|
margin_top = 272.0
|
||||||
|
margin_right = 792.0
|
||||||
|
margin_bottom = 440.0
|
||||||
|
window_title = "Server info"
|
||||||
|
resizable = true
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
|
@ -20,9 +20,6 @@ func _ready():
|
||||||
Map.ODYSSEY:
|
Map.ODYSSEY:
|
||||||
map = odysseyRes.instance()
|
map = odysseyRes.instance()
|
||||||
add_child(map)
|
add_child(map)
|
||||||
for tilemap in map.tilemaps:
|
|
||||||
if tilemap is MapTiles:
|
|
||||||
tilemap.set_occluder_origin(player)
|
|
||||||
player = playerRes.instance()
|
player = playerRes.instance()
|
||||||
player.is_controlled = true
|
player.is_controlled = true
|
||||||
var spawnpoints = map.get_pois(POIData.POIType.SpawnPoint, POIData.POIClass.Player)
|
var spawnpoints = map.get_pois(POIData.POIType.SpawnPoint, POIData.POIClass.Player)
|
||||||
|
@ -31,3 +28,6 @@ func _ready():
|
||||||
else:
|
else:
|
||||||
print("Map does not have Player spawnpoint POI! Spawning at origin (very bad)")
|
print("Map does not have Player spawnpoint POI! Spawning at origin (very bad)")
|
||||||
add_child(player)
|
add_child(player)
|
||||||
|
for tilemap in map.tilemaps:
|
||||||
|
if tilemap is MapTiles:
|
||||||
|
tilemap.set_occluder_origin(player)
|
||||||
|
|
Reference in a new issue