diff --git a/.import/blue.png-e0f5f5b5c4b775bd8c0818e2c803259e.md5 b/.import/blue.png-e0f5f5b5c4b775bd8c0818e2c803259e.md5 new file mode 100644 index 0000000..dc6c2ed --- /dev/null +++ b/.import/blue.png-e0f5f5b5c4b775bd8c0818e2c803259e.md5 @@ -0,0 +1,3 @@ +source_md5="56083153d0476dc805eeb2236d5662f6" +dest_md5="b41d1f41b27190bbe31700a9e03aa47b" + diff --git a/.import/blue.png-e0f5f5b5c4b775bd8c0818e2c803259e.stex b/.import/blue.png-e0f5f5b5c4b775bd8c0818e2c803259e.stex new file mode 100644 index 0000000..bfb711d Binary files /dev/null and b/.import/blue.png-e0f5f5b5c4b775bd8c0818e2c803259e.stex differ diff --git a/.import/blueland.png-f478fe8d87e2af2735e01bc75579867e.md5 b/.import/blueland.png-f478fe8d87e2af2735e01bc75579867e.md5 new file mode 100644 index 0000000..5ec2091 --- /dev/null +++ b/.import/blueland.png-f478fe8d87e2af2735e01bc75579867e.md5 @@ -0,0 +1,3 @@ +source_md5="19b355c80268c5d7c75dff312b074ff8" +dest_md5="87f91c20fc1ab88382f1694bb73ee383" + diff --git a/.import/blueland.png-f478fe8d87e2af2735e01bc75579867e.stex b/.import/blueland.png-f478fe8d87e2af2735e01bc75579867e.stex new file mode 100644 index 0000000..d088db7 Binary files /dev/null and b/.import/blueland.png-f478fe8d87e2af2735e01bc75579867e.stex differ diff --git a/.import/pink.png-302a63cdc099d1943080b420b9d78bc1.md5 b/.import/pink.png-302a63cdc099d1943080b420b9d78bc1.md5 new file mode 100644 index 0000000..3aa4f09 --- /dev/null +++ b/.import/pink.png-302a63cdc099d1943080b420b9d78bc1.md5 @@ -0,0 +1,3 @@ +source_md5="2a8c269cb6abb91f04148edd94f0be8f" +dest_md5="af39e05d79c16507bcbd8002ba17d6f2" + diff --git a/.import/pink.png-302a63cdc099d1943080b420b9d78bc1.stex b/.import/pink.png-302a63cdc099d1943080b420b9d78bc1.stex new file mode 100644 index 0000000..787980a Binary files /dev/null and b/.import/pink.png-302a63cdc099d1943080b420b9d78bc1.stex differ diff --git a/.import/pinkland.png-89aa9c0ad4bde8be0c3d0c4cbdc3a29b.md5 b/.import/pinkland.png-89aa9c0ad4bde8be0c3d0c4cbdc3a29b.md5 new file mode 100644 index 0000000..13f7e8f --- /dev/null +++ b/.import/pinkland.png-89aa9c0ad4bde8be0c3d0c4cbdc3a29b.md5 @@ -0,0 +1,3 @@ +source_md5="3b678839fd9858a1e3ecfa688323aa96" +dest_md5="99a47f1452107ec15cdd4d018d20c3aa" + diff --git a/.import/pinkland.png-89aa9c0ad4bde8be0c3d0c4cbdc3a29b.stex b/.import/pinkland.png-89aa9c0ad4bde8be0c3d0c4cbdc3a29b.stex new file mode 100644 index 0000000..3b0e6ea Binary files /dev/null and b/.import/pinkland.png-89aa9c0ad4bde8be0c3d0c4cbdc3a29b.stex differ diff --git a/.import/yellow.png-02c26865a4bfcfe629729004bad7f963.md5 b/.import/yellow.png-02c26865a4bfcfe629729004bad7f963.md5 new file mode 100644 index 0000000..b702404 --- /dev/null +++ b/.import/yellow.png-02c26865a4bfcfe629729004bad7f963.md5 @@ -0,0 +1,3 @@ +source_md5="a536953d44dec3a7545a7e5aaabb2996" +dest_md5="681c8c324b7945b9f9f4b20e393c7b97" + diff --git a/.import/yellow.png-02c26865a4bfcfe629729004bad7f963.stex b/.import/yellow.png-02c26865a4bfcfe629729004bad7f963.stex new file mode 100644 index 0000000..a115cf4 Binary files /dev/null and b/.import/yellow.png-02c26865a4bfcfe629729004bad7f963.stex differ diff --git a/.import/yellowland.png-0bbad559ac24095d2d168e5b71163eb9.md5 b/.import/yellowland.png-0bbad559ac24095d2d168e5b71163eb9.md5 new file mode 100644 index 0000000..f916b0a --- /dev/null +++ b/.import/yellowland.png-0bbad559ac24095d2d168e5b71163eb9.md5 @@ -0,0 +1,3 @@ +source_md5="0a5095f858f5fae1384f44394fe89436" +dest_md5="2e9d8553b0796ebe91a939db4cc595fb" + diff --git a/.import/yellowland.png-0bbad559ac24095d2d168e5b71163eb9.stex b/.import/yellowland.png-0bbad559ac24095d2d168e5b71163eb9.stex new file mode 100644 index 0000000..08db330 Binary files /dev/null and b/.import/yellowland.png-0bbad559ac24095d2d168e5b71163eb9.stex differ diff --git a/Lemon.gd b/Lemon.gd index 66a309a..6b6f2a6 100644 --- a/Lemon.gd +++ b/Lemon.gd @@ -3,8 +3,47 @@ extends Node # Lemonland Game Window onready var ui = $UI - +export var websocket_url = "ws://127.0.0.1:8080" +var _client = WebSocketClient.new() + func _ready(): TranslationServer.set_locale("en") - for n in get_tree().get_nodes_in_group("translate"): - n.translate() + for text in get_tree().get_nodes_in_group("translate"): + text.translate() + + _client.connect("connection_closed", self, "_closed") + _client.connect("connection_error", self, "_error") + _client.connect("connection_established", self, "_connected") + _client.connect("data_received", self, "_on_data_received") + + var err = _client.connect_to_url(websocket_url) + if err != OK: + print_debug("Unable to connect") + set_process(false) + +func _error(was_clean = false): + print_debug("Error, clean: ", was_clean) + set_process(false) + +func _closed(was_clean = false): + print_debug("Closed, clean: ", was_clean) + set_process(false) + +func _connected(protocol = ""): + print_debug("Connected with protocol: ", protocol) + _client.get_peer(1).put_packet(JSON.print({'type': 'test', 'message': "Game test packet"}).to_utf8()) + +func _on_data_received(): + var json = JSON.parse(_client.get_peer(1).get_packet().get_string_from_utf8()) + var packet = json.result + if typeof(packet) != 18: + push_error("%s is not a dictionary" % [packet]) + get_tree().quit() + print_debug("Got data from server: ", packet) + if packet['type'] == "view": + ui.change_view(packet) + elif packet['type'] == "portrait": + ui.change_portrait(packet) + +func _process(_delta): + _client.poll() diff --git a/LemonGame.tscn b/LemonGame.tscn index c1394c0..c42821d 100644 --- a/LemonGame.tscn +++ b/LemonGame.tscn @@ -1,11 +1,19 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://Lemon.gd" type="Script" id=1] +[ext_resource path="res://Res/Img/Portrait/blue.png" type="Texture" id=2] [ext_resource path="res://UI/DialogBox.gd" type="Script" id=3] [ext_resource path="res://UI/Action.gd" type="Script" id=4] +[ext_resource path="res://Res/Img/Scene/pinkland.png" type="Texture" id=5] [ext_resource path="res://UI/UI.gd" type="Script" id=6] [ext_resource path="res://icon.png" type="Texture" id=7] +[sub_resource type="StyleBoxEmpty" id=3] +content_margin_left = 0.0 +content_margin_right = 0.0 +content_margin_top = 0.0 +content_margin_bottom = 0.0 + [sub_resource type="Theme" id=1] [sub_resource type="StyleBoxTexture" id=2] @@ -61,14 +69,29 @@ margin_bottom = 335.0 size_flags_horizontal = 3 size_flags_vertical = 3 -[node name="View" type="TextureRect" parent="UI/HBox/Content/Game/VBox/HBox"] +[node name="Scene" type="PanelContainer" parent="UI/HBox/Content/Game/VBox/HBox"] margin_right = 375.0 margin_bottom = 335.0 +rect_min_size = Vector2( 375, 335 ) +custom_styles/panel = SubResource( 3 ) + +[node name="View" type="TextureRect" parent="UI/HBox/Content/Game/VBox/HBox/Scene"] +margin_right = 375.0 +margin_bottom = 335.0 +rect_min_size = Vector2( 375, 335 ) size_flags_horizontal = 3 size_flags_vertical = 3 -texture = ExtResource( 7 ) +texture = ExtResource( 5 ) expand = true +[node name="Portrait" type="TextureRect" parent="UI/HBox/Content/Game/VBox/HBox/Scene"] +margin_right = 375.0 +margin_bottom = 335.0 +rect_min_size = Vector2( 375, 335 ) +size_flags_horizontal = 0 +size_flags_vertical = 0 +texture = ExtResource( 2 ) + [node name="PDA" type="PanelContainer" parent="UI/HBox/Content/Game/VBox/HBox"] margin_left = 379.0 margin_right = 584.0 diff --git a/Res/Img/Portrait/blue.png b/Res/Img/Portrait/blue.png new file mode 100644 index 0000000..ce9db5c Binary files /dev/null and b/Res/Img/Portrait/blue.png differ diff --git a/Res/Img/Portrait/blue.png.import b/Res/Img/Portrait/blue.png.import new file mode 100644 index 0000000..fa12aac --- /dev/null +++ b/Res/Img/Portrait/blue.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/blue.png-e0f5f5b5c4b775bd8c0818e2c803259e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Res/Img/Portrait/blue.png" +dest_files=[ "res://.import/blue.png-e0f5f5b5c4b775bd8c0818e2c803259e.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Res/Img/Portrait/pink.png b/Res/Img/Portrait/pink.png new file mode 100644 index 0000000..fdbacd3 Binary files /dev/null and b/Res/Img/Portrait/pink.png differ diff --git a/Res/Img/Portrait/pink.png.import b/Res/Img/Portrait/pink.png.import new file mode 100644 index 0000000..dd6a12f --- /dev/null +++ b/Res/Img/Portrait/pink.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pink.png-302a63cdc099d1943080b420b9d78bc1.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Res/Img/Portrait/pink.png" +dest_files=[ "res://.import/pink.png-302a63cdc099d1943080b420b9d78bc1.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Res/Img/Portrait/yellow.png b/Res/Img/Portrait/yellow.png new file mode 100644 index 0000000..3a07788 Binary files /dev/null and b/Res/Img/Portrait/yellow.png differ diff --git a/Res/Img/Portrait/yellow.png.import b/Res/Img/Portrait/yellow.png.import new file mode 100644 index 0000000..17ae19a --- /dev/null +++ b/Res/Img/Portrait/yellow.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/yellow.png-02c26865a4bfcfe629729004bad7f963.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Res/Img/Portrait/yellow.png" +dest_files=[ "res://.import/yellow.png-02c26865a4bfcfe629729004bad7f963.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Res/Img/Scene/blueland.png b/Res/Img/Scene/blueland.png new file mode 100644 index 0000000..fc822a0 Binary files /dev/null and b/Res/Img/Scene/blueland.png differ diff --git a/Res/Img/Scene/blueland.png.import b/Res/Img/Scene/blueland.png.import new file mode 100644 index 0000000..e26ec0b --- /dev/null +++ b/Res/Img/Scene/blueland.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/blueland.png-f478fe8d87e2af2735e01bc75579867e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Res/Img/Scene/blueland.png" +dest_files=[ "res://.import/blueland.png-f478fe8d87e2af2735e01bc75579867e.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Res/Img/Scene/pinkland.png b/Res/Img/Scene/pinkland.png new file mode 100644 index 0000000..13c0001 Binary files /dev/null and b/Res/Img/Scene/pinkland.png differ diff --git a/Res/Img/Scene/pinkland.png.import b/Res/Img/Scene/pinkland.png.import new file mode 100644 index 0000000..1e610a1 --- /dev/null +++ b/Res/Img/Scene/pinkland.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pinkland.png-89aa9c0ad4bde8be0c3d0c4cbdc3a29b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Res/Img/Scene/pinkland.png" +dest_files=[ "res://.import/pinkland.png-89aa9c0ad4bde8be0c3d0c4cbdc3a29b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Res/Img/Scene/yellowland.png b/Res/Img/Scene/yellowland.png new file mode 100644 index 0000000..949dcd1 Binary files /dev/null and b/Res/Img/Scene/yellowland.png differ diff --git a/Res/Img/Scene/yellowland.png.import b/Res/Img/Scene/yellowland.png.import new file mode 100644 index 0000000..625626b --- /dev/null +++ b/Res/Img/Scene/yellowland.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/yellowland.png-0bbad559ac24095d2d168e5b71163eb9.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Res/Img/Scene/yellowland.png" +dest_files=[ "res://.import/yellowland.png-0bbad559ac24095d2d168e5b71163eb9.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/UI/UI.gd b/UI/UI.gd index 79320dc..1ebcd02 100644 --- a/UI/UI.gd +++ b/UI/UI.gd @@ -4,9 +4,12 @@ onready var action = $HBox/Content/Game/VBox/HBox2/VBox/Action onready var messages = $HBox/Content/Game/VBox/Messages onready var partner = $HBox/Content/Game/VBox/HBox2/Partner onready var PDA = $HBox/Content/Game/VBox/HBox/PDA -onready var shoutbox = $HBox/Shoutbox onready var whatnow = $HBox/Content/Game/VBox/HBox2/VBox/WhatNow -onready var view = $HBox/Content/Game/VBox/HBox/View +onready var view = $HBox/Content/Game/VBox/HBox/Scene/View +onready var portrait = $HBox/Content/Game/VBox/HBox/Scene/Portrait -func send_chat_message(id, msg): - get_parent().send_chat_message(id, msg) +func change_view(packet): + view.texture = load("res://Res/Img/Scene/" + packet["loc"] + ".png") + +func change_portrait(packet): + portrait.texture = load("res://Res/Img/Portrait/" + packet["npc"] + ".png") diff --git a/UI/View/View.gd b/UI/View/View.gd new file mode 100644 index 0000000..60b2015 --- /dev/null +++ b/UI/View/View.gd @@ -0,0 +1 @@ +/Img/Portrait/" + packet["npc"] + ".png")