Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
4 changes: 3 additions & 1 deletion examples/VisualNovel/DialogPiece.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ margin_right = 942.0
margin_bottom = 64.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text "
bbcode_enabled = true
bbcode_text = "Text"
text = "Text"
12 changes: 1 addition & 11 deletions examples/VisualNovel/ICLogs.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,16 @@ onready var scroll_container = $LogLayout/ScrollContainer
onready var piece_container = $LogLayout/ScrollContainer/PieceContainer
onready var log_layout = $LogLayout

export var duplicate_logging: bool = true

func clear():
for piece in piece_container.get_children():
piece.queue_free()


func add_piece(icon: Texture, showname: String, text: String):
if not duplicate_logging:
for piece in piece_container.get_children():
var piece_name = piece.get_node("HBoxContainer/VBoxContainer/Name").text
var piece_dialog = piece.get_node("HBoxContainer/VBoxContainer/Dialog").text
if showname == piece_name and text == piece_dialog:
# This is a duplicate - don't bother logging it
return

var piece: Control = piece_res.instance()
piece.get_node("HBoxContainer/Avatar").texture = icon
piece.get_node("HBoxContainer/VBoxContainer/Name").text = showname
piece.get_node("HBoxContainer/VBoxContainer/Dialog").text = text
piece.get_node("HBoxContainer/VBoxContainer/Dialog").bbcode_text = text
piece_container.add_child(piece)
yield(get_tree(), "idle_frame")
scroll_container.ensure_control_visible(piece)
Expand Down
5 changes: 2 additions & 3 deletions examples/VisualNovel/Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ func _process(delta):
set_background(bgs[bg_index], 0, 0)


func set_music(mus_path: String):
music_player.stream = load(mus_path)
music_player.play()
func set_music(mus_path: String, speed: float = 1.0):
music_player.play_music(load(mus_path), speed)


func set_background(bg_path: String, smooth: float = 0.5, speed: float = 1.0):
Expand Down
65 changes: 64 additions & 1 deletion examples/VisualNovel/Main.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=2]
[gd_scene load_steps=24 format=2]

[ext_resource path="res://addons/event_system_plugin/nodes/event_manager/event_manager.gd" type="Script" id=1]
[ext_resource path="res://examples/VisualNovel/transition.gdshader" type="Shader" id=2]
Expand All @@ -13,6 +13,7 @@
[ext_resource path="res://addons/textalog/nodes/dialogue_base_node/options_node/options_node.tscn" type="PackedScene" id=11]
[ext_resource path="res://addons/textalog/assets/themes/default_theme/plain_black.tres" type="Theme" id=12]
[ext_resource path="res://examples/VisualNovel/portrait_manager_ex.gd" type="Script" id=13]
[ext_resource path="res://examples/VisualNovel/MusicPlayer.gd" type="Script" id=14]

[sub_resource type="Animation" id=2]
length = 0.001
Expand Down Expand Up @@ -102,6 +103,60 @@ tracks/0/keys = {
"values": [ 1.0, 0.0 ]
}

[sub_resource type="Animation" id=9]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath(".:volume_db")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("CrossfadePlayer:volume_db")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ -80.0 ]
}

[sub_resource type="Animation" id=10]
resource_name = "crossfade"
tracks/0/type = "value"
tracks/0/path = NodePath(".:volume_db")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1.8, 0.2 ),
"update": 0,
"values": [ 0.0, -80.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("CrossfadePlayer:volume_db")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 0.2, 1.8 ),
"update": 0,
"values": [ -80.0, 0.0 ]
}

[node name="Main" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
Expand Down Expand Up @@ -231,6 +286,14 @@ anims/RESET = SubResource( 8 )
anims/transition = SubResource( 6 )

[node name="MusicPlayer" type="AudioStreamPlayer" parent="."]
script = ExtResource( 14 )

[node name="EffectsPlayer" type="AnimationPlayer" parent="MusicPlayer"]
anims/RESET = SubResource( 9 )
anims/crossfade = SubResource( 10 )

[node name="CrossfadePlayer" type="AudioStreamPlayer" parent="MusicPlayer"]
volume_db = -80.0

[connection signal="event_finished" from="EventManager" to="." method="_on_EventManager_event_finished"]
[connection signal="event_started" from="EventManager" to="." method="_on_EventManager_event_started"]
Expand Down
37 changes: 37 additions & 0 deletions examples/VisualNovel/MusicPlayer.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
extends AudioStreamPlayer


onready var effects_player = $EffectsPlayer
onready var crossfade_player = $CrossfadePlayer

var current_song: AudioStream setget set_song, get_song

func play_music(song: AudioStream, speed = 1.0):
# first song played or no crossfade asked of us, skip crossfade
if stream == null or speed <= 0:
stream = song
volume_db = 0
crossfade_player.volume_db = -80
play()
return
if volume_db > crossfade_player.volume_db:
crossfade_player.stream = song
crossfade_player.play()
effects_player.play("crossfade", -1, speed)
else:
stream = song
play()
effects_player.play("crossfade", -1, -speed, true)


func set_song(value: AudioStream):
if volume_db > crossfade_player.volume_db:
stream = value
else:
crossfade_player.stream = value


func get_song():
if volume_db > crossfade_player.volume_db:
return stream
return crossfade_player.stream
2 changes: 1 addition & 1 deletion examples/VisualNovel/characters/Godette.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ centered = false
[node name="Face" type="Sprite" parent="Body"]
use_parent_material = true
position = Vector2( 216, 386 )
texture = ExtResource( 3 )
texture = ExtResource( 10 )
centered = false

[node name="SpeechBubble" type="Sprite" parent="Body"]
Expand Down
4 changes: 2 additions & 2 deletions examples/VisualNovel/timelines/main.tres
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ script = ExtResource( 3 )
continue_at_end = true
node_path = NodePath(".")
method = "set_music"
args = [ "res://examples/assets/music/yume.mp3" ]
args = [ "res://examples/assets/music/yume.ogg" ]

[sub_resource type="Resource" id=2]
script = ExtResource( 4 )
Expand Down Expand Up @@ -115,7 +115,7 @@ script = ExtResource( 3 )
continue_at_end = true
node_path = NodePath(".")
method = "set_music"
args = [ "res://examples/assets/music/seishishitauchu.mp3" ]
args = [ "res://examples/assets/music/seishishitauchu.ogg", 0.3 ]

[sub_resource type="Resource" id=9]
script = ExtResource( 8 )
Expand Down
Binary file removed examples/assets/Godette/Anger.png
Binary file not shown.
Binary file removed examples/assets/Godette/Annoyance.png
Binary file not shown.
Binary file removed examples/assets/Godette/Godette.psd
Binary file not shown.
Binary file removed examples/assets/Godette/Grin.png
Binary file not shown.
Binary file removed examples/assets/Godette/Joy.png
Binary file not shown.
Binary file removed examples/assets/Godette/Laugh.png
Binary file not shown.
Binary file removed examples/assets/Godette/Neutral.png
Binary file not shown.
Binary file removed examples/assets/Godette/Sad.png
Binary file not shown.
Binary file removed examples/assets/Godette/Shocked.png
Binary file not shown.
Binary file removed examples/assets/Godette/Sleepy.png
Binary file not shown.
Binary file removed examples/assets/Godette/Smile.png
Binary file not shown.
Binary file removed examples/assets/Godette/Smug.png
Binary file not shown.
Binary file removed examples/assets/Godette/Suprised.png
Binary file not shown.
Binary file removed examples/assets/Godette/icons.xcf
Binary file not shown.
Binary file modified examples/assets/Godette/icons/Anger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Annoyance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Grin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Joy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Laugh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Neutral.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Sad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Shocked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Sleepy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Smile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Smug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/assets/Godette/icons/Suprised.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed examples/assets/Godette/layers.xcf
Binary file not shown.
Binary file modified examples/assets/Godette/layers/Anger.png
Binary file modified examples/assets/Godette/layers/Annoyance.png
Binary file not shown.
Binary file modified examples/assets/Godette/layers/Grin.png
Binary file modified examples/assets/Godette/layers/Joy.png
Binary file modified examples/assets/Godette/layers/Laugh.png
Binary file modified examples/assets/Godette/layers/Neutral.png
Binary file modified examples/assets/Godette/layers/Sad.png
Binary file modified examples/assets/Godette/layers/Shocked.png
Binary file modified examples/assets/Godette/layers/Sleepy.png
Binary file modified examples/assets/Godette/layers/Smug.png
Binary file modified examples/assets/Godette/layers/Surprised.png
Binary file modified examples/assets/Godette/layers/body.png
Binary file modified examples/assets/Godette/layers/smile.png
Binary file added examples/assets/Godette/preview/Anger.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Anger.png-1e5a2131b90817bf3199185473365741.stex"
path="res://.import/Anger.png-f16414e9169a2600a8690c9b3b640f96.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Anger.png"
dest_files=[ "res://.import/Anger.png-1e5a2131b90817bf3199185473365741.stex" ]
source_file="res://examples/assets/Godette/preview/Anger.png"
dest_files=[ "res://.import/Anger.png-f16414e9169a2600a8690c9b3b640f96.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Annoyance.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Annoyance.png-68df11e9405ed868d80a1614e1822928.stex"
path="res://.import/Annoyance.png-5290174fe4e663d6b7dbe4c1692162ba.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Annoyance.png"
dest_files=[ "res://.import/Annoyance.png-68df11e9405ed868d80a1614e1822928.stex" ]
source_file="res://examples/assets/Godette/preview/Annoyance.png"
dest_files=[ "res://.import/Annoyance.png-5290174fe4e663d6b7dbe4c1692162ba.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Grin.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Grin.png-eb9a8e574a8672fef187ddc2dccf584a.stex"
path="res://.import/Grin.png-b30c1043854a364cbce822d7644b0a49.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Grin.png"
dest_files=[ "res://.import/Grin.png-eb9a8e574a8672fef187ddc2dccf584a.stex" ]
source_file="res://examples/assets/Godette/preview/Grin.png"
dest_files=[ "res://.import/Grin.png-b30c1043854a364cbce822d7644b0a49.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Joy.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Joy.png-2553ab2e5f8934648cea2aac7906ca88.stex"
path="res://.import/Joy.png-d7bb404dfd3cffb79bf0c0b93925e723.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Joy.png"
dest_files=[ "res://.import/Joy.png-2553ab2e5f8934648cea2aac7906ca88.stex" ]
source_file="res://examples/assets/Godette/preview/Joy.png"
dest_files=[ "res://.import/Joy.png-d7bb404dfd3cffb79bf0c0b93925e723.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Laugh.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Laugh.png-0530f36035d38204224bae995054d8d8.stex"
path="res://.import/Laugh.png-ba8fd25f4eb93586432f16b61a68db53.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Laugh.png"
dest_files=[ "res://.import/Laugh.png-0530f36035d38204224bae995054d8d8.stex" ]
source_file="res://examples/assets/Godette/preview/Laugh.png"
dest_files=[ "res://.import/Laugh.png-ba8fd25f4eb93586432f16b61a68db53.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Neutral.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Neutral.png-7727743e5b3fb8692c286d829dfb845c.stex"
path="res://.import/Neutral.png-ba4f06b05eddd4aa7e2fc4d4af1aae67.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Neutral.png"
dest_files=[ "res://.import/Neutral.png-7727743e5b3fb8692c286d829dfb845c.stex" ]
source_file="res://examples/assets/Godette/preview/Neutral.png"
dest_files=[ "res://.import/Neutral.png-ba4f06b05eddd4aa7e2fc4d4af1aae67.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Sad.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Sad.png-428f7a51049295362a868b860d72e6e0.stex"
path="res://.import/Sad.png-ce844fd34f0da813840c0d1a6bc8b4b4.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Sad.png"
dest_files=[ "res://.import/Sad.png-428f7a51049295362a868b860d72e6e0.stex" ]
source_file="res://examples/assets/Godette/preview/Sad.png"
dest_files=[ "res://.import/Sad.png-ce844fd34f0da813840c0d1a6bc8b4b4.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Shocked.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Shocked.png-0e2f2184c8ab4a78acbcf1f7d8abc828.stex"
path="res://.import/Shocked.png-7d5202e7515b6b5cfd254228bd5025a8.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Shocked.png"
dest_files=[ "res://.import/Shocked.png-0e2f2184c8ab4a78acbcf1f7d8abc828.stex" ]
source_file="res://examples/assets/Godette/preview/Shocked.png"
dest_files=[ "res://.import/Shocked.png-7d5202e7515b6b5cfd254228bd5025a8.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Sleepy.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Sleepy.png-6c382b431fb0cc3f1dec6b6ca00626a4.stex"
path="res://.import/Sleepy.png-e36bf151858da290299b9237acb3eef8.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Sleepy.png"
dest_files=[ "res://.import/Sleepy.png-6c382b431fb0cc3f1dec6b6ca00626a4.stex" ]
source_file="res://examples/assets/Godette/preview/Sleepy.png"
dest_files=[ "res://.import/Sleepy.png-e36bf151858da290299b9237acb3eef8.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Smile.png
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/Smile.png-eb18e53320a4fc91e2771385cbf06913.stex"
path="res://.import/Smile.png-75f2f334d325710e5b88906bd8b91c8c.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://examples/assets/Godette/Smile.png"
dest_files=[ "res://.import/Smile.png-eb18e53320a4fc91e2771385cbf06913.stex" ]
source_file="res://examples/assets/Godette/preview/Smile.png"
dest_files=[ "res://.import/Smile.png-75f2f334d325710e5b88906bd8b91c8c.stex" ]

[params]

Expand Down
Binary file added examples/assets/Godette/preview/Smug.png
Loading