fix moving hidden overlays & cleanup

This commit is contained in:
Crispy 2021-05-31 17:39:44 +02:00
parent 6c15e9ff5f
commit 4a5d1f02c3
6 changed files with 23 additions and 12 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=11 format=2]
[ext_resource path="res://styles/menu.theme" type="Theme" id=1]
[ext_resource path="res://icons/visible.svg" type="Texture" id=2]
@ -8,6 +8,10 @@
[ext_resource path="res://icons/reset.svg" type="Texture" id=6]
[ext_resource path="res://icons/size.svg" type="Texture" id=7]
[ext_resource path="res://icons/hand_r.svg" type="Texture" id=8]
[ext_resource path="res://textures/icon.png" type="Texture" id=9]
[sub_resource type="DynamicFont" id=1]
size = 1
[node name="ListOverlayItem" type="PanelContainer"]
margin_top = 1727.0
@ -35,25 +39,27 @@ margin_bottom = 199.0
alignment = 2
[node name="Remove" type="Button" parent="HBoxContainer"]
margin_left = 1006.0
margin_right = 1182.0
margin_left = 948.0
margin_right = 1124.0
margin_bottom = 191.0
toggle_mode = true
icon = ExtResource( 5 )
[node name="Reset" type="Button" parent="HBoxContainer"]
margin_left = 1186.0
margin_right = 1362.0
margin_left = 1128.0
margin_right = 1304.0
margin_bottom = 191.0
icon = ExtResource( 6 )
[node name="Target" type="OptionButton" parent="HBoxContainer"]
margin_left = 1366.0
margin_left = 1308.0
margin_right = 1492.0
margin_bottom = 191.0
text = "H"
items = [ "H", null, false, 0, null, "L", ExtResource( 8 ), false, 1, null, "R", ExtResource( 8 ), false, 2, null, "W", null, false, 3, null ]
selected = 0
custom_fonts/font = SubResource( 1 )
text = "Left"
icon = ExtResource( 8 )
items = [ "Head", ExtResource( 9 ), false, 0, null, "Left", ExtResource( 8 ), false, 1, null, "Right", ExtResource( 8 ), false, 2, null, "World", ExtResource( 4 ), false, 3, null ]
selected = 1
[node name="Size" type="Button" parent="HBoxContainer"]
margin_left = 1496.0

View file

@ -53,7 +53,7 @@ func _trigger_off():
func _on_OverlayArea_entered(body: Node) -> void:
if body.get_node("../../..") != self or pause_triggers:
if body.get_node("../../..") != self or pause_triggers or !get_parent().overlay_visible:
return
touch_state = true
active_controller = body.get_parent().name
@ -62,7 +62,7 @@ func _on_OverlayArea_entered(body: Node) -> void:
func _on_OverlayArea_exited(body: Node) -> void:
if body.get_node("../../..") != self or pause_triggers:
if body.get_node("../../..") != self or pause_triggers or !get_parent().overlay_visible:
return
# TODO revert to other controller if both were touching (edge case)
active_controller = ""

View file

@ -26,6 +26,7 @@ var _offsets:Dictionary = {
var current_target: String = "world" setget _set_current_target# most of the time the actual target, but will fall back
var fallback = ["left", "right", "head"] # TODO setget that updates tracking (not important)
var interaction_handler: Node
var overlay_visible := true setget set_overlay_visible
var _tracker_id: int = 0
@ -139,6 +140,10 @@ func update_current_target():
update_tracker_id()
func set_overlay_visible(state: bool):
overlay_visible = state
$OverlayViewport.overlay_visible = state
func _tracker_changed(tracker_name: String, type: int, id: int):
update_current_target()

Binary file not shown.

View file

@ -10,7 +10,7 @@ func _ready() -> void:
func _on_Visibility_toggled(state: bool) -> void:
overlay.get_node("OverlayViewport").overlay_visible = state
overlay.overlay_visible = state
if state:
$HBoxContainer/Visibility.icon = preload("res://icons/visible.svg")
else:

Binary file not shown.