small bugfixes
This commit is contained in:
parent
0fe6f08e88
commit
e545f620e1
|
|
@ -12,22 +12,7 @@ var max_lines: float = 0
|
||||||
@export var story_array: PackedStringArray = []:
|
@export var story_array: PackedStringArray = []:
|
||||||
set(str_array):
|
set(str_array):
|
||||||
story_array = str_array
|
story_array = str_array
|
||||||
if is_node_ready():
|
_rebuild()
|
||||||
substring_sizes = []
|
|
||||||
var p: int = 0
|
|
||||||
label.text = "[p]"
|
|
||||||
for i in range(str_array.size()):
|
|
||||||
label.text += TranslationServer.translate(str_array[i]).strip_edges() + " "
|
|
||||||
substring_sizes.append(TranslationServer.translate(str_array[i]).strip_edges().length() + 1)
|
|
||||||
if not paragraph_lengths[-1] == story_array.size()-1:
|
|
||||||
paragraph_lengths.append(story_array.size()-1)
|
|
||||||
push_warning("Paragraph lenghts of scene %s are misconfigured!" % name)
|
|
||||||
if paragraph_lengths[p] == i:
|
|
||||||
p += 1
|
|
||||||
label.text += "[/p][p][font_size=8] [/font_size][/p][p]"
|
|
||||||
substring_sizes[-1] = substring_sizes[-1] + 1
|
|
||||||
label.text += "[/p]"
|
|
||||||
max_lines = float(label.get_line_count())
|
|
||||||
|
|
||||||
@export var paragraph_lengths: PackedInt32Array = [1]
|
@export var paragraph_lengths: PackedInt32Array = [1]
|
||||||
|
|
||||||
|
|
@ -92,6 +77,24 @@ func _ready() -> void:
|
||||||
story_array = story_array
|
story_array = story_array
|
||||||
progress = progress
|
progress = progress
|
||||||
|
|
||||||
|
func _rebuild():
|
||||||
|
if is_node_ready():
|
||||||
|
substring_sizes = []
|
||||||
|
var p: int = 0
|
||||||
|
label.text = "[p]"
|
||||||
|
for i in range(story_array.size()):
|
||||||
|
label.text += TranslationServer.translate(story_array[i]).strip_edges() + " "
|
||||||
|
substring_sizes.append(TranslationServer.translate(story_array[i]).strip_edges().length() + 1)
|
||||||
|
if not paragraph_lengths[-1] == story_array.size()-1:
|
||||||
|
paragraph_lengths.append(story_array.size()-1)
|
||||||
|
push_warning("Paragraph lenghts of scene %s are misconfigured!" % name)
|
||||||
|
if paragraph_lengths[p] == i:
|
||||||
|
p += 1
|
||||||
|
label.text += "[/p][p][font_size=8] [/font_size][/p][p]"
|
||||||
|
substring_sizes[-1] = substring_sizes[-1] + 1
|
||||||
|
label.text += "[/p]"
|
||||||
|
max_lines = float(label.get_line_count())
|
||||||
|
|
||||||
func try_scroll():
|
func try_scroll():
|
||||||
var forward_target: int
|
var forward_target: int
|
||||||
|
|
||||||
|
|
@ -125,6 +128,10 @@ func play_scene():
|
||||||
_:
|
_:
|
||||||
animation_player.queue("en")
|
animation_player.queue("en")
|
||||||
|
|
||||||
|
if name == "draven":
|
||||||
|
await get_tree().process_frame
|
||||||
|
await get_tree().process_frame
|
||||||
|
$AnimationPlayer/Music.play()
|
||||||
|
|
||||||
await text_finished
|
await text_finished
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,18 @@ var _is_initialised: bool = false
|
||||||
set(value):
|
set(value):
|
||||||
mementos_complete = value
|
mementos_complete = value
|
||||||
if _is_initialised: changed.emit()
|
if _is_initialised: changed.emit()
|
||||||
|
@export_flags_2d_physics var sequences_enabled: int = 63:
|
||||||
|
set(value):
|
||||||
|
sequences_enabled = value
|
||||||
|
if _is_initialised: changed.emit()
|
||||||
@export var board_state: Dictionary = {"cards": {}, "stickies": {}, "randoms": []}:
|
@export var board_state: Dictionary = {"cards": {}, "stickies": {}, "randoms": []}:
|
||||||
set(value):
|
set(value):
|
||||||
board_state = value
|
board_state = value
|
||||||
if _is_initialised: changed.emit()
|
if _is_initialised: changed.emit()
|
||||||
|
@export var childhood_mementos: Dictionary = {"cards": {}, "stickies": {}, "randoms": []}:
|
||||||
|
set(value):
|
||||||
|
childhood_mementos = value
|
||||||
|
if _is_initialised: changed.emit()
|
||||||
@export var is_childhood_board_complete: bool = false
|
@export var is_childhood_board_complete: bool = false
|
||||||
@export var thumbnail: Texture = preload("res://import/interface-elements/empty_save_slot.png"):
|
@export var thumbnail: Texture = preload("res://import/interface-elements/empty_save_slot.png"):
|
||||||
set(value):
|
set(value):
|
||||||
|
|
@ -69,7 +77,6 @@ func _init(initial_filepath = "") -> void:
|
||||||
DirAccess.make_dir_absolute(filepath.get_base_dir())
|
DirAccess.make_dir_absolute(filepath.get_base_dir())
|
||||||
|
|
||||||
func read_save_file():
|
func read_save_file():
|
||||||
print("Opening Savegame: %s" % filepath)
|
|
||||||
if filepath == "DEBUG":
|
if filepath == "DEBUG":
|
||||||
if OS.has_feature("debug") or OS.has_feature("demo"):
|
if OS.has_feature("debug") or OS.has_feature("demo"):
|
||||||
push_warning("Created DEBUG savegame. Progress will not be stored!")
|
push_warning("Created DEBUG savegame. Progress will not be stored!")
|
||||||
|
|
@ -80,6 +87,7 @@ func read_save_file():
|
||||||
return
|
return
|
||||||
|
|
||||||
if FileAccess.file_exists(filepath):
|
if FileAccess.file_exists(filepath):
|
||||||
|
print("Opening existing Savegame: %s" % filepath)
|
||||||
var file = FileAccess.open(filepath, FileAccess.READ)
|
var file = FileAccess.open(filepath, FileAccess.READ)
|
||||||
var raw_json = FileAccess.get_file_as_string(filepath)
|
var raw_json = FileAccess.get_file_as_string(filepath)
|
||||||
file.close()
|
file.close()
|
||||||
|
|
@ -96,15 +104,15 @@ func read_save_file():
|
||||||
parsed["mementos_complete"] is float and
|
parsed["mementos_complete"] is float and
|
||||||
parsed["board_state"] is Dictionary and
|
parsed["board_state"] is Dictionary and
|
||||||
parsed["is_childhood_board_complete"] is bool and
|
parsed["is_childhood_board_complete"] is bool and
|
||||||
parsed["last_saved"] is float and
|
parsed["last_saved"] is float# and FIXME
|
||||||
parsed["demo"] is bool and last_saved != 0
|
#parsed["demo"] is bool and last_saved != 0
|
||||||
)
|
)
|
||||||
|
|
||||||
if are_types_valid:
|
if are_types_valid:
|
||||||
for key in parsed.keys():
|
for key in parsed.keys():
|
||||||
set(key, parsed[key])
|
set(key, parsed[key])
|
||||||
|
|
||||||
for dict:Dictionary in board_state.values():
|
for dict:Dictionary in [board_state["cards"], board_state["stickies"]]:
|
||||||
for key in dict.keys():
|
for key in dict.keys():
|
||||||
if dict[key] is String:
|
if dict[key] is String:
|
||||||
if dict[key].begins_with("("):
|
if dict[key].begins_with("("):
|
||||||
|
|
@ -119,7 +127,7 @@ func read_save_file():
|
||||||
for sticky_name:String in board_state["stickies"]:
|
for sticky_name:String in board_state["stickies"]:
|
||||||
stickies[StringName(sticky_name)] = board_state["stickies"][sticky_name]
|
stickies[StringName(sticky_name)] = board_state["stickies"][sticky_name]
|
||||||
for random_name:StringName in board_state["randoms"]:
|
for random_name:StringName in board_state["randoms"]:
|
||||||
randoms.append( board_state["randoms"][random_name] )
|
randoms.append( random_name )
|
||||||
|
|
||||||
board_state = {
|
board_state = {
|
||||||
"cards": cards,
|
"cards": cards,
|
||||||
|
|
@ -139,6 +147,7 @@ func read_save_file():
|
||||||
thumbnail = ImageTexture.create_from_image(tmp_img)
|
thumbnail = ImageTexture.create_from_image(tmp_img)
|
||||||
is_empty = false
|
is_empty = false
|
||||||
else:
|
else:
|
||||||
|
print("Creating empty Savegame: %s" % filepath)
|
||||||
is_valid = true
|
is_valid = true
|
||||||
|
|
||||||
func _get_save_dict() -> Dictionary:
|
func _get_save_dict() -> Dictionary:
|
||||||
|
|
@ -159,6 +168,10 @@ func save_to_file(current_screen: Texture):
|
||||||
push_warning("Saving DEBUG save skipped. This is intentional.")
|
push_warning("Saving DEBUG save skipped. This is intentional.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if current_room == State.rooms.NULL:
|
||||||
|
print("Not saving empty savegame.")
|
||||||
|
return
|
||||||
|
|
||||||
last_saved = Time.get_unix_time_from_system()
|
last_saved = Time.get_unix_time_from_system()
|
||||||
var thumbnail_image: Image = current_screen.get_image()
|
var thumbnail_image: Image = current_screen.get_image()
|
||||||
thumbnail_image.convert(Image.Format.FORMAT_RGB8)
|
thumbnail_image.convert(Image.Format.FORMAT_RGB8)
|
||||||
|
|
|
||||||
|
|
@ -644,7 +644,7 @@ func rebuild_from_savedict(board_state:Dictionary):
|
||||||
card.transform.origin = cards[card.name]# Replacing position reference with card reference! Needed in next loop.
|
card.transform.origin = cards[card.name]# Replacing position reference with card reference! Needed in next loop.
|
||||||
cards[card.name] = card
|
cards[card.name] = card
|
||||||
text_recovery[card.name] = card.text
|
text_recovery[card.name] = card.text
|
||||||
card.picked_random == randoms.has( card.card_id )
|
card.picked_random = randoms.has( card.card_id )
|
||||||
for sticky:StickyNote in card_pile["sticky_notes"]:
|
for sticky:StickyNote in card_pile["sticky_notes"]:
|
||||||
text_recovery[sticky.name] = sticky.text
|
text_recovery[sticky.name] = sticky.text
|
||||||
if stickies[sticky.name] == -1:
|
if stickies[sticky.name] == -1:
|
||||||
|
|
@ -654,7 +654,7 @@ func rebuild_from_savedict(board_state:Dictionary):
|
||||||
else:
|
else:
|
||||||
insert_area(dropzone, sticky)
|
insert_area(dropzone, sticky)
|
||||||
sticky.transform.origin = stickies[sticky.name]
|
sticky.transform.origin = stickies[sticky.name]
|
||||||
sticky.picked_random == randoms.has( sticky.card_id )
|
sticky.picked_random = randoms.has( sticky.sticky_id )
|
||||||
|
|
||||||
func validate_board():
|
func validate_board():
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue