Small refactor

This commit is contained in:
Hamcha 2020-07-21 10:51:15 +02:00
parent f8d6c29d06
commit 995f2ab8b0
Signed by: hamcha
GPG key ID: 41467804B19A3315
9 changed files with 108 additions and 81 deletions

View file

@ -35,12 +35,15 @@ master func set_open(open: bool):
remotesync func anim_open(open: bool):
if open:
if $Sprite.animation != "open":
$AudioStreamPlayer2D.stream = open_sound
$AudioStreamPlayer2D.play()
$Sprite.play("open")
$AudioStreamPlayer2D.stream = open_sound
else:
if $Sprite.animation != "close":
$AudioStreamPlayer2D.stream = close_sound
$AudioStreamPlayer2D.play()
$Sprite.play("close")
$AudioStreamPlayer2D.stream = close_sound
$AudioStreamPlayer2D.play()
func _animation_finished():
if is_network_master():

View file

@ -2,8 +2,8 @@
[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/Widgets/ResizablePanel.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/UI/ServerInfo.tscn" type="PackedScene" id=4]
[ext_resource path="res://Scenes/UI/Panels/Logs.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/UI/Panels/ServerInfo.tscn" type="PackedScene" id=4]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.133333, 0.12549, 0.203922, 0.705882 )
@ -36,7 +36,6 @@ margin_left = 10.0
margin_top = 10.0
margin_right = -857.0
margin_bottom = -566.0
title = "Log"
[node name="Menu" type="PanelContainer" parent="."]
anchor_left = 1.0

16
Scenes/UI/Panels/Logs.gd Normal file
View file

@ -0,0 +1,16 @@
extends Control
onready var chat_bar = $ResizablePanel/LineEdit
func _input(event):
if event is InputEventMouseButton:
if not chat_bar_focus:
chat_bar.release_focus()
var chat_bar_focus = false
func _chat_bar_status(editing):
$"/root/scene".writing = editing
func _chat_bar_focus(entered):
chat_bar_focus = entered

View file

@ -0,0 +1,75 @@
[gd_scene load_steps=11 format=2]
[ext_resource path="res://Graphics/UI/iosevka-aile-regular.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://Graphics/UI/iosevka-aile-italic.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://Graphics/UI/iosevka-aile-bold.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://Graphics/UI/iosevka-aile-bolditalic.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://Scenes/UI/Panels/Logs.gd" type="Script" id=5]
[ext_resource path="res://Scenes/UI/Widgets/ResizablePanel.tscn" type="PackedScene" id=6]
[sub_resource type="DynamicFont" id=1]
size = 14
use_mipmaps = true
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=2]
size = 14
use_mipmaps = true
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=3]
size = 14
use_mipmaps = true
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=4]
size = 14
use_mipmaps = true
font_data = ExtResource( 1 )
[node name="Logs" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ResizablePanel" parent="." instance=ExtResource( 6 )]
[node name="RichTextLabel" type="RichTextLabel" parent="ResizablePanel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = 40.0
margin_right = -10.0
margin_bottom = -40.0
focus_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/bold_italics_font = SubResource( 1 )
custom_fonts/italics_font = SubResource( 2 )
custom_fonts/bold_font = SubResource( 3 )
custom_fonts/normal_font = SubResource( 4 )
selection_enabled = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="LineEdit" type="LineEdit" parent="ResizablePanel"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = -30.0
margin_right = -10.0
focus_mode = 1
caret_blink = true
caret_blink_speed = 0.5
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="focus_entered" from="ResizablePanel/LineEdit" to="." method="_chat_bar_status" binds= [ true ]]
[connection signal="focus_exited" from="ResizablePanel/LineEdit" to="." method="_chat_bar_status" binds= [ false ]]
[connection signal="mouse_entered" from="ResizablePanel/LineEdit" to="." method="_chat_bar_focus" binds= [ true ]]
[connection signal="mouse_exited" from="ResizablePanel/LineEdit" to="." method="_chat_bar_focus" binds= [ false ]]

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Scenes/UI/ServerInfo.gd" type="Script" id=1]
[ext_resource path="res://Scenes/UI/Panels/ServerInfo.gd" type="Script" id=1]
[node name="ServerInfoPopup" type="WindowDialog"]
visible = true

View file

@ -31,17 +31,7 @@ func _input(event):
dragging = false
if resizing and not event.pressed:
resizing = false
if not chat_bar_focus:
$LineEdit.release_focus()
func set_title(val):
title = val
$DragHandle/Label.text = title
var chat_bar_focus = false
func _chat_bar_status(editing):
$"/root/scene".writing = editing
func _chat_bar_focus(entered):
chat_bar_focus = entered

View file

@ -1,10 +1,6 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scenes/UI/Widgets/ResizablePanel.gd" type="Script" id=1]
[ext_resource path="res://Graphics/UI/iosevka-aile-regular.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://Graphics/UI/iosevka-aile-bold.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://Graphics/UI/iosevka-aile-italic.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://Graphics/UI/iosevka-aile-bolditalic.ttf" type="DynamicFontData" id=5]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.133333, 0.12549, 0.203922, 0.705882 )
@ -19,26 +15,6 @@ corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
[sub_resource type="DynamicFont" id=2]
size = 14
use_mipmaps = true
font_data = ExtResource( 5 )
[sub_resource type="DynamicFont" id=3]
size = 14
use_mipmaps = true
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=4]
size = 14
use_mipmaps = true
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=5]
size = 14
use_mipmaps = true
font_data = ExtResource( 2 )
[node name="ResizablePanel" type="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
@ -87,40 +63,5 @@ size_flags_vertical = 0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RichTextLabel" type="RichTextLabel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = 40.0
margin_right = -10.0
margin_bottom = -40.0
focus_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/bold_italics_font = SubResource( 2 )
custom_fonts/italics_font = SubResource( 3 )
custom_fonts/bold_font = SubResource( 4 )
custom_fonts/normal_font = SubResource( 5 )
selection_enabled = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="LineEdit" type="LineEdit" parent="."]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = -30.0
margin_right = -10.0
focus_mode = 1
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="gui_input" from="DragHandle" to="." method="_handle_drag"]
[connection signal="gui_input" from="ResizeHandle" to="." method="_handle_resize"]
[connection signal="focus_entered" from="LineEdit" to="." method="_chat_bar_status" binds= [ true ]]
[connection signal="focus_exited" from="LineEdit" to="." method="_chat_bar_status" binds= [ false ]]
[connection signal="mouse_entered" from="LineEdit" to="." method="_chat_bar_focus" binds= [ true ]]
[connection signal="mouse_exited" from="LineEdit" to="." method="_chat_bar_focus" binds= [ false ]]

View file

@ -2,23 +2,25 @@
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="door-sound_data" version="1.3.0" audacityversion="2.3.3" sel0="0.0000000000" sel1="0.0000000000" vpos="0" h="0.0000000000" zoom="300.2769352499" rate="48000.0" snapto="off" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="door-sound" isSelected="0" height="150" minimized="0" channel="2" linked="0" mute="0" solo="0" rate="48000" gain="1.0" pan="0.0" colorindex="0">
<wavetrack name="door-sound" isSelected="1" height="150" minimized="0" channel="2" linked="0" mute="0" solo="1" rate="48000" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="116852">
<waveblock start="0">
<simpleblockfile filename="e0808e31.au" len="116852" min="-1.0" max="1.0" rms="0.106046"/>
</waveblock>
</sequence>
<envelope numpoints="5">
<envelope numpoints="7">
<controlpoint t="0.725996486605" val="1.000000000000"/>
<controlpoint t="0.825904259991" val="0.620437979698"/>
<controlpoint t="0.855876592007" val="0.562043786049"/>
<controlpoint t="0.929142292490" val="0.445255458355"/>
<controlpoint t="1.032380324989" val="0.028169035912"/>
<controlpoint t="1.049031620553" val="0.915492951870"/>
<controlpoint t="1.128957839262" val="1.429577469826"/>
<controlpoint t="1.308791831357" val="0.725352108479"/>
</envelope>
</waveclip>
</wavetrack>
<wavetrack name="264061__paul368__sfx-door-open" isSelected="1" height="150" minimized="0" channel="2" linked="0" mute="0" solo="0" rate="48000" gain="0.501187" pan="0.0" colorindex="0">
<wavetrack name="264061__paul368__sfx-door-open" isSelected="0" height="150" minimized="0" channel="2" linked="0" mute="1" solo="0" rate="48000" gain="0.501187" pan="0.0" colorindex="0">
<waveclip offset="0.22643750" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="85596">
<waveblock start="0">