2022-08-03 01:01:10 +00:00
|
|
|
extends Node
|
2022-07-31 05:27:58 +00:00
|
|
|
|
2022-08-28 06:03:39 +00:00
|
|
|
# User values
|
|
|
|
|
2022-08-16 09:30:28 +00:00
|
|
|
var user_first_name = " "
|
|
|
|
var user_birth_month = 0
|
|
|
|
var user_birth_day = 0
|
2022-08-10 09:33:29 +00:00
|
|
|
|
2022-08-28 06:03:39 +00:00
|
|
|
# System time values
|
|
|
|
|
|
|
|
var date
|
|
|
|
var date_month
|
|
|
|
var date_day
|
|
|
|
|
|
|
|
var date_time
|
|
|
|
var date_time_hour
|
|
|
|
|
|
|
|
var welcome_day_part = " "
|
|
|
|
|
2022-08-10 09:33:29 +00:00
|
|
|
# For the login-streak thing
|
|
|
|
|
|
|
|
#var user_login_streak
|
|
|
|
#var user_last_login_year
|
|
|
|
#var user_last_login_month
|
|
|
|
#var user_last_login_day
|
2022-07-31 05:27:58 +00:00
|
|
|
|
2022-08-16 09:30:28 +00:00
|
|
|
|
|
|
|
var config = ConfigFile.new()
|
|
|
|
var err = config.load("user://user.ini")
|
|
|
|
|
2022-08-28 06:03:39 +00:00
|
|
|
# This function can be triggered to update the known system time.
|
|
|
|
func get_device_time():
|
2023-05-14 08:36:23 +00:00
|
|
|
date = Time.get_date_dict_from_system()
|
|
|
|
date_time = Time.get_time_dict_from_system()
|
2022-08-28 06:03:39 +00:00
|
|
|
date_time_hour = date_time.hour
|
|
|
|
date_month = date.month
|
|
|
|
date_day = date.day
|
|
|
|
print(date_month)
|
|
|
|
print(date_day)
|
|
|
|
print(date_time_hour)
|
|
|
|
|
|
|
|
func set_welcome_day_part():
|
|
|
|
if date_time_hour < 24:
|
|
|
|
welcome_day_part = "Good evening, "
|
|
|
|
if date_time_hour < 18:
|
|
|
|
welcome_day_part = "Good afternoon, "
|
|
|
|
if date_time_hour < 12:
|
|
|
|
welcome_day_part = "Good morning, "
|
|
|
|
if date_time_hour < 6:
|
|
|
|
welcome_day_part = "Good night, "
|
|
|
|
|
2022-07-31 05:27:58 +00:00
|
|
|
func _ready():
|
2022-08-28 06:03:39 +00:00
|
|
|
get_device_time()
|
2022-08-16 09:30:28 +00:00
|
|
|
# Read config file if it exists
|
|
|
|
# define variables from ini file
|
|
|
|
if err == OK:
|
|
|
|
user_first_name = config.get_value("User", "user_name")
|
2022-08-28 05:38:17 +00:00
|
|
|
user_birth_month = config.get_value("User", "user_birth_month")
|
|
|
|
user_birth_day = config.get_value("User", "user_birth_day")
|
2022-08-16 09:30:28 +00:00
|
|
|
|
|
|
|
else:
|
|
|
|
pass
|