Skip to content

Commit

Permalink
Add music widget + loader
Browse files Browse the repository at this point in the history
Add text scroll + blips
  • Loading branch information
Crystalwarrior committed May 14, 2019
1 parent 8d5e13e commit 6994b45
Show file tree
Hide file tree
Showing 29 changed files with 188 additions and 82 deletions.
4 changes: 2 additions & 2 deletions CharacterMenu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ signal character_changed(character)

func _ready():
popup = get_popup()
popup.add_icon_item(preload("res://res/sprites/characters/Female Student 1/icon.png"), "Female Student 1")
popup.add_icon_item(preload("res://res/sprites/characters/Female Student 2/icon.png"), "Female Student 2")
popup.add_icon_item(preload("res://res/characters/Female Student 1/icon.png"), "Female Student 1")
popup.add_icon_item(preload("res://res/characters/Female Student 2/icon.png"), "Female Student 2")
popup.connect("id_pressed", self, "_on_item_pressed")

func _on_item_pressed(ID):
Expand Down
35 changes: 22 additions & 13 deletions ChatRoom.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ var current_emote = 0
var emotes = {
"Female Student 1":
[
{"name": "blush", "file": preload("res://res/sprites/characters/Female Student 1/blush.png")},
{"name": "happy", "file": preload("res://res/sprites/characters/Female Student 1/happy.png")},
{"name": "sad", "file": preload("res://res/sprites/characters/Female Student 1/sad.png")},
{"name": "surprised", "file": preload("res://res/sprites/characters/Female Student 1/surprised.png")},
{"name": "upset", "file": preload("res://res/sprites/characters/Female Student 1/upset.png")},
{"name": "blush", "file": preload("res://res/characters/Female Student 1/blush.png")},
{"name": "happy", "file": preload("res://res/characters/Female Student 1/happy.png")},
{"name": "sad", "file": preload("res://res/characters/Female Student 1/sad.png")},
{"name": "surprised", "file": preload("res://res/characters/Female Student 1/surprised.png")},
{"name": "upset", "file": preload("res://res/characters/Female Student 1/upset.png")},
],
"Female Student 2":
[
{"name": "blush", "file": preload("res://res/sprites/characters/Female Student 2/blush.png")},
{"name": "happy", "file": preload("res://res/sprites/characters/Female Student 2/happy.png")},
{"name": "sad", "file": preload("res://res/sprites/characters/Female Student 2/sad.png")},
{"name": "surprised", "file": preload("res://res/sprites/characters/Female Student 2/surprised.png")},
{"name": "upset", "file": preload("res://res/sprites/characters/Female Student 2/upset.png")}
{"name": "blush", "file": preload("res://res/characters/Female Student 2/blush.png")},
{"name": "happy", "file": preload("res://res/characters/Female Student 2/happy.png")},
{"name": "sad", "file": preload("res://res/characters/Female Student 2/sad.png")},
{"name": "surprised", "file": preload("res://res/characters/Female Student 2/surprised.png")},
{"name": "upset", "file": preload("res://res/characters/Female Student 2/upset.png")}
],
}

Expand All @@ -38,6 +38,7 @@ signal login()
signal logout()
signal clients_changed(array)
signal character_changed(character, emotes)
signal play_song(song)

func _ready():
get_tree().connect("connected_to_server", self, "enter_room")
Expand Down Expand Up @@ -66,6 +67,7 @@ func user_exited(id):
if clients.has(id):
emit_signal("ooc_message", "[b]" + clients[id] + " left the room[/b]")
clients.erase(id)
emit_signal("clients_changed", clients.values())

func host_room():
var host = NetworkedMultiplayerENet.new()
Expand Down Expand Up @@ -95,15 +97,16 @@ func send_ooc_message(msg):
rpc("receive_ooc_message", id, msg)

func send_ic_message(msg):
if msg == "": #Don't send blank messages ya doofus.
return
var id = get_tree().get_network_unique_id()
rpc("receive_ic_message", id, msg, character, current_emote)

sync func receive_ooc_message(id, msg):
emit_signal("ooc_message", "[b]" + clients[id] + "[/b]: " + text_parser.parse_markup(msg))
emit_signal("ooc_message", "[b]" + clients[id] + "[/b]: " + msg)

sync func receive_ic_message(id, msg, chara, emote_index):
emit_signal("ic_name", clients[id])
msg = text_parser.parse_markup(msg)
emit_signal("ic_message", msg)
emit_signal("ic_logs", "[b]" + clients[id] + "[/b]: " + msg)
emit_signal("ic_character", emotes[chara][emote_index]["file"])
Expand All @@ -129,4 +132,10 @@ func _on_character_changed(chara):
emit_signal("character_changed", character, emotes[character])

func _on_emote_selected(index):
current_emote = index
current_emote = index

func _on_song_selected(song):
rpc("receive_song", song)

sync func receive_song(song):
emit_signal("play_song", song)
116 changes: 64 additions & 52 deletions ChatRoom.tscn
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
[gd_scene load_steps=21 format=2]
[gd_scene load_steps=23 format=2]

[ext_resource path="res://ChatRoom.gd" type="Script" id=1]
[ext_resource path="res://CharacterMenu.gd" type="Script" id=2]
[ext_resource path="res://ChatRoom.tres" type="StyleBox" id=3]
[ext_resource path="res://Info.gd" type="Script" id=4]
[ext_resource path="res://Login.gd" type="Script" id=5]
[ext_resource path="res://Logs.gd" type="Script" id=6]
[ext_resource path="res://fonts/courier new/bolditalics.tres" type="DynamicFont" id=7]
[ext_resource path="res://fonts/courier new/italics.tres" type="DynamicFont" id=8]
[ext_resource path="res://fonts/courier new/bold.tres" type="DynamicFont" id=9]
[ext_resource path="res://fonts/courier new/normal.tres" type="DynamicFont" id=10]
[ext_resource path="res://OOC.gd" type="Script" id=11]
[ext_resource path="res://Tree.gd" type="Script" id=12]
[ext_resource path="res://View.gd" type="Script" id=13]
[ext_resource path="res://res/sprites/backgrounds/test/110602_b.jpg" type="Texture" id=14]
[ext_resource path="res://res/sprites/characters/Female Student 2/happy.png" type="Texture" id=15]
[ext_resource path="res://Say.gd" type="Script" id=16]
[ext_resource path="res://icon.png" type="Texture" id=17]
[ext_resource path="res://Emotes.gd" type="Script" id=18]
[ext_resource path="res://Music.gd" type="Script" id=2]
[ext_resource path="res://CharacterMenu.gd" type="Script" id=3]
[ext_resource path="res://ChatRoom.tres" type="StyleBox" id=4]
[ext_resource path="res://Info.gd" type="Script" id=5]
[ext_resource path="res://Login.gd" type="Script" id=6]
[ext_resource path="res://Logs.gd" type="Script" id=7]
[ext_resource path="res://fonts/courier new/bolditalics.tres" type="DynamicFont" id=8]
[ext_resource path="res://fonts/courier new/italics.tres" type="DynamicFont" id=9]
[ext_resource path="res://fonts/courier new/bold.tres" type="DynamicFont" id=10]
[ext_resource path="res://fonts/courier new/normal.tres" type="DynamicFont" id=11]
[ext_resource path="res://OOC.gd" type="Script" id=12]
[ext_resource path="res://Tree.gd" type="Script" id=13]
[ext_resource path="res://View.gd" type="Script" id=14]
[ext_resource path="res://res/backgrounds/test/110602_b.jpg" type="Texture" id=15]
[ext_resource path="res://res/characters/Female Student 2/happy.png" type="Texture" id=16]
[ext_resource path="res://Say.gd" type="Script" id=17]
[ext_resource path="res://res/sounds/blip-female.wav" type="AudioStream" id=18]
[ext_resource path="res://icon.png" type="Texture" id=19]
[ext_resource path="res://Emotes.gd" type="Script" id=20]

[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.0196078, 0.101961, 0.176471, 0.588235 )
Expand Down Expand Up @@ -45,6 +47,9 @@ __meta__ = {
"_edit_lock_": true
}

[node name="Music" type="AudioStreamPlayer" parent="."]
script = ExtResource( 2 )

[node name="PanelContainer" type="PanelContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
Expand All @@ -56,14 +61,15 @@ margin_right = 1017.0
margin_bottom = 761.0

[node name="Top" type="HBoxContainer" parent="PanelContainer/MainWindow"]
editor/display_folded = true
margin_right = 1010.0
margin_bottom = 20.0

[node name="Character" type="MenuButton" parent="PanelContainer/MainWindow/Top"]
margin_right = 72.0
margin_bottom = 20.0
text = "Character"
script = ExtResource( 2 )
script = ExtResource( 3 )

[node name="MainView" type="HSplitContainer" parent="PanelContainer/MainWindow"]
margin_top = 24.0
Expand All @@ -73,22 +79,20 @@ size_flags_horizontal = 3
size_flags_vertical = 3

[node name="Left" type="VSplitContainer" parent="PanelContainer/MainWindow/MainView"]
editor/display_folded = true
margin_right = 334.0
margin_bottom = 730.0
size_flags_horizontal = 3

[node name="Info" type="TabContainer" parent="PanelContainer/MainWindow/MainView/Left"]
editor/display_folded = true
margin_right = 334.0
margin_bottom = 359.0
rect_min_size = Vector2( 230, 0 )
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/panel = ExtResource( 3 )
custom_styles/panel = ExtResource( 4 )
tab_align = 0
drag_to_rearrange_enabled = true
script = ExtResource( 4 )
script = ExtResource( 5 )

[node name="Info" type="VBoxContainer" parent="PanelContainer/MainWindow/MainView/Left/Info"]
editor/display_folded = true
Expand All @@ -98,7 +102,7 @@ margin_left = 5.0
margin_top = 29.0
margin_right = -5.0
margin_bottom = -5.0
script = ExtResource( 5 )
script = ExtResource( 6 )

[node name="Label" type="Label" parent="PanelContainer/MainWindow/MainView/Left/Info/Info"]
margin_right = 324.0
Expand Down Expand Up @@ -176,17 +180,17 @@ margin_left = 5.0
margin_top = 29.0
margin_right = -5.0
margin_bottom = -5.0
script = ExtResource( 6 )
script = ExtResource( 7 )

[node name="Text" type="RichTextLabel" parent="PanelContainer/MainWindow/MainView/Left/Info/Logs"]
margin_right = 326.0
margin_bottom = 337.0
focus_mode = 2
size_flags_vertical = 3
custom_fonts/bold_italics_font = ExtResource( 7 )
custom_fonts/italics_font = ExtResource( 8 )
custom_fonts/bold_font = ExtResource( 9 )
custom_fonts/normal_font = ExtResource( 10 )
custom_fonts/bold_italics_font = ExtResource( 8 )
custom_fonts/italics_font = ExtResource( 9 )
custom_fonts/bold_font = ExtResource( 10 )
custom_fonts/normal_font = ExtResource( 11 )
bbcode_enabled = true
text = "
"
Expand All @@ -200,10 +204,10 @@ margin_bottom = 730.0
rect_min_size = Vector2( 230, 0 )
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/panel = ExtResource( 3 )
custom_styles/panel = ExtResource( 4 )
tab_align = 0
drag_to_rearrange_enabled = true
script = ExtResource( 4 )
script = ExtResource( 5 )

[node name="OOC" type="VBoxContainer" parent="PanelContainer/MainWindow/MainView/Left/Info2"]
anchor_right = 1.0
Expand All @@ -212,17 +216,17 @@ margin_left = 5.0
margin_top = 29.0
margin_right = -5.0
margin_bottom = -5.0
script = ExtResource( 11 )
script = ExtResource( 12 )

[node name="Text" type="RichTextLabel" parent="PanelContainer/MainWindow/MainView/Left/Info2/OOC"]
margin_right = 324.0
margin_bottom = 297.0
focus_mode = 2
size_flags_vertical = 3
custom_fonts/bold_italics_font = ExtResource( 7 )
custom_fonts/italics_font = ExtResource( 8 )
custom_fonts/bold_font = ExtResource( 9 )
custom_fonts/normal_font = ExtResource( 10 )
custom_fonts/bold_italics_font = ExtResource( 8 )
custom_fonts/italics_font = ExtResource( 9 )
custom_fonts/bold_font = ExtResource( 10 )
custom_fonts/normal_font = ExtResource( 11 )
bbcode_enabled = true
text = "
"
Expand All @@ -247,7 +251,7 @@ margin_bottom = -5.0
margin_right = 324.0
margin_bottom = 337.0
size_flags_vertical = 3
script = ExtResource( 12 )
script = ExtResource( 13 )

[node name="Right" type="VSplitContainer" parent="PanelContainer/MainWindow/MainView"]
margin_left = 346.0
Expand All @@ -260,10 +264,10 @@ margin_right = 664.0
margin_bottom = 528.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/panel = ExtResource( 3 )
custom_styles/panel = ExtResource( 4 )
tab_align = 0
drag_to_rearrange_enabled = true
script = ExtResource( 4 )
script = ExtResource( 5 )

[node name="IC" type="PanelContainer" parent="PanelContainer/MainWindow/MainView/Right/Info3"]
anchor_right = 1.0
Expand All @@ -284,34 +288,34 @@ rect_clip_content = true
size_flags_horizontal = 3
size_flags_vertical = 3
border_color = Color( 0.054902, 1, 0, 1 )
script = ExtResource( 13 )
script = ExtResource( 14 )

[node name="bg" type="TextureRect" parent="PanelContainer/MainWindow/MainView/Right/Info3/IC/View"]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 14 )
texture = ExtResource( 15 )
expand = true
stretch_mode = 7

[node name="character" type="TextureRect" parent="PanelContainer/MainWindow/MainView/Right/Info3/IC/View"]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 15 )
texture = ExtResource( 16 )
expand = true
stretch_mode = 6

[node name="Say" type="VBoxContainer" parent="PanelContainer/MainWindow/MainView/Right/Info3/IC"]
editor/display_folded = true
margin_left = 7.0
margin_top = 319.0
margin_right = 647.0
margin_bottom = 487.0
size_flags_vertical = 8
custom_constants/separation = 0
alignment = 2
script = ExtResource( 16 )
script = ExtResource( 17 )

[node name="Box" type="VBoxContainer" parent="PanelContainer/MainWindow/MainView/Right/Info3/IC/Say"]
editor/display_folded = true
margin_right = 640.0
margin_bottom = 138.0
custom_constants/separation = 0
Expand All @@ -331,6 +335,7 @@ margin_right = 55.0
margin_bottom = 21.0

[node name="Display" type="Panel" parent="PanelContainer/MainWindow/MainView/Right/Info3/IC/Say/Box"]
editor/display_folded = true
margin_top = 28.0
margin_right = 640.0
margin_bottom = 138.0
Expand All @@ -348,10 +353,10 @@ margin_top = 15.0
margin_right = -15.0
margin_bottom = -25.0
focus_mode = 2
custom_fonts/bold_italics_font = ExtResource( 7 )
custom_fonts/italics_font = ExtResource( 8 )
custom_fonts/bold_font = ExtResource( 9 )
custom_fonts/normal_font = ExtResource( 10 )
custom_fonts/bold_italics_font = ExtResource( 8 )
custom_fonts/italics_font = ExtResource( 9 )
custom_fonts/bold_font = ExtResource( 10 )
custom_fonts/normal_font = ExtResource( 11 )
bbcode_enabled = true
scroll_following = true
selection_enabled = true
Expand All @@ -364,16 +369,20 @@ rect_min_size = Vector2( 0, 30 )
size_flags_vertical = 8
custom_styles/normal = SubResource( 2 )

[node name="Blip" type="AudioStreamPlayer" parent="PanelContainer/MainWindow/MainView/Right/Info3/IC/Say"]
stream = ExtResource( 18 )
volume_db = -20.0

[node name="Info4" type="TabContainer" parent="PanelContainer/MainWindow/MainView/Right"]
margin_top = 540.0
margin_right = 664.0
margin_bottom = 730.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/panel = ExtResource( 3 )
custom_styles/panel = ExtResource( 4 )
tab_align = 0
drag_to_rearrange_enabled = true
script = ExtResource( 4 )
script = ExtResource( 5 )

[node name="Emotes" type="ItemList" parent="PanelContainer/MainWindow/MainView/Right/Info4"]
anchor_right = 1.0
Expand All @@ -383,12 +392,12 @@ margin_top = 29.0
margin_right = -5.0
margin_bottom = -5.0
size_flags_vertical = 3
items = [ "Emote", ExtResource( 17 ), false, "Item 1", ExtResource( 17 ), false, "Item 2", ExtResource( 17 ), false, "Item 3", ExtResource( 17 ), false, "Item 4", ExtResource( 17 ), false, "Item 5", ExtResource( 17 ), false, "Item 6", ExtResource( 17 ), false, "Item 7", ExtResource( 17 ), false, "Item 8", ExtResource( 17 ), false, "Item 9", ExtResource( 17 ), false, "Item 10", ExtResource( 17 ), false, "Item 11", ExtResource( 17 ), false, "Item 12", ExtResource( 17 ), false, "Item 13", ExtResource( 17 ), false, "Item 14", ExtResource( 17 ), false ]
items = [ "Emote", ExtResource( 19 ), false, "Item 1", ExtResource( 19 ), false, "Item 2", ExtResource( 19 ), false, "Item 3", ExtResource( 19 ), false, "Item 4", ExtResource( 19 ), false, "Item 5", ExtResource( 19 ), false, "Item 6", ExtResource( 19 ), false, "Item 7", ExtResource( 19 ), false, "Item 8", ExtResource( 19 ), false, "Item 9", ExtResource( 19 ), false, "Item 10", ExtResource( 19 ), false, "Item 11", ExtResource( 19 ), false, "Item 12", ExtResource( 19 ), false, "Item 13", ExtResource( 19 ), false, "Item 14", ExtResource( 19 ), false ]
max_columns = 16
same_column_width = true
icon_mode = 0
fixed_icon_size = Vector2( 64, 64 )
script = ExtResource( 18 )
script = ExtResource( 20 )

[connection signal="character_changed" from="." to="PanelContainer/MainWindow/MainView/Right/Info4/Emotes" method="_on_Main_character_changed"]
[connection signal="clients_changed" from="." to="PanelContainer/MainWindow/MainView/Left/Info/Info" method="_on_Main_clients_changed"]
Expand All @@ -399,6 +408,7 @@ script = ExtResource( 18 )
[connection signal="login" from="." to="PanelContainer/MainWindow/MainView/Left/Info/Info" method="_on_login"]
[connection signal="logout" from="." to="PanelContainer/MainWindow/MainView/Left/Info/Info" method="_on_logout"]
[connection signal="ooc_message" from="." to="PanelContainer/MainWindow/MainView/Left/Info2/OOC" method="_on_ooc_message"]
[connection signal="play_song" from="." to="Music" method="_on_Main_play_song"]
[connection signal="character_changed" from="PanelContainer/MainWindow/Top/Character" to="." method="_on_character_changed"]
[connection signal="change_ip" from="PanelContainer/MainWindow/MainView/Left/Info/Info" to="." method="_on_Login_change_ip"]
[connection signal="change_name" from="PanelContainer/MainWindow/MainView/Left/Info/Info" to="." method="_on_Login_change_name"]
Expand All @@ -411,6 +421,8 @@ script = ExtResource( 18 )
[connection signal="button_up" from="PanelContainer/MainWindow/MainView/Left/Info/Info/LeaveButton" to="." method="_on_LeaveButton_button_up"]
[connection signal="message_sent" from="PanelContainer/MainWindow/MainView/Left/Info2/OOC" to="." method="send_ooc_message"]
[connection signal="text_entered" from="PanelContainer/MainWindow/MainView/Left/Info2/OOC/Input" to="PanelContainer/MainWindow/MainView/Left/Info2/OOC" method="_on_Input_text_entered"]
[connection signal="item_activated" from="PanelContainer/MainWindow/MainView/Left/Info2/Music/Tree" to="PanelContainer/MainWindow/MainView/Left/Info2/Music/Tree" method="_on_item_activated"]
[connection signal="song_selected" from="PanelContainer/MainWindow/MainView/Left/Info2/Music/Tree" to="." method="_on_song_selected"]
[connection signal="message_sent" from="PanelContainer/MainWindow/MainView/Right/Info3/IC/Say" to="." method="send_ic_message"]
[connection signal="text_entered" from="PanelContainer/MainWindow/MainView/Right/Info3/IC/Say/Input" to="PanelContainer/MainWindow/MainView/Right/Info3/IC/Say" method="_on_Input_text_entered"]
[connection signal="emote_selected" from="PanelContainer/MainWindow/MainView/Right/Info4/Emotes" to="." method="_on_emote_selected"]
Expand Down
Loading

0 comments on commit 6994b45

Please sign in to comment.