game supports changing views and dialogue portraits
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
source_md5="56083153d0476dc805eeb2236d5662f6"
|
||||||
|
dest_md5="b41d1f41b27190bbe31700a9e03aa47b"
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
source_md5="19b355c80268c5d7c75dff312b074ff8"
|
||||||
|
dest_md5="87f91c20fc1ab88382f1694bb73ee383"
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
source_md5="2a8c269cb6abb91f04148edd94f0be8f"
|
||||||
|
dest_md5="af39e05d79c16507bcbd8002ba17d6f2"
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
source_md5="3b678839fd9858a1e3ecfa688323aa96"
|
||||||
|
dest_md5="99a47f1452107ec15cdd4d018d20c3aa"
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
source_md5="a536953d44dec3a7545a7e5aaabb2996"
|
||||||
|
dest_md5="681c8c324b7945b9f9f4b20e393c7b97"
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
source_md5="0a5095f858f5fae1384f44394fe89436"
|
||||||
|
dest_md5="2e9d8553b0796ebe91a939db4cc595fb"
|
||||||
|
|
||||||
Binary file not shown.
@@ -3,8 +3,47 @@ extends Node
|
|||||||
# Lemonland Game Window
|
# Lemonland Game Window
|
||||||
|
|
||||||
onready var ui = $UI
|
onready var ui = $UI
|
||||||
|
export var websocket_url = "ws://127.0.0.1:8080"
|
||||||
|
var _client = WebSocketClient.new()
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
TranslationServer.set_locale("en")
|
TranslationServer.set_locale("en")
|
||||||
for n in get_tree().get_nodes_in_group("translate"):
|
for text in get_tree().get_nodes_in_group("translate"):
|
||||||
n.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()
|
||||||
|
|||||||
+26
-3
@@ -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://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/DialogBox.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://UI/Action.gd" type="Script" id=4]
|
[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://UI/UI.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://icon.png" type="Texture" id=7]
|
[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="Theme" id=1]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxTexture" id=2]
|
[sub_resource type="StyleBoxTexture" id=2]
|
||||||
@@ -61,14 +69,29 @@ margin_bottom = 335.0
|
|||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 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_right = 375.0
|
||||||
margin_bottom = 335.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_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
texture = ExtResource( 7 )
|
texture = ExtResource( 5 )
|
||||||
expand = true
|
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"]
|
[node name="PDA" type="PanelContainer" parent="UI/HBox/Content/Game/VBox/HBox"]
|
||||||
margin_left = 379.0
|
margin_left = 379.0
|
||||||
margin_right = 584.0
|
margin_right = 584.0
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
@@ -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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
@@ -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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -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
|
||||||
@@ -4,9 +4,12 @@ onready var action = $HBox/Content/Game/VBox/HBox2/VBox/Action
|
|||||||
onready var messages = $HBox/Content/Game/VBox/Messages
|
onready var messages = $HBox/Content/Game/VBox/Messages
|
||||||
onready var partner = $HBox/Content/Game/VBox/HBox2/Partner
|
onready var partner = $HBox/Content/Game/VBox/HBox2/Partner
|
||||||
onready var PDA = $HBox/Content/Game/VBox/HBox/PDA
|
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 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):
|
func change_view(packet):
|
||||||
get_parent().send_chat_message(id, msg)
|
view.texture = load("res://Res/Img/Scene/" + packet["loc"] + ".png")
|
||||||
|
|
||||||
|
func change_portrait(packet):
|
||||||
|
portrait.texture = load("res://Res/Img/Portrait/" + packet["npc"] + ".png")
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
/Img/Portrait/" + packet["npc"] + ".png")
|
||||||
Reference in New Issue
Block a user