mirror of
https://github.com/hobbesjaap/wellbeingapp.git
synced 2024-11-08 19:52:59 +00:00
added time-sensitive greeting text at top of start screen
This commit is contained in:
parent
18b5dc91a1
commit
ad32ea5379
@ -35,5 +35,5 @@ func _on_button_user_save_pressed():
|
||||
|
||||
user_values.config.save("user://user.ini")
|
||||
|
||||
node_variables.welcome_label.text = "Good morning, " + user_values.user_first_name + "!"
|
||||
node_variables.welcome_label.text = user_values.welcome_day_part + user_values.user_first_name + "!"
|
||||
ui_control.show_start_menu()
|
||||
|
@ -6,10 +6,18 @@ onready var program_values = get_node("/root/ProgramValues")
|
||||
|
||||
var csv_url = "https://raw.githubusercontent.com/hobbesjaap/wellbeingapp/main/version_info.csv"
|
||||
|
||||
var welcome_day_part = " "
|
||||
|
||||
func _ready():
|
||||
$version_label.text = "Version " + str(program_values.current_version)
|
||||
$welcome_title.text = "Good morning, " + user_values.user_first_name + "!"
|
||||
|
||||
user_values.get_device_time()
|
||||
user_values.set_welcome_day_part()
|
||||
|
||||
$welcome_title.text = user_values.welcome_day_part + user_values.user_first_name + "!"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#func _process(_delta):
|
||||
|
@ -1,9 +1,22 @@
|
||||
extends Node
|
||||
|
||||
# User values
|
||||
|
||||
var user_first_name = " "
|
||||
var user_birth_month = 0
|
||||
var user_birth_day = 0
|
||||
|
||||
# System time values
|
||||
|
||||
var date
|
||||
var date_month
|
||||
var date_day
|
||||
|
||||
var date_time
|
||||
var date_time_hour
|
||||
|
||||
var welcome_day_part = " "
|
||||
|
||||
# For the login-streak thing
|
||||
|
||||
#var user_login_streak
|
||||
@ -15,7 +28,29 @@ var user_birth_day = 0
|
||||
var config = ConfigFile.new()
|
||||
var err = config.load("user://user.ini")
|
||||
|
||||
# This function can be triggered to update the known system time.
|
||||
func get_device_time():
|
||||
date = OS.get_date()
|
||||
date_time = OS.get_time()
|
||||
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, "
|
||||
|
||||
func _ready():
|
||||
get_device_time()
|
||||
# Read config file if it exists
|
||||
# define variables from ini file
|
||||
if err == OK:
|
||||
|
Loading…
Reference in New Issue
Block a user