support dialogue, actions
This commit is contained in:
@@ -6,6 +6,9 @@ onready var ui = $UI
|
||||
export var websocket_url = "ws://127.0.0.1:8080"
|
||||
var _client = WebSocketClient.new()
|
||||
|
||||
func act(action):
|
||||
_client.get_peer(1).put_packet(JSON.print({'type': 'action', 'action': action}).to_utf8())
|
||||
|
||||
func _ready():
|
||||
TranslationServer.set_locale("en")
|
||||
for text in get_tree().get_nodes_in_group("translate"):
|
||||
|
||||
@@ -139,6 +139,10 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
columns = 2
|
||||
|
||||
[node name="Button" type="Button" parent="UI/HBox/Content/Game/VBox/HBox2/VBox/Action"]
|
||||
margin_right = 12.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="Partner" type="TextureRect" parent="UI/HBox/Content/Game/VBox/HBox2"]
|
||||
margin_left = 434.0
|
||||
margin_right = 584.0
|
||||
|
||||
@@ -16,6 +16,9 @@ func change_portrait(packet):
|
||||
func change_view(packet):
|
||||
view.texture = load("res://Res/Img/Scene/" + packet["loc"] + ".png")
|
||||
|
||||
func _on_action_decided(action_decided):
|
||||
get_parent().act(action_decided)
|
||||
|
||||
# Modify Available Actions
|
||||
func consider_actions(packet):
|
||||
if packet['clear_box']:
|
||||
@@ -25,6 +28,7 @@ func consider_actions(packet):
|
||||
var b = Button.new()
|
||||
b.set_text(tr(a))
|
||||
action.add_child(b)
|
||||
b.connect("button_up", self, "_on_action_decided", [a])
|
||||
|
||||
# Modify Prose in Dialogue Box
|
||||
func write_prose(packet):
|
||||
|
||||
Reference in New Issue
Block a user