2024-12-23 01:29:31 +00:00
|
|
|
extends Node
|
|
|
|
|
2024-12-24 11:24:55 +00:00
|
|
|
var config: GlobalConfig
|
2024-12-30 13:19:10 +00:00
|
|
|
|
|
|
|
var timer = Timer.new()
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
timer.wait_time = 5
|
|
|
|
timer.one_shot = false
|
|
|
|
timer.timeout.connect(_on_timer_timeout)
|
|
|
|
add_child(timer)
|
|
|
|
timer.start()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_timer_timeout():
|
|
|
|
var archive = ArchiveManager.archive
|
|
|
|
if archive:
|
|
|
|
archive.game_seconds_all += 5
|
|
|
|
archive.game_seconds_current += 5
|
|
|
|
if config:
|
|
|
|
config.game_total_seconds += 5
|
|
|
|
|
|
|
|
|
|
|
|
func pack_current_time():
|
|
|
|
var packed_time = PackedTime.new()
|
|
|
|
packed_time.time = Time.get_datetime_string_from_system(false, true)
|
|
|
|
var archive = ArchiveManager.archive
|
|
|
|
if archive:
|
|
|
|
packed_time.chapter = archive.current_chapter
|
|
|
|
packed_time.section = archive.current_section
|
|
|
|
packed_time.game_archive_id = archive.archive_id
|
|
|
|
packed_time.game_seconds_all = archive.game_seconds_all
|
|
|
|
packed_time.game_seconds_current = archive.game_seconds_current
|
|
|
|
|
|
|
|
|
|
|
|
# for log use
|
|
|
|
func get_concise_timemark() -> String:
|
|
|
|
var archive = ArchiveManager.archive
|
|
|
|
if not archive:
|
|
|
|
return "r0_c0_s0 00:00:00"
|
|
|
|
var hour = archive.game_seconds_current / 3600 as int
|
|
|
|
var minute = (archive.game_seconds_current % 3600) / 60 as int
|
|
|
|
var second = archive.game_seconds_current % 60
|
|
|
|
return (
|
|
|
|
"r"
|
|
|
|
+ str(ArchiveManager.current_archive_id)
|
|
|
|
+ "_c"
|
|
|
|
+ str(archive.current_chapter)
|
|
|
|
+ "_s"
|
|
|
|
+ str(archive.current_section)
|
|
|
|
+ " "
|
|
|
|
+ str(hour)
|
|
|
|
+ ":"
|
|
|
|
+ str(minute)
|
|
|
|
+ ":"
|
|
|
|
+ str(second)
|
|
|
|
)
|