added support for changing prose, action options, etc
This commit is contained in:
@@ -40,7 +40,11 @@ func _on_data_received():
|
||||
push_error("%s is not a dictionary" % [packet])
|
||||
get_tree().quit()
|
||||
print_debug("Got data from server: ", packet)
|
||||
if packet['type'] == "view":
|
||||
if packet['type'] == "action":
|
||||
ui.consider_actions(packet)
|
||||
elif packet['type'] == "prose":
|
||||
ui.write_prose(packet)
|
||||
elif packet['type'] == "view":
|
||||
ui.change_view(packet)
|
||||
elif packet['type'] == "portrait":
|
||||
ui.change_portrait(packet)
|
||||
|
||||
+2
-6
@@ -1,9 +1,7 @@
|
||||
[gd_scene load_steps=11 format=2]
|
||||
[gd_scene load_steps=9 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]
|
||||
@@ -102,7 +100,7 @@ size_flags_vertical = 0
|
||||
theme = SubResource( 1 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
|
||||
[node name="Messages" type="RichTextLabel" parent="UI/HBox/Content/Game/VBox"]
|
||||
[node name="Prose" type="RichTextLabel" parent="UI/HBox/Content/Game/VBox"]
|
||||
margin_top = 339.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 404.0
|
||||
@@ -111,7 +109,6 @@ size_flags_vertical = 3
|
||||
text = "You are in the Customs Office.
|
||||
WARNING: You have no light source.
|
||||
Dan is hungry. You should feed him soon."
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="HBox2" type="HBoxContainer" parent="UI/HBox/Content/Game/VBox"]
|
||||
margin_top = 408.0
|
||||
@@ -141,7 +138,6 @@ margin_bottom = 150.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
columns = 2
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Partner" type="TextureRect" parent="UI/HBox/Content/Game/VBox/HBox2"]
|
||||
margin_left = 434.0
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
extends GridContainer
|
||||
|
||||
var storyteller
|
||||
|
||||
func update_actions(dict):
|
||||
for a in dict['actions']:
|
||||
var b = Button.new()
|
||||
b.set_text(tr(a))
|
||||
add_child(b)
|
||||
|
||||
func _ready():
|
||||
add_to_group("action_box")
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
extends RichTextLabel
|
||||
|
||||
var storyteller
|
||||
|
||||
func update_dialog(dict):
|
||||
set_text(tr(dict['line']))
|
||||
|
||||
func _ready():
|
||||
add_to_group("dialog_box")
|
||||
|
||||
@@ -1,15 +1,33 @@
|
||||
extends PanelContainer
|
||||
|
||||
onready var action = $HBox/Content/Game/VBox/HBox2/VBox/Action
|
||||
onready var messages = $HBox/Content/Game/VBox/Messages
|
||||
onready var prose = $HBox/Content/Game/VBox/Prose
|
||||
onready var partner = $HBox/Content/Game/VBox/HBox2/Partner
|
||||
onready var PDA = $HBox/Content/Game/VBox/HBox/PDA
|
||||
onready var whatnow = $HBox/Content/Game/VBox/HBox2/VBox/WhatNow
|
||||
onready var view = $HBox/Content/Game/VBox/HBox/Scene/View
|
||||
onready var portrait = $HBox/Content/Game/VBox/HBox/Scene/Portrait
|
||||
|
||||
func change_view(packet):
|
||||
view.texture = load("res://Res/Img/Scene/" + packet["loc"] + ".png")
|
||||
|
||||
# Change Dialogue Portrait of NPC
|
||||
func change_portrait(packet):
|
||||
portrait.texture = load("res://Res/Img/Portrait/" + packet["npc"] + ".png")
|
||||
|
||||
# Change Image of Scene, Room, Environment, etc
|
||||
func change_view(packet):
|
||||
view.texture = load("res://Res/Img/Scene/" + packet["loc"] + ".png")
|
||||
|
||||
# Modify Available Actions
|
||||
func consider_actions(packet):
|
||||
if packet['clear_box']:
|
||||
for child in action.get_children():
|
||||
child.queue_free()
|
||||
for a in packet['actions']:
|
||||
var b = Button.new()
|
||||
b.set_text(tr(a))
|
||||
action.add_child(b)
|
||||
|
||||
# Modify Prose in Dialogue Box
|
||||
func write_prose(packet):
|
||||
if packet['clear_box']:
|
||||
prose.text = ""
|
||||
prose.text += packet['message'] + "\n"
|
||||
|
||||
Reference in New Issue
Block a user