got general dialogue to work
This commit is contained in:
parent
cde04c66ac
commit
d5e515e4c1
30
Dialogue.gd
30
Dialogue.gd
|
@ -3,5 +3,33 @@ extends Control
|
||||||
func _ready():
|
func _ready():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func continue_dialogue():
|
||||||
|
if $Tween.is_active():
|
||||||
|
$Tween.remove_all()
|
||||||
|
$RichTextLabel.percent_visible = 1.0
|
||||||
|
return
|
||||||
|
|
||||||
|
$Wol.resume()
|
||||||
|
|
||||||
func _on_Wol_line(line):
|
func _on_Wol_line(line):
|
||||||
prints('got a line', line)
|
print(var2str(line))
|
||||||
|
$RichTextLabel.text = line.text
|
||||||
|
|
||||||
|
$Tween.remove_all()
|
||||||
|
$Tween.interpolate_property(
|
||||||
|
$RichTextLabel,
|
||||||
|
'percent_visible',
|
||||||
|
.0,
|
||||||
|
1.0,
|
||||||
|
.02 * line.text.length()
|
||||||
|
)
|
||||||
|
|
||||||
|
$Tween.start()
|
||||||
|
|
||||||
|
func _on_Wol_options(options):
|
||||||
|
prints('got some options', options)
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventKey and event.scancode == KEY_ENTER and event.pressed:
|
||||||
|
print('Pressed enter!')
|
||||||
|
continue_dialogue()
|
||||||
|
|
|
@ -28,6 +28,9 @@ custom_fonts/normal_font = ExtResource( 1 )
|
||||||
text = "Here is where the dialogue will go.
|
text = "Here is where the dialogue will go.
|
||||||
|
|
||||||
Run the scene in order to see how \"wol\" works."
|
Run the scene in order to see how \"wol\" works."
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
@ -45,4 +48,7 @@ margin_bottom = 66.0
|
||||||
custom_fonts/font = ExtResource( 1 )
|
custom_fonts/font = ExtResource( 1 )
|
||||||
text = "This is a dialogue option"
|
text = "This is a dialogue option"
|
||||||
|
|
||||||
|
[node name="Tween" type="Tween" parent="."]
|
||||||
|
|
||||||
[connection signal="line" from="Wol" to="." method="_on_Wol_line"]
|
[connection signal="line" from="Wol" to="." method="_on_Wol_line"]
|
||||||
|
[connection signal="options" from="Wol" to="." method="_on_Wol_options"]
|
||||||
|
|
|
@ -68,7 +68,9 @@ func set_path(_path):
|
||||||
path = _path
|
path = _path
|
||||||
|
|
||||||
func _handle_line(line):
|
func _handle_line(line):
|
||||||
call_deferred('emit_signal', 'line', line)
|
var id = line.id
|
||||||
|
var string = program.wolStrings[id]
|
||||||
|
call_deferred('emit_signal', 'line', string)
|
||||||
return WolGlobals.HandlerState.PauseExecution
|
return WolGlobals.HandlerState.PauseExecution
|
||||||
|
|
||||||
func _handle_command(command):
|
func _handle_command(command):
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
extends Object
|
extends Object
|
||||||
|
# class_name DialogueLine
|
||||||
|
|
||||||
var id : String
|
var id = ''
|
||||||
var substitutions : Array = []#String
|
var substitutions = []
|
||||||
|
|
||||||
func _init(id: String):
|
func _init(id):
|
||||||
self.id = id
|
self.id = id
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
extends Object
|
extends Object
|
||||||
|
class_name WolLine
|
||||||
|
|
||||||
var text : String
|
var text = ''
|
||||||
var nodeName : String
|
var nodeName = ''
|
||||||
var lineNumber : int
|
var lineNumber = -1
|
||||||
var fileName : String
|
var fileName = ''
|
||||||
var implicit : bool
|
var implicit = false
|
||||||
var meta : Array = []
|
var meta = []
|
||||||
|
|
||||||
func _init(text:String, nodeName:String, lineNumber:int, fileName:String, implicit:bool, meta:Array):
|
func _init(text, nodeName, lineNumber, fileName, implicit, meta):
|
||||||
self.text = text
|
self.text = text
|
||||||
self.nodeName = nodeName
|
self.nodeName = nodeName
|
||||||
self.fileName = fileName
|
self.fileName = fileName
|
||||||
self.implicit = implicit
|
self.implicit = implicit
|
||||||
self.meta = meta
|
self.meta = meta
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,12 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
var programName : String
|
var programName = ''
|
||||||
var wolStrings : Dictionary = {}
|
var wolStrings = {}
|
||||||
var wolNodes : Dictionary = {}
|
var wolNodes = {}
|
||||||
|
|
||||||
func get_node_tags(name:String)->Array:
|
func get_node_tags(name):
|
||||||
return wolNodes[name].tags
|
return wolNodes[name].tags
|
||||||
|
|
||||||
func get_wol_string(key:String)->String:
|
|
||||||
return wolStrings[key]
|
|
||||||
|
|
||||||
func get_node_text(name:String)->String:
|
|
||||||
var key = wolNodes[name].sourceId
|
|
||||||
return get_wol_string(key)
|
|
||||||
|
|
||||||
#possible support for line tags
|
#possible support for line tags
|
||||||
func get_untagged_strings()->Dictionary:
|
func get_untagged_strings()->Dictionary:
|
||||||
return {}
|
return {}
|
||||||
|
@ -25,6 +18,5 @@ func include(other):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func dump(library):
|
func dump(library):
|
||||||
print("not yet implemented")
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -265,6 +265,7 @@ func run_instruction(instruction)->bool:
|
||||||
var name : String = instruction.operands[0].value
|
var name : String = instruction.operands[0].value
|
||||||
var loaded = _dialogue._variableStorage.get_value(name)
|
var loaded = _dialogue._variableStorage.get_value(name)
|
||||||
_state.push_value(loaded)
|
_state.push_value(loaded)
|
||||||
|
|
||||||
WolGlobals.ByteCode.StoreVariable:
|
WolGlobals.ByteCode.StoreVariable:
|
||||||
#store top stack value to variable
|
#store top stack value to variable
|
||||||
var top = _state.peek_value()
|
var top = _state.peek_value()
|
||||||
|
@ -298,13 +299,14 @@ func run_instruction(instruction)->bool:
|
||||||
# add an option to current state
|
# add an option to current state
|
||||||
var key = instruction.operands[0].value
|
var key = instruction.operands[0].value
|
||||||
|
|
||||||
var line = Line.new(key, _program.wolStrings[key])
|
var line = Line.new(key)
|
||||||
|
|
||||||
if instruction.operands.size() > 2:
|
if instruction.operands.size() > 2:
|
||||||
pass #formated text options
|
pass #formated text options
|
||||||
|
|
||||||
# line to show and node name
|
# line to show and node name
|
||||||
_state.currentOptions.append(SimpleEntry.new(line,instruction.operands[1].value))
|
_state.currentOptions.append(SimpleEntry.new(line,instruction.operands[1].value))
|
||||||
|
|
||||||
WolGlobals.ByteCode.ShowOptions:
|
WolGlobals.ByteCode.ShowOptions:
|
||||||
#show options - stop if none
|
#show options - stop if none
|
||||||
if _state.currentOptions.size() == 0:
|
if _state.currentOptions.size() == 0:
|
||||||
|
|
|
@ -6,7 +6,7 @@ position: -1892,-1013
|
||||||
<<load_situation The Revolver>>
|
<<load_situation The Revolver>>
|
||||||
<<animation elevator door open>>
|
<<animation elevator door open>>
|
||||||
|
|
||||||
Masami: Gina, this way!
|
Masami: Gina, this way! #line:5d7a7c
|
||||||
Gina: Patience! I’m coming.
|
Gina: Patience! I’m coming.
|
||||||
>Still, she didn’t pick up her pace and kept hesitantly looking around.<
|
>Still, she didn’t pick up her pace and kept hesitantly looking around.<
|
||||||
Masami: Everything should be fine, let’s just go. We won.
|
Masami: Everything should be fine, let’s just go. We won.
|
||||||
|
@ -14,7 +14,7 @@ Masami: Unless you are planning on backstabbing me at the finish line, that is.
|
||||||
Gina: How funny. You are not that special.
|
Gina: How funny. You are not that special.
|
||||||
Masami: Har har. Now start walking or I’ll carry you out the front door.
|
Masami: Har har. Now start walking or I’ll carry you out the front door.
|
||||||
Masami: I don’t want to give Monokuma the time to come up with a new death game for two while we are trying to get through the exit.
|
Masami: I don’t want to give Monokuma the time to come up with a new death game for two while we are trying to get through the exit.
|
||||||
Gina: …
|
Gina: ...
|
||||||
|
|
||||||
<<zoom to vault door>>
|
<<zoom to vault door>>
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ Masami: The reception desk?
|
||||||
|
|
||||||
<<zoom to gun>>
|
<<zoom to gun>>
|
||||||
|
|
||||||
Masami: A paper and…
|
Masami: A paper and...
|
||||||
Masami: … That’s a gun.
|
Masami: ... That’s a gun.
|
||||||
Gina: A revolver, in fact. Such an old fashioned choice of firearm. Though, I appreciate the aesthetic. How pretty.
|
Gina: A revolver, in fact. Such an old fashioned choice of firearm. Though, I appreciate the aesthetic. How pretty.
|
||||||
Masami: I don’t like this. Why is it here?
|
Masami: I don’t like this. Why is it here?
|
||||||
>I took the paper from the table and briskly unfolded it.<
|
>I took the paper from the table and briskly unfolded it.<
|
||||||
|
|
Reference in a new issue