More work on dialogue, portraits, customizer and intro
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class_name AdventurerPortrait extends Control
|
||||
|
||||
|
||||
var option_sets : Dictionary
|
||||
var cv_lists : Array
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -8,9 +8,18 @@ func _ready() -> void:
|
||||
cv_lists.resize(ColorVariant.Types.size())
|
||||
for i in range(len(cv_lists)):
|
||||
cv_lists[i] = []
|
||||
for child in get_children():
|
||||
add_color_variants(get_children())
|
||||
for child : Control in get_children():
|
||||
if child.get_child_count() > 0:
|
||||
option_sets[child.name.to_lower()] = child
|
||||
|
||||
func add_color_variants(list : Array) -> void:
|
||||
for child : Control in list:
|
||||
if child is ColorVariant:
|
||||
cv_lists[child.type].append(child)
|
||||
if child.get_child_count() > 0:
|
||||
add_color_variants(child.get_children())
|
||||
|
||||
|
||||
func set_appearance(appearance) -> void:
|
||||
set_color(ColorVariant.Types.HAIR, appearance.hair_color)
|
||||
@@ -39,3 +48,13 @@ static func random_color(type : ColorVariant.Types) -> String:
|
||||
func set_color(type : ColorVariant.Types, color : String) -> void:
|
||||
for cv : ColorVariant in cv_lists[type]:
|
||||
cv.set_color(color)
|
||||
|
||||
func flash_color_variants(node : Control, flashing : bool) -> void:
|
||||
if node is ColorVariant:
|
||||
node.flash(flashing)
|
||||
|
||||
for child in node.get_children():
|
||||
flash_color_variants(child, flashing)
|
||||
|
||||
func flash_option(key : String, flashing : bool) -> void:
|
||||
flash_color_variants(option_sets[key], flashing)
|
||||
|
||||
@@ -52,7 +52,7 @@ static var hair_colors = {
|
||||
"brown":{
|
||||
"weight": 100,
|
||||
"color": preload("res://external/test portrait/gradients/hair/(c)brown.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/hair/(l)dark.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/hair/(l)mid.tres"),
|
||||
},
|
||||
"black":{
|
||||
"weight": 100,
|
||||
@@ -74,17 +74,17 @@ static var hair_colors = {
|
||||
static var skin_colors = {
|
||||
"pale":{
|
||||
"weight": 100,
|
||||
"color": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
"color": preload("res://external/test portrait/gradients/skin/(c)pale.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
},
|
||||
"medium":{
|
||||
"weight": 100,
|
||||
"color": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
"color": preload("res://external/test portrait/gradients/skin/(c)medium.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
},
|
||||
"olive":{
|
||||
"weight": 100,
|
||||
"color": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
"color": preload("res://external/test portrait/gradients/skin/(c)blue.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
},
|
||||
"brown":{
|
||||
@@ -94,17 +94,22 @@ static var skin_colors = {
|
||||
},
|
||||
"dark":{
|
||||
"weight": 100,
|
||||
"color": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
"color": preload("res://external/test portrait/gradients/skin/(c)dark.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/eyes/(l)default.tres"),
|
||||
},
|
||||
"white":{
|
||||
"weight": 0,
|
||||
"color": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
"color": preload("res://external/test portrait/gradients/skin/(c)white.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
},
|
||||
"red":{
|
||||
"weight": 0,
|
||||
"color": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
"color": preload("res://external/test portrait/gradients/skin/(c)red.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
},
|
||||
"blue":{
|
||||
"weight": 0,
|
||||
"color": preload("res://external/test portrait/gradients/skin/(c)blue.tres"),
|
||||
"luminosity": preload("res://external/test portrait/gradients/eyes/(c)blue.tres"),
|
||||
},
|
||||
}
|
||||
@@ -133,3 +138,6 @@ func set_color(color : String) -> void:
|
||||
var mat = material
|
||||
mat.set_shader_parameter("color_gradient",col_gradients.color)
|
||||
mat.set_shader_parameter("luminosity_gradient",col_gradients.luminosity)
|
||||
|
||||
func flash(flashing : bool) -> void:
|
||||
material.set_shader_parameter("flash",flashing)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
extends Node
|
||||
|
||||
var player_data : Adventurer = null
|
||||
var player : Player = null
|
||||
var panel : GamePanel = null
|
||||
var player_profile : Window = null
|
||||
@@ -11,6 +12,8 @@ var end_shift_confirm_template = preload("res://templates/end_shift_confirmation
|
||||
var player_profile_template = preload("res://templates/player_profile_window.tscn")
|
||||
var last_screenshot : Image
|
||||
func _ready() -> void:
|
||||
player_data = Adventurer.new()
|
||||
Quest.load_quest_list()
|
||||
DisplayServer.register_additional_output(self)
|
||||
end_shift_confirmation = end_shift_confirm_template.instantiate()
|
||||
add_child(end_shift_confirmation)
|
||||
@@ -88,8 +91,9 @@ func test_save() -> void:
|
||||
save_dict["guildname"] = Guild.name
|
||||
save_dict["guildlevel"] = Guild.level
|
||||
#Save the player data
|
||||
save_dict["playername"] = player.data.full_name()
|
||||
save_dict["playerlevel"] = player.data.level
|
||||
if player:
|
||||
save_dict["playername"] = player.data.full_name()
|
||||
save_dict["playerlevel"] = player.data.level
|
||||
#Save the employee data
|
||||
#Save the adventurer data
|
||||
#Save the quest data
|
||||
@@ -133,3 +137,9 @@ func switch_scenes(scene_name : String) -> void:
|
||||
|
||||
func switch_dialogue(timeline_name : String, label : String) -> void:
|
||||
Dialogic.start("res://dialogic/timelines/" + timeline_name + ".dtl", label)
|
||||
|
||||
func save_quests(save_dict : Dictionary) -> void:
|
||||
var lst = []
|
||||
for quest in Guild.quests:
|
||||
lst.append(quest.save_dict())
|
||||
save_dict.quests = lst
|
||||
|
||||
@@ -40,9 +40,12 @@ func update_signature_threshold(value : float) -> void:
|
||||
func _on_sign_button_pressed() -> void:
|
||||
signButton.visible = false
|
||||
var tween = create_tween()
|
||||
Game.player_data.name = %FirstNameEdit.text
|
||||
Game.player_data.surname = %LastNameEdit.text
|
||||
write_sound.play()
|
||||
tween.tween_method(update_signature_threshold, -0.1, 1.1, .5)
|
||||
|
||||
tween.tween_interval(1)
|
||||
tween.tween_callback(Game.switch_dialogue.bind("game_start", "Start Schedule"))
|
||||
#Sign the card.
|
||||
#Dialogic.paused = false
|
||||
#Dialogic.Jump.jump_to_label("")
|
||||
|
||||
@@ -3,6 +3,7 @@ class_name GamePanel extends MarginContainer
|
||||
const notice_template = preload("res://templates/notice_panel.tscn")
|
||||
const quest_progress_bar_template = preload("res://templates/quest_progress_bar.tscn")
|
||||
const quest_view_template = preload("res://templates/quest_view.tscn")
|
||||
const options_template = preload("res://scenes/options.tscn")
|
||||
|
||||
signal time_changed(time : float)
|
||||
|
||||
@@ -100,3 +101,9 @@ func _on_drag_region_gui_input(event: InputEvent) -> void:
|
||||
|
||||
func _on_quest_viewer_button_pressed() -> void:
|
||||
%QuestView.visible = !%QuestView.visible
|
||||
|
||||
|
||||
func _on_options_button_pressed() -> void:
|
||||
var opt = options_template.instantiate()
|
||||
get_tree().root.add_child(opt)
|
||||
pass # Replace with function body.
|
||||
|
||||
@@ -2,24 +2,31 @@
|
||||
extends TextureButton
|
||||
|
||||
|
||||
@onready var panel : PanelContainer = $Panel
|
||||
@onready var panel : PanelContainer = %BriefPanel
|
||||
@onready var anim_player : AnimationPlayer = $AnimationPlayer
|
||||
var panel_shown : bool = false
|
||||
@export var primed : bool = false
|
||||
var locked : bool = true
|
||||
var mat : ShaderMaterial
|
||||
var _circle_size : float = 0
|
||||
@export var circle_size: float:
|
||||
var circle_size: float:
|
||||
get(): return _circle_size
|
||||
set(value):
|
||||
_circle_size = value
|
||||
queue_redraw()
|
||||
@export var add_color : Color
|
||||
@export var threshold : float
|
||||
@export var thickness : float = 5
|
||||
@export var max_circle_size : float = 200
|
||||
var add_color : Color = Color(1,1,1,0)
|
||||
var threshold : float = .361
|
||||
var thickness : float = 5
|
||||
var max_circle_size : float = 200
|
||||
|
||||
@export var label : String = ""
|
||||
@export var locked_brief : String = ""
|
||||
@export var unlocked_brief : String = ""
|
||||
|
||||
func _ready() -> void:
|
||||
#TODO: Add a nine-patch and resize the banner based on the label contents
|
||||
%Label.text = label
|
||||
%Brief.text = locked_brief
|
||||
mat = %CanvasGroup.material
|
||||
if primed:
|
||||
anim_player.play("primed")
|
||||
@@ -28,10 +35,21 @@ func _process(delta: float) -> void:
|
||||
mat.set_shader_parameter("add_color", add_color)
|
||||
mat.set_shader_parameter("threshold", threshold)
|
||||
|
||||
func reposition_brief() -> void:
|
||||
print(%BriefPanel.size.y)
|
||||
print(%Brief.size.y)
|
||||
%BriefPanel.pivot_offset = Vector2(0, %Brief.size.y)
|
||||
%BriefPanel.position.y += %BriefPanel.size.y - %Brief.size.y
|
||||
%Brief.get_line_height()
|
||||
|
||||
func unlock() -> void:
|
||||
locked = false
|
||||
primed = false
|
||||
anim_player.play("unlock")
|
||||
print(%Brief.size.y)
|
||||
%Brief.text = unlocked_brief
|
||||
print(%Brief.size.y)
|
||||
reposition_brief.call_deferred()
|
||||
$AudioStreamPlayer2D.play()
|
||||
|
||||
func _on_mouse_entered() -> void:
|
||||
|
||||
29
scripts/options.gd
Normal file
29
scripts/options.gd
Normal file
@@ -0,0 +1,29 @@
|
||||
extends Control
|
||||
|
||||
var superquitting: bool = false
|
||||
|
||||
func show_quit_confirm() -> void:
|
||||
$ConfirmationDialog.popup_centered()
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
queue_free()
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
superquitting = false
|
||||
show_quit_confirm()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_superquit_button_pressed() -> void:
|
||||
superquitting = true
|
||||
show_quit_confirm()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_confirmation_dialog_confirmed() -> void:
|
||||
Game.test_save()
|
||||
queue_free()
|
||||
if superquitting:
|
||||
get_tree().quit()
|
||||
else:
|
||||
Game.switch_scenes("start_menu")
|
||||
1
scripts/options.gd.uid
Normal file
1
scripts/options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b2jhi1k8mktqm
|
||||
50
scripts/portrait_customizer.gd
Normal file
50
scripts/portrait_customizer.gd
Normal file
@@ -0,0 +1,50 @@
|
||||
extends Control
|
||||
|
||||
@onready var portrait : AdventurerPortrait = $HeroPortrait
|
||||
var option = 0
|
||||
var opt_key : String = ""
|
||||
var choices : Array = []
|
||||
|
||||
func _ready() -> void:
|
||||
choices.resize(portrait.option_sets.size())
|
||||
choices.fill(0)
|
||||
opt_key = portrait.option_sets.keys()[option]
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], true)
|
||||
|
||||
func _on_left_button_pressed() -> void:
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = false
|
||||
choices[option] -= 1
|
||||
if choices[option] < 0:
|
||||
choices[option] = portrait.option_sets[opt_key].get_child_count() - 1
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = true
|
||||
|
||||
|
||||
func _on_right_button_pressed() -> void:
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = false
|
||||
choices[option] += 1
|
||||
if choices[option] >= portrait.option_sets[opt_key].get_child_count():
|
||||
choices[option] -= portrait.option_sets[opt_key].get_child_count()
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = true
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_up_button_pressed() -> void:
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], false)
|
||||
option -= 1
|
||||
if option < 0:
|
||||
option = portrait.option_sets.keys().size() - 1
|
||||
opt_key = portrait.option_sets.keys()[option]
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], true)
|
||||
|
||||
|
||||
func _on_down_button_pressed() -> void:
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], false)
|
||||
option += 1
|
||||
if option >= portrait.option_sets.keys().size():
|
||||
option -= portrait.option_sets.keys().size()
|
||||
opt_key = portrait.option_sets.keys()[option]
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], true)
|
||||
|
||||
|
||||
func _on_color_pressed(slot : ColorVariant.Types, col : String) -> void:
|
||||
portrait.set_color(slot, col)
|
||||
1
scripts/portrait_customizer.gd.uid
Normal file
1
scripts/portrait_customizer.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://y86x71nakgkl
|
||||
@@ -46,18 +46,23 @@ func generate_waypoints():
|
||||
waypoints = []
|
||||
|
||||
#Include the "end" in the count
|
||||
var num = quest.num_events()+1
|
||||
for i in range(1,num):
|
||||
var pct : float = i / float(num)
|
||||
add_waypoint( pct, quest.events[i-1])
|
||||
var num = quest.num_events()
|
||||
#add_waypoint(0, Quest.Event.new())
|
||||
#waypoints[0].
|
||||
for evt : Quest.Event in quest.events:
|
||||
add_waypoint( evt.progress_point, evt)
|
||||
#add_waypoint(1, Quest.Event.new())
|
||||
|
||||
func add_waypoint(pct : float, event : Quest.Event):
|
||||
var wp = waypoint_template.instantiate()
|
||||
|
||||
waypoints.append(wp)
|
||||
wp.percent = pct
|
||||
#TODO: Make events matter
|
||||
wp.event = event
|
||||
%Waypoints.add_child(wp)
|
||||
if event.hidden:
|
||||
wp.visible = false
|
||||
wp.global_position = %Waypoints.global_position + Vector2(pct * length - 16, -9)
|
||||
if bar.value / bar.max_value >= pct:
|
||||
wp.fill = true
|
||||
@@ -86,7 +91,10 @@ func setup(quest : Quest) -> void:
|
||||
|
||||
func progress_quest() -> void:
|
||||
var pct = time_elapsed / quest.length
|
||||
quest.progress = pct
|
||||
if next_waypoint < len(waypoints) and pct >= waypoints[next_waypoint].percent:
|
||||
if waypoints[next_waypoint].visible == false:
|
||||
waypoints[next_waypoint].visible = true
|
||||
start_event(waypoints[next_waypoint].event, (pct - waypoints[next_waypoint].percent) * quest.length)
|
||||
pct = waypoints[next_waypoint].percent
|
||||
waypoints[next_waypoint].blink(true)
|
||||
|
||||
@@ -31,3 +31,8 @@ func pause_setting() -> void:
|
||||
|
||||
func unpause_setting() -> void:
|
||||
setting.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
|
||||
func show_quest_complete() -> void:
|
||||
%QuestComplete.visible = true
|
||||
set_questor_animation("idle")
|
||||
setting.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
|
||||
@@ -5,12 +5,9 @@ var test_item = preload("res://data/items/pitchfork.tres")
|
||||
func _ready() -> void:
|
||||
#var adv : Adventurer = test_adv.instantiate() as Adventurer
|
||||
#Guild.register_guild_member(adv)
|
||||
var quest : Quest = Quest.new()
|
||||
var evt : Quest.Event = Quest.Event.new()
|
||||
evt.type = Quest.Event.Type.COMBAT
|
||||
evt.enemies = ["goo"]
|
||||
evt.time = 10
|
||||
quest.events.append(evt)
|
||||
var lst = Quest.list
|
||||
var quest : Quest = Quest.list[1].duplicate(true)
|
||||
quest.setup()
|
||||
Guild.add_quest(quest)
|
||||
Guild.assign_quest(Game.player.data, quest)
|
||||
var itm = test_item.duplicate()
|
||||
|
||||
@@ -24,4 +24,4 @@ func appear(show_time : float):
|
||||
func _on_timer_timeout() -> void:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "modulate", Color(1,1,1,0), .5)
|
||||
tween.tween_callback(queue_free)
|
||||
#tween.tween_callback(queue_free)
|
||||
|
||||
Reference in New Issue
Block a user